From ab6b9e3dcab26ba2424fc59cacfadf44a6cb2395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20M=C3=BCller?= Date: Wed, 11 Dec 2024 19:43:06 +0000 Subject: [PATCH] chore: remove code-based test definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ingo Müller --- .../functional/queries/sql/__init__.py | 0 .../sql/approximation_functions_sql.py | 19 -- .../sql/arithmetic_demical_functions_sql.py | 76 ------ .../queries/sql/arithmetic_functions_sql.py | 239 ------------------ .../queries/sql/boolean_functions_sql.py | 52 ---- .../queries/sql/comparison_functions_sql.py | 116 --------- .../queries/sql/datetime_functions_sql.py | 68 ----- .../queries/sql/logarithmic_functions_sql.py | 37 --- .../queries/sql/relations/__init__.py | 0 .../sql/relations/aggregate_relations.py | 92 ------- .../queries/sql/relations/ddl_relations.py | 65 ----- .../queries/sql/relations/fetch_relations.py | 22 -- .../queries/sql/relations/filter_relations.py | 119 --------- .../queries/sql/relations/join_relations.py | 217 ---------------- .../sql/relations/project_relations.py | 60 ----- .../queries/sql/relations/read_relations.py | 36 --- .../queries/sql/relations/set_relations.py | 39 --- .../queries/sql/relations/sort_relations.py | 78 ------ .../queries/sql/relations/write_relations.py | 28 -- .../queries/sql/rounding_functions_sql.py | 29 --- .../queries/sql/string_functions_sql.py | 191 -------------- .../functional/queries/sql/tpch_schema.sql | 77 ------ 22 files changed, 1660 deletions(-) delete mode 100644 substrait_consumer/functional/queries/sql/__init__.py delete mode 100644 substrait_consumer/functional/queries/sql/approximation_functions_sql.py delete mode 100644 substrait_consumer/functional/queries/sql/arithmetic_demical_functions_sql.py delete mode 100644 substrait_consumer/functional/queries/sql/arithmetic_functions_sql.py delete mode 100644 substrait_consumer/functional/queries/sql/boolean_functions_sql.py delete mode 100644 substrait_consumer/functional/queries/sql/comparison_functions_sql.py delete mode 100644 substrait_consumer/functional/queries/sql/datetime_functions_sql.py delete mode 100644 substrait_consumer/functional/queries/sql/logarithmic_functions_sql.py delete mode 100644 substrait_consumer/functional/queries/sql/relations/__init__.py delete mode 100644 substrait_consumer/functional/queries/sql/relations/aggregate_relations.py delete mode 100644 substrait_consumer/functional/queries/sql/relations/ddl_relations.py delete mode 100644 substrait_consumer/functional/queries/sql/relations/fetch_relations.py delete mode 100644 substrait_consumer/functional/queries/sql/relations/filter_relations.py delete mode 100644 substrait_consumer/functional/queries/sql/relations/join_relations.py delete mode 100644 substrait_consumer/functional/queries/sql/relations/project_relations.py delete mode 100644 substrait_consumer/functional/queries/sql/relations/read_relations.py delete mode 100644 substrait_consumer/functional/queries/sql/relations/set_relations.py delete mode 100644 substrait_consumer/functional/queries/sql/relations/sort_relations.py delete mode 100644 substrait_consumer/functional/queries/sql/relations/write_relations.py delete mode 100644 substrait_consumer/functional/queries/sql/rounding_functions_sql.py delete mode 100644 substrait_consumer/functional/queries/sql/string_functions_sql.py delete mode 100644 substrait_consumer/functional/queries/sql/tpch_schema.sql diff --git a/substrait_consumer/functional/queries/sql/__init__.py b/substrait_consumer/functional/queries/sql/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/substrait_consumer/functional/queries/sql/approximation_functions_sql.py b/substrait_consumer/functional/queries/sql/approximation_functions_sql.py deleted file mode 100644 index 4937c22c..00000000 --- a/substrait_consumer/functional/queries/sql/approximation_functions_sql.py +++ /dev/null @@ -1,19 +0,0 @@ -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.duckdb_producer import DuckDBProducer - -SQL_AGGREGATE = { - "approx_count_distinct": ( - """ - SELECT approx_count_distinct(l_comment) - FROM '{lineitem}'; - """, - [DuckDBProducer], - ), - "approx_distinct": ( - """ - SELECT approx_distinct(l_comment) - FROM '{lineitem}'; - """, - [DataFusionProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/arithmetic_demical_functions_sql.py b/substrait_consumer/functional/queries/sql/arithmetic_demical_functions_sql.py deleted file mode 100644 index 60d8fd34..00000000 --- a/substrait_consumer/functional/queries/sql/arithmetic_demical_functions_sql.py +++ /dev/null @@ -1,76 +0,0 @@ -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.duckdb_producer import DuckDBProducer - -SQL_SCALAR = { - "add": ( - """ - SELECT L_TAX, L_DISCOUNT, add(L_TAX, L_DISCOUNT) AS ADD_KEY - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer], - ), - "subtract": ( - """ - SELECT L_TAX, L_DISCOUNT, subtract(L_TAX, L_DISCOUNT) AS SUBTRACT_KEY - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer], - ), - "multiply": ( - """ - SELECT L_TAX, L_EXTENDEDPRICE, round(multiply(L_TAX, L_EXTENDEDPRICE), 2) AS MULTIPLY_KEY - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer], - ), - "divide": ( - """ - SELECT L_TAX, L_EXTENDEDPRICE, round(divide(L_EXTENDEDPRICE, L_TAX), 2) AS DIVIDE_KEY - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer], - ), - "modulus": ( - """ - SELECT L_EXTENDEDPRICE, L_TAX, round(mod(L_EXTENDEDPRICE, L_TAX), 2) AS MODULUS_KEY - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer], - ), -} - -SQL_AGGREGATE = { - "sum": ( - """ - SELECT sum(L_EXTENDEDPRICE) AS SUM_EXTENDEDPRICE - FROM '{lineitem}'; - """, - [DataFusionProducer, DuckDBProducer], - ), - "avg": ( - """ - SELECT round(avg(L_EXTENDEDPRICE), 2) AS AVG_EXTENDEDPRICE - FROM '{lineitem}'; - """, - [DataFusionProducer, DuckDBProducer], - ), - "min": ( - """ - SELECT min(L_EXTENDEDPRICE) AS MIN_EXTENDEDPRICE - FROM '{lineitem}'; - """, - [DataFusionProducer, DuckDBProducer], - ), - "max": ( - """ - SELECT max(L_EXTENDEDPRICE) AS MAX_EXTENDEDPRICE - FROM '{lineitem}'; - """, - [DataFusionProducer, DuckDBProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/arithmetic_functions_sql.py b/substrait_consumer/functional/queries/sql/arithmetic_functions_sql.py deleted file mode 100644 index 6243135c..00000000 --- a/substrait_consumer/functional/queries/sql/arithmetic_functions_sql.py +++ /dev/null @@ -1,239 +0,0 @@ -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -SQL_SCALAR = { - "add": ( - """ - SELECT PS_PARTKEY, PS_SUPPKEY, PS_PARTKEY + PS_SUPPKEY AS ADD_KEY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "subtract": ( - """ - SELECT PS_PARTKEY, PS_SUPPKEY, PS_PARTKEY - PS_SUPPKEY AS SUBTRACT_KEY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "multiply": ( - """ - SELECT PS_PARTKEY, PS_PARTKEY * 10 AS MULTIPLY_KEY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "divide": ( - """ - SELECT PS_PARTKEY, PS_PARTKEY / 10 AS DIVIDE_KEY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "modulus": ( - """ - SELECT PS_PARTKEY, mod(PS_PARTKEY, 10) AS MODULUS_KEY - FROM '{partsupp}' - LIMIT 10; - """, - [DuckDBProducer, IsthmusProducer], - ), - "factorial": ( - """ - SELECT N_NATIONKEY, factorial(N_NATIONKEY) AS FACTORIAL_KEY - FROM '{nation}' - WHERE N_NATIONKEY <= 10 - LIMIT 100; - """, - [DataFusionProducer, DuckDBProducer], - ), - "power": ( - """ - SELECT PS_PARTKEY, power(PS_PARTKEY, 2) AS POWER_KEY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer], - ), - "sqrt": ( - """ - SELECT PS_PARTKEY, round(sqrt(CAST(PS_PARTKEY AS DOUBLE)), 2) AS SQRT_KEY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "exp": ( - """ - SELECT PS_PARTKEY, round(exp(CAST(PS_PARTKEY AS DOUBLE)), 2) AS EXP_KEY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "negate": ( - """ - SELECT PS_PARTKEY, negate(PS_PARTKEY) AS NEGATE_KEY - FROM '{partsupp}' - LIMIT 10; - """, - [DuckDBProducer], - ), - "cos": ( - """ - SELECT round(cos(CAST(ps_supplycost AS DOUBLE)), 2) AS COS_SUPPLY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "acos": ( - """ - SELECT round(acos(CAST(l_tax AS DOUBLE)), 2) AS ACOS_TAX - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "sin": ( - """ - SELECT round(sin(CAST(ps_supplycost AS DOUBLE)), 2) AS SIN_SUPPLY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "asin": ( - """ - SELECT round(asin(CAST(l_tax AS DOUBLE)), 2) AS ASIN_TAX - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "tan": ( - """ - SELECT round(tan(CAST(ps_supplycost AS DOUBLE)), 2) AS TAN_SUPPLY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "atan": ( - """ - SELECT round(atan(CAST(l_tax AS DOUBLE)), 2) AS ATAN_TAX - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "atan2": ( - """ - SELECT round(atan2(CAST(l_tax AS DOUBLE), CAST(l_tax AS DOUBLE)), 2) AS ATAN2_TAX - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "abs": ( - """ - SELECT a, abs(a) AS ABS_A - FROM 't' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "sign": ( - """ - SELECT a, sign(a) AS SIGN_A - FROM 't' - LIMIT 10; - """, - [DuckDBProducer, IsthmusProducer], - ), -} - -SQL_AGGREGATE = { - "sum": ( - """ - SELECT sum(PS_SUPPLYCOST) AS SUM_SUPPLYCOST - FROM '{partsupp}'; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "count": ( - """ - SELECT count(PS_SUPPLYCOST) AS COUNT_SUPPLYCOST - FROM '{partsupp}'; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "count_star": ( - """ - SELECT count(*) - FROM '{partsupp}'; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "avg": ( - """ - SELECT round(avg(PS_SUPPLYCOST), 2) AS AVG_SUPPLYCOST - FROM '{partsupp}'; - """, - [DataFusionProducer, DuckDBProducer], - ), - "min": ( - """ - SELECT min(PS_SUPPLYCOST) AS MIN_SUPPLYCOST - FROM '{partsupp}'; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "max": ( - """ - SELECT max(PS_SUPPLYCOST) AS MAX_SUPPLYCOST - FROM '{partsupp}'; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "median": ( - """ - SELECT median(PS_SUPPLYCOST) AS MEDIAN_SUPPLYCOST - FROM '{partsupp}'; - """, - [DataFusionProducer, DuckDBProducer], - ), - "mode": ( - """ - SELECT mode(PS_SUPPLYCOST) AS MODE_SUPPLYCOST - FROM '{partsupp}'; - """, - [DuckDBProducer], - ), - "product": ( - """ - SELECT product(PS_SUPPLYCOST) AS PRODUCT_SUPPLYCOST - FROM '{partsupp}'; - """, - [DuckDBProducer], - ), - "std_dev": ( - """ - SELECT round(stddev(PS_SUPPLYCOST), 2) AS STDDEV_SUPPLYCOST - FROM '{partsupp}'; - """, - [DuckDBProducer], - ), - "variance": ( - """ - SELECT round(variance(PS_SUPPLYCOST), 2) AS VARIANCE_SUPPLYCOST - FROM '{partsupp}'; - """, - [DuckDBProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/boolean_functions_sql.py b/substrait_consumer/functional/queries/sql/boolean_functions_sql.py deleted file mode 100644 index ce510ea1..00000000 --- a/substrait_consumer/functional/queries/sql/boolean_functions_sql.py +++ /dev/null @@ -1,52 +0,0 @@ -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -SQL_SCALAR = { - "or": ( - """ - SELECT a - FROM 't' - WHERE a = 5 OR a = 7; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "and": ( - """ - SELECT a, b - FROM 't' - WHERE a < 5 AND b = 1; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "not": ( - """ - SELECT c FROM 't' WHERE NOT FALSE - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "xor": ( - """ - SELECT a, b, xor(a, b) AS xor_a_b - FROM 't'; - """, - [DuckDBProducer], - ), -} - -SQL_AGGREGATE = { - "bool_and": ( - """ - SELECT bool_and(c) AS bool_and_c - FROM 't' - """, - [DataFusionProducer, DuckDBProducer], - ), - "bool_or": ( - """ - SELECT bool_or(c) AS bool_or_c - FROM 't' - """, - [DataFusionProducer, DuckDBProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/comparison_functions_sql.py b/substrait_consumer/functional/queries/sql/comparison_functions_sql.py deleted file mode 100644 index ba92b4a8..00000000 --- a/substrait_consumer/functional/queries/sql/comparison_functions_sql.py +++ /dev/null @@ -1,116 +0,0 @@ -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -SQL_SCALAR = { - "not_equal": ( - """ - SELECT N_NAME - FROM '{nation}' - WHERE NOT N_NAME = 'CANADA' - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "equal": ( - """ - SELECT PS_AVAILQTY, PS_PARTKEY - FROM '{partsupp}' - WHERE PS_AVAILQTY = PS_PARTKEY - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "is_not_distinct_from": ( - """ - SELECT a - FROM 't' - WHERE a IS NOT DISTINCT FROM NULL - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "lt": ( - """ - SELECT PS_AVAILQTY - FROM '{partsupp}' - WHERE PS_AVAILQTY < 10 - ORDER BY PS_AVAILQTY - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "lte": ( - """ - SELECT PS_AVAILQTY - FROM '{partsupp}' - WHERE PS_AVAILQTY <= 10 - ORDER BY PS_AVAILQTY - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "gt": ( - """ - SELECT PS_AVAILQTY - FROM '{partsupp}' - WHERE PS_AVAILQTY > 9990 - ORDER BY PS_AVAILQTY - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "gte": ( - """ - SELECT PS_AVAILQTY - FROM '{partsupp}' - WHERE PS_AVAILQTY >= 9990 - ORDER BY PS_AVAILQTY - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "is_not_null": ( - """ - SELECT a - FROM 't' - WHERE a IS NOT NULL - """, - [DuckDBProducer, IsthmusProducer], - ), - "is_null": ( - """ - SELECT a - FROM 't' - WHERE a IS NULL - """, - [DuckDBProducer, IsthmusProducer], - ), - "is_nan": ( - """ - SELECT a, isnan(a) as isnan_a - FROM 't' - """, - [DataFusionProducer, DuckDBProducer], - ), - "is_finite": ( - """ - SELECT a, isfinite(a) as isfinite_a - FROM 't' - """, - [DuckDBProducer], - ), - "is_infinite": ( - """ - SELECT a, isinf(a) as isinf_a - FROM 't' - """, - [DuckDBProducer], - ), - "between": ( - """ - SELECT a FROM 't' WHERE a BETWEEN 1 AND 5 - ORDER BY a - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "coalesce": ( - """ - SELECT coalesce(NULL,NULL,'test_string') - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/datetime_functions_sql.py b/substrait_consumer/functional/queries/sql/datetime_functions_sql.py deleted file mode 100644 index 4165e77d..00000000 --- a/substrait_consumer/functional/queries/sql/datetime_functions_sql.py +++ /dev/null @@ -1,68 +0,0 @@ -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -SQL_SCALAR = { - "extract": ( - """ - SELECT L_SHIPDATE, extract(year FROM L_SHIPDATE) - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "add": ( - """ - SELECT L_SHIPDATE, L_SHIPDATE + INTERVAL 5 DAY - FROM '{lineitem}' - LIMIT 10; - """, - [DuckDBProducer], - ), - "subtract": ( - """ - SELECT L_SHIPDATE, L_SHIPDATE - INTERVAL 5 DAY - FROM '{lineitem}' - LIMIT 10; - """, - [DuckDBProducer], - ), - "lt": ( - """ - SELECT L_COMMITDATE, L_RECEIPTDATE, L_COMMITDATE < L_RECEIPTDATE - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "lte": ( - """ - SELECT L_COMMITDATE, L_RECEIPTDATE, L_COMMITDATE <= L_RECEIPTDATE - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "gt": ( - """ - SELECT L_COMMITDATE, L_RECEIPTDATE, L_COMMITDATE > L_RECEIPTDATE - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "gte": ( - """ - SELECT L_COMMITDATE, L_RECEIPTDATE, L_COMMITDATE >= L_RECEIPTDATE - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "add_intervals": ( - """ - SELECT INTERVAL 1 HOUR + INTERVAL 5 HOUR - """, - [DuckDBProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/logarithmic_functions_sql.py b/substrait_consumer/functional/queries/sql/logarithmic_functions_sql.py deleted file mode 100644 index 73a199af..00000000 --- a/substrait_consumer/functional/queries/sql/logarithmic_functions_sql.py +++ /dev/null @@ -1,37 +0,0 @@ -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer -SQL_SCALAR = { - "ln": ( - """ - SELECT PS_SUPPLYCOST, round(ln(PS_SUPPLYCOST), 2) AS LN_SUPPLY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer], - ), - "log10": ( - """ - SELECT PS_SUPPLYCOST, round(log10(PS_SUPPLYCOST), 2) AS LOG10_SUPPLY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer], - ), - "log2": ( - """ - SELECT PS_SUPPLYCOST, round(log2(PS_SUPPLYCOST), 2) AS LOG2_SUPPLY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer], - ), - "logb": ( - """ - SELECT PS_SUPPLYCOST, round(logb(PS_SUPPLYCOST, 10), 2) AS LOGB_SUPPLY - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/relations/__init__.py b/substrait_consumer/functional/queries/sql/relations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/substrait_consumer/functional/queries/sql/relations/aggregate_relations.py b/substrait_consumer/functional/queries/sql/relations/aggregate_relations.py deleted file mode 100644 index b42c4ce9..00000000 --- a/substrait_consumer/functional/queries/sql/relations/aggregate_relations.py +++ /dev/null @@ -1,92 +0,0 @@ -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -AGGREGATE_RELATIONS = { - "single_measure_aggregate": ( - """ - SELECT COUNT(L_PARTKEY) - FROM '{lineitem}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "multiple_measure_aggregate": ( - """ - SELECT MIN(O_TOTALPRICE), MAX(O_TOTALPRICE), AVG(O_TOTALPRICE) - FROM '{orders}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "aggregate_with_computation": ( - """ - SELECT AVG(O_TOTALPRICE) * 10 - FROM '{orders}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "compute_within_aggregate": ( - """ - SELECT AVG(O_TOTALPRICE * 10) - FROM '{orders}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "computation_between_aggregates": ( - """ - SELECT AVG(O_TOTALPRICE) + MAX(O_TOTALPRICE) - FROM '{orders}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "aggregate_in_subquery": ( - """ - - SELECT O_TOTALPRICE - FROM '{orders}' - WHERE O_TOTALPRICE <= (SELECT AVG(O_TOTALPRICE) FROM '{orders}') - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "aggregate_with_group_by": ( - """ - SELECT L_ORDERKEY, L_LINENUMBER, count(*) - FROM '{lineitem}' - GROUP BY L_ORDERKEY, L_LINENUMBER - ORDER BY L_ORDERKEY, L_LINENUMBER - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "aggregate_with_group_by_cube": ( - """ - SELECT L_ORDERKEY, L_LINENUMBER, count(*) - FROM '{lineitem}' - GROUP BY CUBE(L_ORDERKEY, L_LINENUMBER) - ORDER BY L_ORDERKEY, L_LINENUMBER - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "aggregate_with_group_by_rollup": ( - """ - - SELECT L_ORDERKEY, L_LINENUMBER, count(*) - FROM '{lineitem}' - GROUP BY ROLLUP(L_ORDERKEY, L_LINENUMBER) - ORDER BY L_ORDERKEY, L_LINENUMBER - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "aggregate_with_grouping_set": ( - """ - - SELECT SUM(L_EXTENDEDPRICE), L_LINENUMBER, L_ORDERKEY - FROM '{lineitem}' - GROUP BY GROUPING SETS - ( - (L_LINENUMBER), - (L_ORDERKEY) - ) - ORDER BY L_LINENUMBER - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/relations/ddl_relations.py b/substrait_consumer/functional/queries/sql/relations/ddl_relations.py deleted file mode 100644 index bd33f604..00000000 --- a/substrait_consumer/functional/queries/sql/relations/ddl_relations.py +++ /dev/null @@ -1,65 +0,0 @@ -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -DDL_RELATIONS = { - "create_table": ( - """ - CREATE TABLE customer2 ( - custkey INT NOT NULL, - name VARCHAR NOT NULL, - address VARCHAR NOT NULL, - ) - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "drop_table": ( - """ - DROP TABLE '{customer}'; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "alter_table": ( - """ - ALTER TABLE '{customer}' - ADD email VARCHAR; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "alter_column": ( - """ - ALTER TABLE '{customer}' - RENAME COLUMN c_address TO c_street_address; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "drop_column": ( - """ - ALTER TABLE '{customer}' - DROP COLUMN c_address; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "create_view": ( - """ - CREATE VIEW customer_view AS - SELECT - C_CUSTKEY, - C_NAME, - FROM - '{customer}'; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "create_or_replace_view": ( - """ - CREATE OR REPLACE VIEW customer_view AS - SELECT - C_CUSTKEY, - C_NAME, - FROM - '{customer}'; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/relations/fetch_relations.py b/substrait_consumer/functional/queries/sql/relations/fetch_relations.py deleted file mode 100644 index 01bb1f30..00000000 --- a/substrait_consumer/functional/queries/sql/relations/fetch_relations.py +++ /dev/null @@ -1,22 +0,0 @@ -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -FETCH_RELATIONS = { - "fetch": ( - """ - SELECT O_ORDERKEY FROM '{orders}' - FETCH NEXT 1 ROWS ONLY; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "fetch_with_offset": ( - """ - SELECT O_ORDERKEY FROM '{orders}' - OFFSET 5 ROWS - FETCH NEXT 5 ROWS ONLY; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - -} diff --git a/substrait_consumer/functional/queries/sql/relations/filter_relations.py b/substrait_consumer/functional/queries/sql/relations/filter_relations.py deleted file mode 100644 index 3b17b023..00000000 --- a/substrait_consumer/functional/queries/sql/relations/filter_relations.py +++ /dev/null @@ -1,119 +0,0 @@ -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -FILTER_RELATIONS = { - "where_equal_multi_col": ( - """ - SELECT L_DISCOUNT, L_TAX - FROM '{lineitem}' - WHERE L_DISCOUNT = L_TAX - ORDER BY L_DISCOUNT - LIMIT 20; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "where_not_equal_multi_col": ( - """ - SELECT L_DISCOUNT, L_TAX - FROM '{lineitem}' - WHERE L_DISCOUNT != L_TAX - ORDER BY L_DISCOUNT, L_TAX - LIMIT 20; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "where_gt_multi_col": ( - """ - SELECT L_DISCOUNT, L_TAX - FROM '{lineitem}' - WHERE L_DISCOUNT > L_TAX - ORDER BY L_DISCOUNT, L_TAX - LIMIT 20; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "where_gte_multi_col": ( - """ - SELECT L_DISCOUNT, L_TAX - FROM '{lineitem}' - WHERE L_DISCOUNT >= L_TAX - ORDER BY L_DISCOUNT, L_TAX - LIMIT 20; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "where_lt_multi_col": ( - """ - SELECT L_DISCOUNT, L_TAX - FROM '{lineitem}' - WHERE L_DISCOUNT < L_TAX - ORDER BY L_DISCOUNT, L_TAX - LIMIT 20; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "where_lte_multi_col": ( - """ - SELECT L_DISCOUNT, L_TAX - FROM '{lineitem}' - WHERE L_DISCOUNT <= L_TAX - ORDER BY L_DISCOUNT, L_TAX - LIMIT 20; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "where_like": ( - """ - SELECT L_SHIPINSTRUCT, L_ORDERKEY - FROM '{lineitem}' - WHERE L_SHIPINSTRUCT LIKE '%DELIVER IN PERSON%' - ORDER BY L_ORDERKEY - LIMIT 20; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "where_between": ( - """ - SELECT L_ORDERKEY - FROM '{lineitem}' - WHERE L_ORDERKEY BETWEEN 20 AND 50 - LIMIT 20; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "where_in": ( - """ - SELECT L_ORDERKEY - FROM '{lineitem}' - WHERE L_ORDERKEY IN (1, 2, 3) - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "where_or": ( - """ - SELECT L_ORDERKEY, L_SHIPINSTRUCT - FROM '{lineitem}' - WHERE L_ORDERKEY = 2 OR L_ORDERKEY = 3 - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "where_and": ( - """ - SELECT L_ORDERKEY, L_SHIPINSTRUCT - FROM '{lineitem}' - WHERE L_ORDERKEY = 2 AND L_SHIPINSTRUCT = 'TAKE BACK RETURN' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "having": ( - """ - SELECT L_QUANTITY, COUNT(*) - FROM '{lineitem}' - GROUP BY L_QUANTITY - HAVING COUNT(*) > 12100 - ORDER BY L_QUANTITY - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/relations/join_relations.py b/substrait_consumer/functional/queries/sql/relations/join_relations.py deleted file mode 100644 index 5acbf3c9..00000000 --- a/substrait_consumer/functional/queries/sql/relations/join_relations.py +++ /dev/null @@ -1,217 +0,0 @@ -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -JOIN_RELATIONS = { - "inner_join": ( - """ - SELECT - c.C_CUSTKEY, - c.C_NAME, - o.O_ORDERKEY - FROM - '{customer}' c - INNER JOIN - '{orders}' o - ON - c.C_CUSTKEY = o.O_CUSTKEY; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "left_join": ( - """ - SELECT - c.C_CUSTKEY, - c.C_NAME, - o.O_ORDERKEY - FROM - '{customer}' c - LEFT JOIN - '{orders}' o - ON - c.C_CUSTKEY = o.O_CUSTKEY; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "right_join": ( - """ - SELECT - c.C_CUSTKEY, - c.C_NAME, - o.O_ORDERKEY - FROM - '{customer}' c - RIGHT JOIN - '{orders}' o - ON - c.C_CUSTKEY = o.O_CUSTKEY; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "full_join": ( - """ - SELECT - c.C_CUSTKEY, - c.C_NAME, - o.O_ORDERKEY - FROM - '{customer}' c - FULL JOIN - '{orders}' o - ON - c.C_CUSTKEY = o.O_CUSTKEY; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "cross_join": ( - """ - SELECT - c.C_CUSTKEY, - c.C_NAME, - o.O_ORDERKEY - FROM - '{customer}' c - CROSS JOIN - '{orders}' o - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "left_semi_join": ( - """ - SELECT - c.C_CUSTKEY, - c.C_NAME - FROM - '{customer}' c - WHERE - EXISTS ( - SELECT 1 - FROM '{orders}' o - WHERE o.O_CUSTKEY = c.C_CUSTKEY - ); - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "right_semi_join": ( - """ - SELECT - o.O_ORDERKEY, - o.O_CUSTKEY - FROM - '{orders}' o - WHERE - EXISTS ( - SELECT 1 - FROM '{customer}' c - WHERE c.C_CUSTKEY = o.O_CUSTKEY - ); - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "left_anti_join": ( - """ - SELECT - c.C_CUSTKEY, - c.C_NAME - FROM - '{customer}' c - WHERE - NOT EXISTS ( - SELECT 1 - FROM '{orders}' o - WHERE o.O_CUSTKEY = c.C_CUSTKEY - ); - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "right_anti_join": ( - """ - SELECT - o.O_ORDERKEY, - o.O_CUSTKEY - FROM - '{orders}' o - WHERE - NOT EXISTS ( - SELECT 1 - FROM '{lineitem}' l - WHERE l.L_ORDERKEY = o.O_ORDERKEY - ); - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "left_single_join": ( - """ - SELECT - c1.C_CUSTKEY AS c1key, - c1.C_NAME AS c1name, - c1.C_NATIONKEY AS c1nationakey, - c2.C_CUSTKEY AS c2key, - c2.C_NAME AS c2name, - c2.C_NATIONKEY AS c2nationakey - FROM - '{customer}' c1 - LEFT JOIN - '{customer}' c2 - ON - c1.C_NATIONKEY = c2.C_NATIONKEY - AND c1.C_CUSTKEY <> c2.C_CUSTKEY; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "right_single_join": ( - """ - SELECT - c1.C_CUSTKEY AS c1key, - c1.C_NAME AS c1name, - c1.C_NATIONKEY AS c1nationakey, - c2.C_CUSTKEY AS c2key, - c2.C_NAME AS c2name, - c2.C_NATIONKEY AS c2nationakey - FROM - '{customer}' c1 - RIGHT JOIN - '{customer}' c2 - ON - c1.C_NATIONKEY = c2.C_NATIONKEY - AND c1.C_CUSTKEY <> c2.C_CUSTKEY; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "left_mark_join": ( - """ - SELECT - c.C_CUSTKEY, - c.C_NAME, - CASE - WHEN EXISTS ( - SELECT 1 - FROM '{orders}' o - WHERE o.O_CUSTKEY = c.C_CUSTKEY - ) THEN 'Marked' - ELSE 'Not Marked' - END AS mark_status - FROM - '{customer}' c; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "right_mark_join": ( - """ - SELECT - o.O_ORDERKEY, - o.O_CUSTKEY, - CASE - WHEN EXISTS ( - SELECT 1 - FROM '{customer}' c - WHERE c.C_CUSTKEY = o.O_CUSTKEY - ) THEN 'Marked' - ELSE 'Not Marked' - END AS mark_status - FROM - '{orders}' o; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/relations/project_relations.py b/substrait_consumer/functional/queries/sql/relations/project_relations.py deleted file mode 100644 index 230ebe10..00000000 --- a/substrait_consumer/functional/queries/sql/relations/project_relations.py +++ /dev/null @@ -1,60 +0,0 @@ -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -PROJECT_RELATIONS = { - "project_single_col": ( - """ - SELECT * - FROM '{lineitem}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "project_multi_col": ( - """ - SELECT L_DISCOUNT, L_TAX - FROM '{lineitem}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "project_all_col": ( - """ - SELECT * - FROM '{region}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "extended_project": ( - """ - SELECT L_QUANTITY, L_EXTENDEDPRICE*10 AS MULTI_PRICE - FROM '{lineitem}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "subquery_in_project": ( - """ - SELECT C_CUSTKEY, - (SELECT SUM(O_TOTALPRICE) - FROM '{orders}' - WHERE C_CUSTKEY = O_CUSTKEY) - AS total_price - FROM '{customer}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "distinct_in_project": ( - """ - SELECT DISTINCT L_LINESTATUS - FROM '{lineitem}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "count_distinct_in_project": ( - """ - SELECT COUNT(DISTINCT L_EXTENDEDPRICE) - FROM '{lineitem}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - -} diff --git a/substrait_consumer/functional/queries/sql/relations/read_relations.py b/substrait_consumer/functional/queries/sql/relations/read_relations.py deleted file mode 100644 index 8a997bc0..00000000 --- a/substrait_consumer/functional/queries/sql/relations/read_relations.py +++ /dev/null @@ -1,36 +0,0 @@ -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -READ_RELATIONS = { - "read_named_table": ( - """ - SELECT PS_PARTKEY FROM '{partsupp}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "isthmus_read_virtual_table": ( - """ - SELECT 10 - """, - [IsthmusProducer], - ), - "datafusion_read_virtual_table": ( - """ - SELECT * FROM VALUES (10) - """, - [DataFusionProducer], - ), - "duckdb_read_virtual_table": ( - """ - SELECT * FROM (VALUES (10)) - """, - [DuckDBProducer], - ), - "duckdb_read_local_file": ( - """ - SELECT * FROM read_parquet('{customer_file_path}'); - """, - [DuckDBProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/relations/set_relations.py b/substrait_consumer/functional/queries/sql/relations/set_relations.py deleted file mode 100644 index 695a86bb..00000000 --- a/substrait_consumer/functional/queries/sql/relations/set_relations.py +++ /dev/null @@ -1,39 +0,0 @@ -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -SET_RELATIONS = { - "union_distinct": ( - """ - SELECT C_NATIONKEY FROM '{customer}' - UNION - SELECT N_NATIONKEY FROM '{nation}' - ORDER BY C_NATIONKEY - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "union_all": ( - """ - SELECT C_NATIONKEY FROM '{customer}' - UNION ALL - SELECT N_NATIONKEY FROM '{nation}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "intersect": ( - """ - SELECT C_NATIONKEY FROM '{customer}' - INTERSECT - SELECT N_NATIONKEY FROM '{nation}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "except": ( - """ - SELECT o_totalprice FROM '{orders}' - EXCEPT - SELECT c_acctbal FROM '{customer}' - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/relations/sort_relations.py b/substrait_consumer/functional/queries/sql/relations/sort_relations.py deleted file mode 100644 index 3ecfbb33..00000000 --- a/substrait_consumer/functional/queries/sql/relations/sort_relations.py +++ /dev/null @@ -1,78 +0,0 @@ -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -SORT_RELATIONS = { - "single_col_default_sort": ( - """ - SELECT PS_AVAILQTY - FROM '{partsupp}' - ORDER BY PS_AVAILQTY - LIMIT 10; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "single_col_asc": ( - """ - SELECT PS_SUPPLYCOST - FROM '{partsupp}' - ORDER BY PS_SUPPLYCOST ASC - LIMIT 10; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "single_col_desc": ( - """ - SELECT PS_SUPPLYCOST - FROM '{partsupp}' - ORDER BY PS_SUPPLYCOST DESC - LIMIT 10; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "multi_col_asc": ( - """ - SELECT PS_SUPPLYCOST, PS_AVAILQTY - FROM '{partsupp}' - ORDER BY PS_SUPPLYCOST ASC, PS_AVAILQTY - LIMIT 10; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "multi_col_desc": ( - """ - SELECT PS_SUPPLYCOST, PS_AVAILQTY - FROM '{partsupp}' - ORDER BY PS_SUPPLYCOST DESC - LIMIT 10; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "multi_col_asc_desc": ( - """ - SELECT PS_SUPPLYCOST, PS_AVAILQTY - FROM '{partsupp}' - ORDER BY PS_SUPPLYCOST ASC, PS_AVAILQTY DESC - LIMIT 10; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "multi_col_desc_asc": ( - """ - SELECT PS_SUPPLYCOST, PS_AVAILQTY - FROM '{partsupp}' - ORDER BY PS_SUPPLYCOST DESC, PS_AVAILQTY ASC - LIMIT 10; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "order_by_col_number": ( - """ - SELECT PS_SUPPLYCOST, PS_AVAILQTY - FROM '{partsupp}' - ORDER BY 1, 2 - LIMIT 10; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/relations/write_relations.py b/substrait_consumer/functional/queries/sql/relations/write_relations.py deleted file mode 100644 index aa891d8a..00000000 --- a/substrait_consumer/functional/queries/sql/relations/write_relations.py +++ /dev/null @@ -1,28 +0,0 @@ -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer - -WRITE_RELATIONS = { - "insert": ( - """ - INSERT INTO '{region}' (r_regionkey, r_name, r_comment) - VALUES (99999, 'region_name', 'region comment'); - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "update": ( - """ - UPDATE '{customer}' - SET c_address = 'Substait Avenue', c_phone = '123-456-7890' - WHERE c_custkey = 1; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), - "delete": ( - """ - DELETE FROM '{customer}' - WHERE c_custkey = 1; - """, - [DuckDBProducer, DataFusionProducer, IsthmusProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/rounding_functions_sql.py b/substrait_consumer/functional/queries/sql/rounding_functions_sql.py deleted file mode 100644 index 4c5e6d3b..00000000 --- a/substrait_consumer/functional/queries/sql/rounding_functions_sql.py +++ /dev/null @@ -1,29 +0,0 @@ -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer -SQL_SCALAR = { - "ceil": ( - """ - SELECT PS_SUPPLYCOST, ceil(CAST(PS_SUPPLYCOST AS DOUBLE)) AS CEIL_SUPPLYCOST - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "floor": ( - """ - SELECT PS_SUPPLYCOST, floor(CAST(PS_SUPPLYCOST AS DOUBLE)) AS FLOOR_SUPPLYCOST - FROM '{partsupp}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "round": ( - """ - SELECT L_EXTENDEDPRICE, round(CAST(L_EXTENDEDPRICE AS DOUBLE), 1) AS ROUND_EXTENDEDPRICE - FROM '{lineitem}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/string_functions_sql.py b/substrait_consumer/functional/queries/sql/string_functions_sql.py deleted file mode 100644 index bc27e1a6..00000000 --- a/substrait_consumer/functional/queries/sql/string_functions_sql.py +++ /dev/null @@ -1,191 +0,0 @@ -from substrait_consumer.producers.datafusion_producer import DataFusionProducer -from substrait_consumer.producers.duckdb_producer import DuckDBProducer -from substrait_consumer.producers.isthmus_producer import IsthmusProducer -SQL_SCALAR = { - "concat": ( - """ - SELECT N_NAME, concat(N_NAME, N_COMMENT) AS concat_nation - FROM '{nation}'; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "concat_ws": ( - """ - SELECT concat_ws('.', N_NAME, N_COMMENT) - FROM '{nation}'; - """, - [DataFusionProducer, DuckDBProducer], - ), - "like": ( - """ - SELECT N_NAME - FROM '{nation}' - WHERE N_NAME LIKE 'ALGERIA'; - """, - [DataFusionProducer, DuckDBProducer, IsthmusProducer], - ), - "starts_with_duckdb": ( - """ - SELECT N_NAME - FROM '{nation}' - WHERE prefix(N_NAME, 'A'); - """, - [DuckDBProducer], - ), - "starts_with": ( - """ - SELECT N_NAME - FROM '{nation}' - WHERE starts_with(N_NAME, 'A'); - """, - [DataFusionProducer], - ), - "ends_with": ( - """ - SELECT N_NAME - FROM '{nation}' - WHERE suffix(N_NAME, 'A'); - """, - [DuckDBProducer], - ), - "substring": ( - """ - SELECT N_NAME, substr(N_NAME, 1, 3) AS substr_name - FROM '{nation}'; - """, - [DataFusionProducer, DuckDBProducer], - ), - "substring_isthmus": ( - """ - SELECT N_NAME, SUBSTRING(N_NAME FROM 1 FOR 3) AS substr_name - FROM '{nation}'; - """, - [IsthmusProducer], - ), - "contains": ( - """ - SELECT N_NAME - FROM '{nation}' - WHERE contains(N_NAME, 'IA'); - """, - [DataFusionProducer, DuckDBProducer], - ), - "strpos": ( - """ - SELECT N_NAME, strpos(N_NAME, 'A') AS strpos_name - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "replace": ( - """ - SELECT N_NAME, replace(N_NAME, 'A', 'a') AS replace_name - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "repeat": ( - """ - SELECT N_NAME, repeat(N_NAME, 2) AS repeated_N_NAME - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "reverse": ( - """ - SELECT N_NAME, reverse(N_NAME) AS reversed_N_NAME - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "lower": ( - """ - SELECT N_NAME, lower(N_NAME) AS lowercase_N_NAME - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "upper": ( - """ - SELECT O_COMMENT, upper(O_COMMENT) AS uppercase_O_COMMENT - FROM '{orders}' - LIMIT 10; - """, - [DataFusionProducer, DuckDBProducer], - ), - "char_length": ( - """ - SELECT N_NAME, length(N_NAME) AS char_length_N_NAME - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "bit_length": ( - """ - SELECT N_NAME, bit_length(N_NAME) AS bit_length_N_NAME - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "ltrim": ( - """ - SELECT N_NAME, ltrim(N_NAME, 'A') AS ltrim_N_NAME - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "rtrim": ( - """ - SELECT N_NAME, rtrim(N_NAME, 'A') AS rtrim_N_NAME - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "trim": ( - """ - SELECT N_NAME, trim(N_NAME, 'A') AS trim_N_NAME - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "lpad": ( - """ - SELECT N_NAME, lpad(N_NAME, 10, ' ') AS lpad_N_NAME - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "rpad": ( - """ - SELECT N_NAME, rpad(N_NAME, 10, ' ') AS rpad_N_NAME - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "left": ( - """ - SELECT N_NAME, left(N_NAME, 2) AS left_extract_N_NAME - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), - "right": ( - """ - SELECT N_NAME, right(N_NAME, 2) AS right_extract_N_NAME - FROM '{nation}' - """, - [DataFusionProducer, DuckDBProducer], - ), -} - -SQL_AGGREGATE = { - "string_agg": ( - """ - SELECT N_NAME, string_agg(N_NAME, ',') - FROM '{nation}' - GROUP BY N_NAME - ORDER BY N_NAME - """, - [DuckDBProducer], - ), -} diff --git a/substrait_consumer/functional/queries/sql/tpch_schema.sql b/substrait_consumer/functional/queries/sql/tpch_schema.sql deleted file mode 100644 index 81f6f927..00000000 --- a/substrait_consumer/functional/queries/sql/tpch_schema.sql +++ /dev/null @@ -1,77 +0,0 @@ -CREATE TABLE PART ( - P_PARTKEY BIGINT NOT NULL, - P_NAME VARCHAR(55), - P_MFGR CHAR(25), - P_BRAND CHAR(10), - P_TYPE VARCHAR(25), - P_SIZE INTEGER, - P_CONTAINER CHAR(10), - P_RETAILPRICE DECIMAL, - P_COMMENT VARCHAR(23) -); -CREATE TABLE SUPPLIER ( - S_SUPPKEY BIGINT NOT NULL, - S_NAME CHAR(25), - S_ADDRESS VARCHAR(40), - S_NATIONKEY BIGINT NOT NULL, - S_PHONE CHAR(15), - S_ACCTBAL DECIMAL, - S_COMMENT VARCHAR(101) -); -CREATE TABLE PARTSUPP ( - PS_PARTKEY BIGINT NOT NULL, - PS_SUPPKEY BIGINT NOT NULL, - PS_AVAILQTY INTEGER, - PS_SUPPLYCOST DECIMAL, - PS_COMMENT VARCHAR(199) -); -CREATE TABLE CUSTOMER ( - C_CUSTKEY BIGINT NOT NULL, - C_NAME VARCHAR(25), - C_ADDRESS VARCHAR(40), - C_NATIONKEY BIGINT NOT NULL, - C_PHONE CHAR(15), - C_ACCTBAL DECIMAL, - C_MKTSEGMENT CHAR(10), - C_COMMENT VARCHAR(117) -); -CREATE TABLE ORDERS ( - O_ORDERKEY BIGINT NOT NULL, - O_CUSTKEY BIGINT NOT NULL, - O_ORDERSTATUS CHAR(1), - O_TOTALPRICE DECIMAL, - O_ORDERDATE DATE, - O_ORDERPRIORITY CHAR(15), - O_CLERK CHAR(15), - O_SHIPPRIORITY INTEGER, - O_COMMENT VARCHAR(79) -); -CREATE TABLE LINEITEM ( - L_ORDERKEY BIGINT NOT NULL, - L_PARTKEY BIGINT NOT NULL, - L_SUPPKEY BIGINT NOT NULL, - L_LINENUMBER INTEGER, - L_QUANTITY DECIMAL, - L_EXTENDEDPRICE DECIMAL, - L_DISCOUNT DECIMAL, - L_TAX DECIMAL, - L_RETURNFLAG CHAR(1), - L_LINESTATUS CHAR(1), - L_SHIPDATE DATE, - L_COMMITDATE DATE, - L_RECEIPTDATE DATE, - L_SHIPINSTRUCT CHAR(25), - L_SHIPMODE CHAR(10), - L_COMMENT VARCHAR(44) -); -CREATE TABLE NATION ( - N_NATIONKEY BIGINT NOT NULL, - N_NAME CHAR(25), - N_REGIONKEY BIGINT NOT NULL, - N_COMMENT VARCHAR(152) -); -CREATE TABLE REGION ( - R_REGIONKEY BIGINT NOT NULL, - R_NAME CHAR(25), - R_COMMENT VARCHAR(152) -);