Skip to content

Commit

Permalink
Fix: snowflake startswith closes #1998
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao committed Aug 7, 2023
1 parent 99d408b commit d219a65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions sqlglot/dialects/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ class Generator(generator.Generator):
exp.PartitionedByProperty: lambda self, e: f"PARTITION BY {self.sql(e, 'this')}",
exp.Select: transforms.preprocess([transforms.eliminate_distinct_on]),
exp.StarMap: rename_func("OBJECT_CONSTRUCT"),
exp.StartsWith: rename_func("STARTSWITH"),
exp.StrPosition: lambda self, e: self.func(
"POSITION", e.args.get("substr"), e.this, e.args.get("position")
),
Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_presto.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ def test_presto(self, logger):
read={"spark": "STARTSWITH('abc', 'a')"},
write={
"presto": "STARTS_WITH('abc', 'a')",
"snowflake": "STARTSWITH('abc', 'a')",
"spark": "STARTSWITH('abc', 'a')",
},
)
Expand Down

0 comments on commit d219a65

Please sign in to comment.