Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sqlglot/expressions/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class JSONArray(Expression, Func):
"return_type": False,
"strict": False,
}
is_var_len_args = True


class JSONArrayAgg(Expression, AggFunc):
Expand Down
7 changes: 7 additions & 0 deletions tests/dialects/test_duckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,13 @@ def test_duckdb(self):
"snowflake": "SELECT TO_VARIANT(ARRAY_CONSTRUCT())",
},
)
self.validate_all(
"SELECT JSON_ARRAY('a', 'b', 'c', 'd', 'e')",
write={
"duckdb": "SELECT JSON_ARRAY('a', 'b', 'c', 'd', 'e')",
"snowflake": "SELECT TO_VARIANT(ARRAY_CONSTRUCT('a', 'b', 'c', 'd', 'e'))",
},
)
self.validate_identity(
"SELECT col FROM t WHERE JSON_EXTRACT_STRING(col, '$.id') NOT IN ('b')",
"SELECT col FROM t WHERE NOT (col ->> '$.id') IN ('b')",
Expand Down
Loading