-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(snowflake)!: type annotation for APPROX_TOP_K_ACCUMULATE functio… #6309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(snowflake)!: type annotation for APPROX_TOP_K_ACCUMULATE functio… #6309
Conversation
…n. Tests added all dialects that support APPROX_TOP_K_ACCUMULATE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments, also can you share the docs ofAPPROX_TOP_K_ACCUMULATE for Spark and Databricks ? I'm not sure if the function exists in these dialects.
https://spark.apache.org/docs/preview/api/sql/index.html#approx_top_k_accumulate |
…APPROX_TOP_K_ACCUMULATE function.
…APPROX_TOP_K_ACCUMULATE function.
I see - does it exist in Databricks? I tried to run a test but it fails. |
tests/dialects/test_databricks.py
Outdated
| self.assertEqual(null_type.sql(), "NULL") | ||
| self.assertEqual(null_type.sql("databricks"), "VOID") | ||
|
|
||
| self.validate_identity("SELECT APPROX_TOP_K_ACCUMULATE(col, 10)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also believe that DBX should be compatible with Spark but I'll go ahead and remove this test for now since it's not documented properly and @geooo109 mentioned it doesn't seem to work.
We can always revisit when we iterate through DBX
| self.validate_identity("SELECT APPROX_TOP_K_ACCUMULATE(col, 10)") |
https://docs.databricks.com/aws/en/sql/language-manual/functions/approx_top_k |
|
Annotates APPROXIMATE_TOP_K_ACCUMULATE expressions as returning VARIANT.
Updates the type mapping in the Snowflake dialect.
Includes generic tests in snowflake, databricks and spark to validate type inference for this function.