Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@fivetran-kwoodbeck fivetran-kwoodbeck changed the title feat(snowflake)!: annotate type for MAP* functions feat(snowflake)!: annotate type for MAP_* functions Dec 18, 2025
@fivetran-kwoodbeck fivetran-kwoodbeck changed the title feat(snowflake)!: annotate type for MAP_* functions feat(snowflake)!: annotate types for MAP_* functions Dec 18, 2025
@github-actions
Copy link
Contributor

SQLGlot Integration Test Results

Comparing:

  • this branch (sqlglot:feature/annotatetype-map_functions, sqlglot version: feature/annotatetype-map_functions)
  • baseline (main, sqlglot version: 28.5.1.dev1)

⚠️ Limited to dialects: snowflake

By Dialect

dialect main sqlglot:feature/annotatetype-map_functions difference links
snowflake -> duckdb 621/1085 passed (57.2%) 622/1085 passed (57.3%) ⬆ improved by 0.1% full result / delta
snowflake -> snowflake 975/1085 passed (89.9%) 975/1085 passed (89.9%) No change full result / delta

Overall

main: 2170 total, 1596 passed (pass rate: 73.5%), sqlglot version: 28.5.1.dev1

sqlglot:feature/annotatetype-map_functions: 2170 total, 1597 passed (pass rate: 73.6%), sqlglot version: feature/annotatetype-map_functions

Difference: No change

self.validate_identity("SELECT rename, replace")
self.validate_identity("SELECT TIMEADD(HOUR, 2, CAST('09:05:03' AS TIME))")
self.validate_identity("SELECT CAST(OBJECT_CONSTRUCT('a', 1) AS MAP(VARCHAR, INT))")
self.validate_identity(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe simplify these statements a bit for readability, we probably don't need multi-item maps for most operations

Copy link
Collaborator

@geooo109 geooo109 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you also check if other databases support these functions ?

Comment on lines +7440 to +7442
class MapCat(Func):
arg_types = {"this": True, "expressions": False}
is_var_len_args = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a multi-argument Func? Snowflake's docs specify two arguments:

MAP_CAT( <map1> , <map2> )

Comment on lines +7449 to +7451
class MapDelete(Func):
arg_types = {"this": True, "expressions": False}
is_var_len_args = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expressions arg should be mandatory, MAP_DELETE always requires at least one key:

MAP_DELETE( <map>, <key1> [, <key2>, ... ] )

Comment on lines +7454 to +7456
class MapInsert(Func):
arg_types = {"this": True, "expressions": False}
is_var_len_args = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have more fine-grained arguments for this:

MAP_INSERT( <map> , <key> , <value> [ , <updateFlag> ] )

Let's do this, key, value, update_flag (optional).

Comment on lines +7463 to +7465
class MapPick(Func):
arg_types = {"this": True, "expressions": False}
is_var_len_args = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto re: expressions becomine True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants