diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-10-09 06:28:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-10-09 06:28:52 +0000 |
commit | a8cfe41f416430cab0d6aa0ff6a688b2832a39aa (patch) | |
tree | dd48a1d853317a0daaaf3e2f6868e01dbad936e7 /tests/fixtures | |
parent | Releasing debian version 25.24.0-1. (diff) | |
download | sqlglot-a8cfe41f416430cab0d6aa0ff6a688b2832a39aa.tar.xz sqlglot-a8cfe41f416430cab0d6aa0ff6a688b2832a39aa.zip |
Merging upstream version 25.24.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/fixtures')
-rw-r--r-- | tests/fixtures/optimizer/annotate_functions.sql | 189 | ||||
-rw-r--r-- | tests/fixtures/pretty.sql | 31 |
2 files changed, 220 insertions, 0 deletions
diff --git a/tests/fixtures/optimizer/annotate_functions.sql b/tests/fixtures/optimizer/annotate_functions.sql new file mode 100644 index 0000000..8aa77d4 --- /dev/null +++ b/tests/fixtures/optimizer/annotate_functions.sql @@ -0,0 +1,189 @@ +-------------------------------------- +-- Dialect +-------------------------------------- +ABS(1); +INT; + +ABS(1.5); +DOUBLE; + +GREATEST(1, 2, 3); +INT; + +GREATEST(1, 2.5, 3); +DOUBLE; + +LEAST(1, 2, 3); +INT; + +LEAST(1, 2.5, 3); +DOUBLE; + +-------------------------------------- +-- Spark2 / Spark3 / Databricks +-------------------------------------- + +# dialect: spark2, spark, databricks +SUBSTRING(tbl.str_col, 0, 0); +STRING; + +# dialect: spark2, spark, databricks +SUBSTRING(tbl.bin_col, 0, 0); +BINARY; + +# dialect: spark2, spark, databricks +CONCAT(tbl.bin_col, tbl.bin_col); +BINARY; + +# dialect: spark2, spark, databricks +CONCAT(tbl.bin_col, tbl.str_col); +STRING; + +# dialect: spark2, spark, databricks +CONCAT(tbl.str_col, tbl.bin_col); +STRING; + +# dialect: spark2, spark, databricks +CONCAT(tbl.str_col, tbl.str_col); +STRING; + +# dialect: spark2, spark, databricks +CONCAT(tbl.str_col, unknown); +STRING; + +# dialect: spark2, spark, databricks +CONCAT(tbl.bin_col, unknown); +UNKNOWN; + +# dialect: spark2, spark, databricks +CONCAT(unknown, unknown); +UNKNOWN; + +# dialect: spark2, spark, databricks +LPAD(tbl.bin_col, 1, tbl.bin_col); +BINARY; + +# dialect: spark2, spark, databricks +RPAD(tbl.bin_col, 1, tbl.bin_col); +BINARY; + +# dialect: spark2, spark, databricks +LPAD(tbl.bin_col, 1, tbl.str_col); +STRING; + +# dialect: spark2, spark, databricks +RPAD(tbl.bin_col, 1, tbl.str_col); +STRING; + +# dialect: spark2, spark, databricks +LPAD(tbl.str_col, 1, tbl.bin_col); +STRING; + +# dialect: spark2, spark, databricks +RPAD(tbl.str_col, 1, tbl.bin_col); +STRING; + +# dialect: spark2, spark, databricks +LPAD(tbl.str_col, 1, tbl.str_col); +STRING; + +# dialect: spark2, spark, databricks +RPAD(tbl.str_col, 1, tbl.str_col); +STRING; + + +-------------------------------------- +-- BigQuery +-------------------------------------- + +# dialect: bigquery +SIGN(1); +INT; + +# dialect: bigquery +SIGN(1.5); +DOUBLE; + +# dialect: bigquery +CEIL(1); +DOUBLE; + +# dialect: bigquery +CEIL(5.5); +DOUBLE; + +# dialect: bigquery +CEIL(tbl.bignum_col); +BIGDECIMAL; + +# dialect: bigquery +FLOOR(1); +DOUBLE; + +# dialect: bigquery +FLOOR(5.5); +DOUBLE; + +# dialect: bigquery +FLOOR(tbl.bignum_col); +BIGDECIMAL; + +# dialect: bigquery +SQRT(1); +DOUBLE; + +# dialect: bigquery +SQRT(5.5); +DOUBLE; + +# dialect: bigquery +SQRT(tbl.bignum_col); +BIGDECIMAL; + +# dialect: bigquery +LN(1); +DOUBLE; + +# dialect: bigquery +LN(5.5); +DOUBLE; + +# dialect: bigquery +LN(tbl.bignum_col); +BIGDECIMAL; + +# dialect: bigquery +LOG(1); +DOUBLE; + +# dialect: bigquery +LOG(5.5); +DOUBLE; + +# dialect: bigquery +LOG(tbl.bignum_col); +BIGDECIMAL; + +# dialect: bigquery +ROUND(1); +DOUBLE; + +# dialect: bigquery +ROUND(5.5); +DOUBLE; + +# dialect: bigquery +ROUND(tbl.bignum_col); +BIGDECIMAL; + +# dialect: bigquery +EXP(1); +DOUBLE; + +# dialect: bigquery +EXP(5.5); +DOUBLE; + +# dialect: bigquery +EXP(tbl.bignum_col); +BIGDECIMAL;
\ No newline at end of file diff --git a/tests/fixtures/pretty.sql b/tests/fixtures/pretty.sql index 3e5619a..ca5e4a9 100644 --- a/tests/fixtures/pretty.sql +++ b/tests/fixtures/pretty.sql @@ -418,3 +418,34 @@ INSERT FIRST SELECT salary FROM employees; + +SELECT * +FROM foo +wHERE 1=1 + AND + -- my comment + EXISTS ( + SELECT 1 + FROM bar + ); +SELECT + * +FROM foo +WHERE + 1 = 1 AND EXISTS( + SELECT + 1 + FROM bar + ) /* my comment */; + +SELECT 1 +FROM foo +WHERE 1=1 +AND -- first comment + -- second comment + foo.a = 1; +SELECT + 1 +FROM foo +WHERE + 1 = 1 AND /* first comment */ foo.a /* second comment */ = 1; |