diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-30 08:03:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-30 08:03:58 +0000 |
commit | 9f19773cebdc9476f2a3266d3c01c967c38fcd1e (patch) | |
tree | a60f607ba2bb64fb45da86c297ff29ffc9b92f58 /sqlglot/generator.py | |
parent | Releasing debian version 16.7.3-1. (diff) | |
download | sqlglot-9f19773cebdc9476f2a3266d3c01c967c38fcd1e.tar.xz sqlglot-9f19773cebdc9476f2a3266d3c01c967c38fcd1e.zip |
Merging upstream version 16.7.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/generator.py')
-rw-r--r-- | sqlglot/generator.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sqlglot/generator.py b/sqlglot/generator.py index 5d8a4ca..a41af12 100644 --- a/sqlglot/generator.py +++ b/sqlglot/generator.py @@ -2423,6 +2423,15 @@ class Generator: buckets = self.sql(expression, "buckets") return f"CLUSTERED BY ({expressions}){sorted_by} INTO {buckets} BUCKETS" + def anyvalue_sql(self, expression: exp.AnyValue) -> str: + this = self.sql(expression, "this") + having = self.sql(expression, "having") + + if having: + this = f"{this} HAVING {'MAX' if expression.args.get('max') else 'MIN'} {having}" + + return self.func("ANY_VALUE", this) + def cached_generator( cache: t.Optional[t.Dict[int, str]] = None |