diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-09-20 09:22:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-09-20 09:22:25 +0000 |
commit | a45bbbb6f2fbd117d5d314e34e85afc2b48ad677 (patch) | |
tree | 35b576637338ae7cef217ddab721ad81aeb3f78c /sqlglot/dialects/spark2.py | |
parent | Releasing debian version 18.4.1-1. (diff) | |
download | sqlglot-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 '')
-rw-r--r-- | sqlglot/dialects/spark2.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sqlglot/dialects/spark2.py b/sqlglot/dialects/spark2.py index 4489b6b..56d33ba 100644 --- a/sqlglot/dialects/spark2.py +++ b/sqlglot/dialects/spark2.py @@ -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) |