Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/dialects/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ class Snowflake(Dialect):
**Dialect.TYPE_TO_EXPRESSIONS,
exp.DataType.Type.DOUBLE: {
*Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.DOUBLE],
exp.Cosh,
exp.Cot,
exp.Sin,
exp.Tan,
Expand Down
4 changes: 4 additions & 0 deletions sqlglot/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5553,6 +5553,10 @@ class Tan(Func):
pass


class Cosh(Func):
pass


class CosineDistance(Func):
arg_types = {"this": True, "expression": True}

Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,7 @@ def test_ml_functions(self):
self.validate_identity(
"SELECT * FROM ML.PREDICT(MODEL mydataset.mymodel, (SELECT custom_label, column1, column2 FROM mydataset.mytable), STRUCT(0.55 AS threshold))"
)
self.validate_identity("SELECT COSH(1.5)")
self.validate_identity(
"SELECT * FROM ML.PREDICT(MODEL `my_project`.my_dataset.my_model, (SELECT * FROM input_data))"
)
Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class TestDatabricks(Validator):
dialect = "databricks"

def test_databricks(self):
self.validate_identity("SELECT COSH(1.5)")
null_type = exp.DataType.build("VOID", dialect="databricks")
self.assertEqual(null_type.sql(), "NULL")
self.assertEqual(null_type.sql("databricks"), "VOID")
Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_duckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class TestDuckDB(Validator):
dialect = "duckdb"

def test_duckdb(self):
self.validate_identity("SELECT COSH(1.5)")
with self.assertRaises(ParseError):
parse_one("1 //", read="duckdb")

Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class TestPostgres(Validator):
dialect = "postgres"

def test_postgres(self):
self.validate_identity("SELECT COSH(1.5)")
self.validate_identity(
"select count() OVER(partition by a order by a range offset preceding exclude current row)",
"SELECT COUNT() OVER (PARTITION BY a ORDER BY a range BETWEEN offset preceding AND CURRENT ROW EXCLUDE CURRENT ROW)",
Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class TestRedshift(Validator):
dialect = "redshift"

def test_redshift(self):
self.validate_identity("SELECT COSH(1.5)")
self.validate_all(
"SELECT SPLIT_TO_ARRAY('12,345,6789')",
write={
Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def test_snowflake(self):
self.validate_identity("SELECT SOUNDEX_P123(column_name)")
self.validate_identity("SELECT ABS(x)")
self.validate_identity("SELECT SIGN(x)")
self.validate_identity("SELECT COSH(1.5)")
self.validate_identity("SELECT JAROWINKLER_SIMILARITY('hello', 'world')")
self.validate_identity("SELECT TRANSLATE(column_name, 'abc', '123')")
self.validate_identity("SELECT UNICODE(column_name)")
Expand Down
4 changes: 4 additions & 0 deletions tests/fixtures/optimizer/annotate_functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1631,6 +1631,10 @@ VARCHAR;
COLLATE('hello', 'utf8');
VARCHAR;

# dialect: snowflake
COSH(1.5);
DOUBLE;

# dialect: snowflake
COMPRESS('Hello World', 'SNAPPY');
BINARY;
Expand Down