summaryrefslogtreecommitdiffstats
path: root/tests/fixtures/optimizer
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-10-09 06:28:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-10-09 06:28:52 +0000
commita8cfe41f416430cab0d6aa0ff6a688b2832a39aa (patch)
treedd48a1d853317a0daaaf3e2f6868e01dbad936e7 /tests/fixtures/optimizer
parentReleasing debian version 25.24.0-1. (diff)
downloadsqlglot-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/optimizer')
-rw-r--r--tests/fixtures/optimizer/annotate_functions.sql189
1 files changed, 189 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