summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/hive.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-20 09:22:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-20 09:22:25 +0000
commita45bbbb6f2fbd117d5d314e34e85afc2b48ad677 (patch)
tree35b576637338ae7cef217ddab721ad81aeb3f78c /sqlglot/dialects/hive.py
parentReleasing debian version 18.4.1-1. (diff)
downloadsqlglot-a45bbbb6f2fbd117d5d314e34e85afc2b48ad677.tar.xz
sqlglot-a45bbbb6f2fbd117d5d314e34e85afc2b48ad677.zip
Merging upstream version 18.5.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/dialects/hive.py')
-rw-r--r--sqlglot/dialects/hive.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/sqlglot/dialects/hive.py b/sqlglot/dialects/hive.py
index 8b17c06..bec27d3 100644
--- a/sqlglot/dialects/hive.py
+++ b/sqlglot/dialects/hive.py
@@ -9,6 +9,7 @@ from sqlglot.dialects.dialect import (
create_with_partitions_sql,
format_time_lambda,
if_sql,
+ is_parse_json,
left_to_substring_sql,
locate_to_strposition,
max_or_greatest,
@@ -89,7 +90,7 @@ def _date_diff_sql(self: Hive.Generator, expression: exp.DateDiff) -> str:
def _json_format_sql(self: Hive.Generator, expression: exp.JSONFormat) -> str:
this = expression.this
- if isinstance(this, exp.Cast) and this.is_type("json") and this.this.is_string:
+ if is_parse_json(this) and this.this.is_string:
# Since FROM_JSON requires a nested type, we always wrap the json string with
# an array to ensure that "naked" strings like "'a'" will be handled correctly
wrapped_json = exp.Literal.string(f"[{this.this.name}]")
@@ -150,6 +151,7 @@ def _to_date_sql(self: Hive.Generator, expression: exp.TsOrDsToDate) -> str:
class Hive(Dialect):
ALIAS_POST_TABLESAMPLE = True
IDENTIFIERS_CAN_START_WITH_DIGIT = True
+ SUPPORTS_USER_DEFINED_TYPES = False
# https://spark.apache.org/docs/latest/sql-ref-identifier.html#description
RESOLVES_IDENTIFIERS_AS_UPPERCASE = None
@@ -222,7 +224,6 @@ class Hive(Dialect):
class Parser(parser.Parser):
LOG_DEFAULTS_TO_LN = True
STRICT_CAST = False
- SUPPORTS_USER_DEFINED_TYPES = False
FUNCTIONS = {
**parser.Parser.FUNCTIONS,