Adding upstream version 18.5.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
649252bd84
commit
c4fc25c23b
67 changed files with 32690 additions and 32450 deletions
|
@ -7,6 +7,7 @@ from sqlglot.dialects.dialect import (
|
|||
binary_from_function,
|
||||
create_with_partitions_sql,
|
||||
format_time_lambda,
|
||||
is_parse_json,
|
||||
pivot_column_names,
|
||||
rename_func,
|
||||
trim_sql,
|
||||
|
@ -242,10 +243,11 @@ class Spark2(Hive):
|
|||
CREATE_FUNCTION_RETURN_AS = False
|
||||
|
||||
def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) -> str:
|
||||
if isinstance(expression.this, exp.Cast) and expression.this.is_type("json"):
|
||||
if is_parse_json(expression.this):
|
||||
schema = f"'{self.sql(expression, 'to')}'"
|
||||
return self.func("FROM_JSON", expression.this.this, schema)
|
||||
if expression.is_type("json"):
|
||||
|
||||
if is_parse_json(expression):
|
||||
return self.func("TO_JSON", expression.this)
|
||||
|
||||
return super(Hive.Generator, self).cast_sql(expression, safe_prefix=safe_prefix)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue