Skip to content

Commit 160f4fd

Browse files
committed
feat(optimizer)!: Annotate CURRENT_CATALOG() for Hive, Spark, and DBX
1 parent 9861c1b commit 160f4fd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

sqlglot/typing/hive.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@
2626
exp.Encode: {"returns": exp.DataType.Type.BINARY},
2727
exp.If: {"annotator": lambda self, e: self._annotate_by_args(e, "true", "false", promote=True)},
2828
exp.StrToUnix: {"returns": exp.DataType.Type.BIGINT},
29+
exp.CurrentCatalog: {"returns": exp.DataType.Type.VARCHAR},
2930
}

tests/fixtures/optimizer/annotate_functions.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ DOUBLE;
515515
CBRT(tbl.int_col);
516516
DOUBLE;
517517

518+
# dialect: hive, spark2, spark, databricks
519+
CURRENT_CATALOG();
520+
STRING;
521+
518522
--------------------------------------
519523
-- BigQuery
520524
--------------------------------------

0 commit comments

Comments
 (0)