diff --git a/pydough/conversion/relational_converter.py b/pydough/conversion/relational_converter.py index b22eec400..d04d90b64 100644 --- a/pydough/conversion/relational_converter.py +++ b/pydough/conversion/relational_converter.py @@ -15,6 +15,7 @@ from pydough.metadata import ( CartesianProductMetadata, GeneralJoinMetadata, + MaskedTableColumnMetadata, SimpleJoinMetadata, SimpleTableMetadata, ) @@ -765,6 +766,21 @@ def handle_children( context.expressions[hybrid_ref] = context.expressions[key_expr] return context + def is_masked_column(self, expr: HybridExpr) -> bool: + """ + Checks if a given expression is a masked column expression. + + Args: + `expr`: the expression to check. + + Returns: + True if the expression is a masked column expression, False + otherwise. + """ + return isinstance(expr, HybridColumnExpr) and isinstance( + expr.column.column_property, MaskedTableColumnMetadata + ) + def build_simple_table_scan( self, node: HybridCollectionAccess ) -> TranslationOutput: @@ -806,7 +822,31 @@ def build_simple_table_scan( assert isinstance(expr, ColumnReference) real_names.add(expr.name) uniqueness.add(frozenset(real_names)) - answer = Scan(node.collection.collection.table_path, scan_columns, uniqueness) + answer: RelationalNode = Scan( + node.collection.collection.table_path, scan_columns, uniqueness + ) + + # If any of the columns are masked, insert a projection on top to unmask + # them. + if any(self.is_masked_column(expr) for expr in node.terms.values()): + unmask_columns: dict[str, RelationalExpression] = {} + for name, hybrid_expr in node.terms.items(): + if self.is_masked_column(hybrid_expr): + assert isinstance(hybrid_expr, HybridColumnExpr) + assert isinstance( + hybrid_expr.column.column_property, MaskedTableColumnMetadata + ) + unmask_columns[name] = CallExpression( + pydop.MaskedExpressionFunctionOperator( + hybrid_expr.column.column_property, True + ), + hybrid_expr.column.column_property.unprotected_data_type, + [ColumnReference(name, hybrid_expr.typ)], + ) + else: + unmask_columns[name] = ColumnReference(name, hybrid_expr.typ) + answer = Project(answer, unmask_columns) + return TranslationOutput(answer, out_columns) def translate_sub_collection( diff --git a/pydough/pydough_operators/__init__.py b/pydough/pydough_operators/__init__.py index 42f7f384e..fe6a71a50 100644 --- a/pydough/pydough_operators/__init__.py +++ b/pydough/pydough_operators/__init__.py @@ -61,6 +61,7 @@ "MONOTONIC", "MONTH", "MUL", + "MaskedExpressionFunctionOperator", "NDISTINCT", "NEQ", "NEXT", @@ -207,6 +208,7 @@ ExpressionFunctionOperator, ExpressionWindowOperator, KeywordBranchingExpressionFunctionOperator, + MaskedExpressionFunctionOperator, PyDoughExpressionOperator, SqlAliasExpressionFunctionOperator, SqlMacroExpressionFunctionOperator, diff --git a/pydough/pydough_operators/expression_operators/__init__.py b/pydough/pydough_operators/expression_operators/__init__.py index 97698c6e8..78f0a60c1 100644 --- a/pydough/pydough_operators/expression_operators/__init__.py +++ b/pydough/pydough_operators/expression_operators/__init__.py @@ -58,6 +58,7 @@ "MONOTONIC", "MONTH", "MUL", + "MaskedExpressionFunctionOperator", "NDISTINCT", "NEQ", "NEXT", @@ -107,6 +108,7 @@ from .expression_operator import PyDoughExpressionOperator from .expression_window_operators import ExpressionWindowOperator from .keyword_branching_operators import KeywordBranchingExpressionFunctionOperator +from .masked_expression_function_operator import MaskedExpressionFunctionOperator from .registered_expression_operators import ( ABS, ABSENT, diff --git a/pydough/pydough_operators/expression_operators/masked_expression_function_operator.py b/pydough/pydough_operators/expression_operators/masked_expression_function_operator.py new file mode 100644 index 000000000..905361348 --- /dev/null +++ b/pydough/pydough_operators/expression_operators/masked_expression_function_operator.py @@ -0,0 +1,91 @@ +""" +Special operators containing logic to mask or unmask data based on a masked +table column's metadata. +""" + +__all__ = ["MaskedExpressionFunctionOperator"] + + +from pydough.metadata.properties import MaskedTableColumnMetadata +from pydough.pydough_operators.type_inference import ( + ConstantType, + ExpressionTypeDeducer, + RequireNumArgs, + TypeVerifier, +) +from pydough.types import PyDoughType + +from .expression_function_operators import ExpressionFunctionOperator + + +class MaskedExpressionFunctionOperator(ExpressionFunctionOperator): + """ + A special expression function operator that masks or unmasks data based on + a masked table column's metadata. The operator contains the metadata for + the column, but can represent either a masking or unmasking operation + depending on the `is_unmask` flag. + """ + + def __init__( + self, + masking_metadata: MaskedTableColumnMetadata, + is_unmask: bool, + ): + # Create a dummy verifier that requires exactly one argument, since all + # masking/unmasking operations are unary. + verifier: TypeVerifier = RequireNumArgs(1) + + # Create a dummy deducer that always returns the appropriate data type + # from the metadata based on whether this is a masking or unmasking + # operation. + target_type: PyDoughType = ( + masking_metadata.unprotected_data_type + if is_unmask + else masking_metadata.data_type + ) + deducer: ExpressionTypeDeducer = ConstantType(target_type) + + super().__init__( + "UNMASK" if is_unmask else "MASK", False, verifier, deducer, False + ) + self._masking_metadata: MaskedTableColumnMetadata = masking_metadata + self._is_unmask: bool = is_unmask + + @property + def masking_metadata(self) -> MaskedTableColumnMetadata: + """ + The metadata for the masked column. + """ + return self._masking_metadata + + @property + def is_unmask(self) -> bool: + """ + Whether this operator is unprotecting (True) or protecting (False). + """ + return self._is_unmask + + @property + def format_string(self) -> str: + """ + The format string to use for this operator to either mask or unmask the + operand. + """ + return ( + self.masking_metadata.unprotect_protocol + if self.is_unmask + else self.masking_metadata.protect_protocol + ) + + def to_string(self, arg_strings: list[str]) -> str: + name: str = "UNMASK" if self.is_unmask else "MASK" + arg_strings = [f"[{s}]" for s in arg_strings] + return f"{name}::({self.format_string.format(*arg_strings)})" + + def equals(self, other: object) -> bool: + return ( + isinstance(other, MaskedExpressionFunctionOperator) + and self.masking_metadata == other.masking_metadata + and self.is_unmask == other.is_unmask + and super().equals(other) + ) diff --git a/pydough/sqlglot/transform_bindings/base_transform_bindings.py b/pydough/sqlglot/transform_bindings/base_transform_bindings.py index 70ec31d93..dd4f1e6a5 100644 --- a/pydough/sqlglot/transform_bindings/base_transform_bindings.py +++ b/pydough/sqlglot/transform_bindings/base_transform_bindings.py @@ -172,12 +172,24 @@ def convert_call_to_sqlglot( return sqlglot_expressions.Anonymous( this=operator.sql_function_alias, expressions=args ) - if isinstance(operator, pydop.SqlMacroExpressionFunctionOperator): + if isinstance( + operator, + ( + pydop.MaskedExpressionFunctionOperator, + pydop.SqlMacroExpressionFunctionOperator, + ), + ): # For user defined operators that are a macro for SQL text, convert # the arguments to SQL text strings then inject them into the macro - # as a format string, then re-parse it. + # as a format string, then re-parse it. The same idea works for the + # masking/unmasking operators arg_strings: list[str] = [arg.sql() for arg in args] - combined_string: str = operator.macro_text.format(*arg_strings) + fmt_string: str + if isinstance(operator, pydop.MaskedExpressionFunctionOperator): + fmt_string = operator.format_string + else: + fmt_string = operator.macro_text + combined_string: str = fmt_string.format(*arg_strings) return parse_one(combined_string) match operator: case pydop.NOT: diff --git a/tests/gen_data/init_cryptbank.sql b/tests/gen_data/init_cryptbank.sql index e24548870..9f032ed6d 100644 --- a/tests/gen_data/init_cryptbank.sql +++ b/tests/gen_data/init_cryptbank.sql @@ -37,14 +37,14 @@ CREATE TABLE TRANSACTIONS ( ); INSERT INTO CUSTOMERS (c_key, c_fname, c_lname, c_phone, c_email, c_addr, c_birthday) -SELECT * - -- 42 - column1, -- ARITHMETIC SHIFT: 42 - -- UPPER(column2), -- UPPERCASE - -- UPPER(column3), -- UPPERCASE - -- REPLACE(REPLACE(REPLACE(column4, '0', '*'), '9', '0'), '*', '9'), -- DIGIT SWITCH: 0 <-> 9 - -- SUBSTRING(column5, 2) || SUBSTRING(column5, 1, 1), -- FIRST CHAR TRANSPOSE - -- SUBSTRING(column6, 2) || SUBSTRING(column6, 1, 1), -- FIRST CHAR TRANSPOSE - -- DATE(column7, '-472 days') -- DAY SHIFT: 472 +SELECT + 42 - column1, -- ARITHMETIC SHIFT: 42 + UPPER(column2), -- UPPERCASE + UPPER(column3), -- UPPERCASE + REPLACE(REPLACE(REPLACE(column4, '0', '*'), '9', '0'), '*', '9'), -- DIGIT SWITCH: 0 <-> 9 + SUBSTRING(column5, 2) || SUBSTRING(column5, 1, 1), -- FIRST CHAR TRANSPOSE + SUBSTRING(column6, 2) || SUBSTRING(column6, 1, 1), -- FIRST CHAR TRANSPOSE + DATE(column7, '-472 days') -- DAY SHIFT: 472 FROM ( VALUES (1, 'alice', 'johnson', '555-123-4567', 'alice_j@example.org', '123 Maple St;Portland;OR;97205', '1985-04-12'), @@ -81,13 +81,13 @@ INSERT INTO BRANCHES (b_key, b_name, b_addr) VALUES ; INSERT INTO ACCOUNTS (a_key, a_custkey, a_branchkey, a_balance, a_type, a_open_ts) -SELECT * - -- CAST(CAST(column1 as TEXT) || CAST(column1 as TEXT) AS INTEGER), - -- column2, - -- column3, - -- column4 * column4, -- GEOMETRIC SHIFT - -- SUBSTRING(column5, 2) || SUBSTRING(column5, 1, 1), -- FIRST CHAR TRANSPOSE - -- DATETIME(column6, '-123456789 seconds') -- SECOND SHIFT: 123456789 +SELECT + CAST(CAST(column1 as TEXT) || CAST(column1 as TEXT) AS INTEGER), + column2, + column3, + column4 * column4, -- GEOMETRIC SHIFT + SUBSTRING(column5, 2) || SUBSTRING(column5, 1, 1), -- FIRST CHAR TRANSPOSE + DATETIME(column6, '-123456789 seconds') -- SECOND SHIFT: 123456789 FROM ( VALUES -- Customer 1 (alice johnson, OR) - 3 accounts @@ -189,12 +189,11 @@ VALUES INSERT INTO TRANSACTIONS (t_key, t_sourceaccount, t_destaccount, t_amount, t_ts) SELECT - * - -- column1, - -- column2, - -- column3, - -- 1025.67 - column4, -- ARITHMETIC SHIFT: 1025.67 - -- DATETIME(column5, '-54321 seconds') -- SECOND SHIFT: 54321 + column1, + column2, + column3, + 1025.67 - column4, -- ARITHMETIC SHIFT: 1025.67 + DATETIME(column5, '-54321 seconds') -- SECOND SHIFT: 54321 FROM ( VALUES (1, 41, 8, 2753.92, '2019-11-11 18:00:52'), diff --git a/tests/test_masked_sf.py b/tests/test_masked_sf.py index 48474bd97..d94b1007f 100644 --- a/tests/test_masked_sf.py +++ b/tests/test_masked_sf.py @@ -870,9 +870,6 @@ def test_pipeline_until_sql_masked_sf( ) -@pytest.mark.skip( - reason="Skipping until masked table column relational handling is implemented" -) @pytest.mark.execute @pytest.mark.sf_masked @pytest.mark.parametrize("account_type", ["NONE", "PARTIAL", "FULL"]) diff --git a/tests/test_masked_sqlite.py b/tests/test_masked_sqlite.py index d07811ae6..cf5cd5dce 100644 --- a/tests/test_masked_sqlite.py +++ b/tests/test_masked_sqlite.py @@ -624,12 +624,15 @@ def test_pipeline_until_relational_cryptbank( masked_graphs: graph_fetcher, get_plan_test_filename: Callable[[str], str], update_tests: bool, + enable_mask_rewrites: str, ) -> None: """ Tests the conversion of the PyDough queries on the custom cryptbank dataset into relational plans. """ - file_path: str = get_plan_test_filename(cryptbank_pipeline_test_data.test_name) + file_path: str = get_plan_test_filename( + f"{cryptbank_pipeline_test_data.test_name}_{enable_mask_rewrites}" + ) cryptbank_pipeline_test_data.run_relational_test( masked_graphs, file_path, update_tests ) @@ -641,13 +644,15 @@ def test_pipeline_until_sql_cryptbank( sqlite_tpch_db_context: DatabaseContext, get_sql_test_filename: Callable[[str, DatabaseDialect], str], update_tests: bool, + enable_mask_rewrites: str, ): """ Tests the conversion of the PyDough queries on the custom cryptbank dataset into SQL text. """ file_path: str = get_sql_test_filename( - cryptbank_pipeline_test_data.test_name, sqlite_tpch_db_context.dialect + f"{cryptbank_pipeline_test_data.test_name}_{enable_mask_rewrites}", + sqlite_tpch_db_context.dialect, ) cryptbank_pipeline_test_data.run_sql_test( masked_graphs, @@ -657,14 +662,12 @@ def test_pipeline_until_sql_cryptbank( ) -# @pytest.mark.skip( -# reason="Skipping until masked table column relational handling is implemented" -# ) @pytest.mark.execute def test_pipeline_e2e_cryptbank( cryptbank_pipeline_test_data: PyDoughPandasTest, masked_graphs: graph_fetcher, sqlite_cryptbank_connection: DatabaseContext, + enable_mask_rewrites: str, ): """ Test executing the the custom queries with the custom cryptbank dataset diff --git a/tests/test_metadata/sf_masked_examples.json b/tests/test_metadata/sf_masked_examples.json index 07108b876..60c29c84d 100644 --- a/tests/test_metadata/sf_masked_examples.json +++ b/tests/test_metadata/sf_masked_examples.json @@ -1226,5 +1226,4 @@ } ] } - ] diff --git a/tests/test_plan_refsols/cryptbank_agg_01.txt b/tests/test_plan_refsols/cryptbank_agg_01.txt deleted file mode 100644 index 2f929a413..000000000 --- a/tests/test_plan_refsols/cryptbank_agg_01.txt +++ /dev/null @@ -1,4 +0,0 @@ -ROOT(columns=[('n', ROUND(avg_t_amount, 2:numeric))], orderings=[]) - AGGREGATE(keys={}, aggregations={'avg_t_amount': AVG(t_amount)}) - FILTER(condition=MONTH(t_ts) == 6:numeric & YEAR(t_ts) == 2022:numeric, columns={'t_amount': t_amount}) - SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_ts': t_ts}) diff --git a/tests/test_plan_refsols/cryptbank_agg_01_raw.txt b/tests/test_plan_refsols/cryptbank_agg_01_raw.txt new file mode 100644 index 000000000..1dad4af9a --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_agg_01_raw.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', ROUND(avg_unmask_t_amount, 2:numeric))], orderings=[]) + AGGREGATE(keys={}, aggregations={'avg_unmask_t_amount': AVG(UNMASK::((1025.67 - ([t_amount]))))}) + FILTER(condition=MONTH(UNMASK::(DATETIME([t_ts], '+54321 seconds'))) == 6:numeric & YEAR(UNMASK::(DATETIME([t_ts], '+54321 seconds'))) == 2022:numeric, columns={'t_amount': t_amount}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_ts': t_ts}) diff --git a/tests/test_plan_refsols/cryptbank_agg_01_rewrite.txt b/tests/test_plan_refsols/cryptbank_agg_01_rewrite.txt new file mode 100644 index 000000000..1dad4af9a --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_agg_01_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', ROUND(avg_unmask_t_amount, 2:numeric))], orderings=[]) + AGGREGATE(keys={}, aggregations={'avg_unmask_t_amount': AVG(UNMASK::((1025.67 - ([t_amount]))))}) + FILTER(condition=MONTH(UNMASK::(DATETIME([t_ts], '+54321 seconds'))) == 6:numeric & YEAR(UNMASK::(DATETIME([t_ts], '+54321 seconds'))) == 2022:numeric, columns={'t_amount': t_amount}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_ts': t_ts}) diff --git a/tests/test_plan_refsols/cryptbank_agg_02.txt b/tests/test_plan_refsols/cryptbank_agg_02.txt deleted file mode 100644 index 4a415dc0a..000000000 --- a/tests/test_plan_refsols/cryptbank_agg_02.txt +++ /dev/null @@ -1,3 +0,0 @@ -ROOT(columns=[('account_type', a_type), ('n', n_rows), ('avg_bal', ROUND(avg_a_balance, 2:numeric))], orderings=[]) - AGGREGATE(keys={'a_type': a_type}, aggregations={'avg_a_balance': AVG(a_balance), 'n_rows': COUNT()}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_balance': a_balance, 'a_type': a_type}) diff --git a/tests/test_plan_refsols/cryptbank_agg_02_raw.txt b/tests/test_plan_refsols/cryptbank_agg_02_raw.txt new file mode 100644 index 000000000..a64473209 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_agg_02_raw.txt @@ -0,0 +1,3 @@ +ROOT(columns=[('account_type', unmask_a_type), ('n', n_rows), ('avg_bal', ROUND(avg_unmask_a_balance, 2:numeric))], orderings=[]) + AGGREGATE(keys={'unmask_a_type': UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1))}, aggregations={'avg_unmask_a_balance': AVG(UNMASK::(SQRT([a_balance]))), 'n_rows': COUNT()}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_balance': a_balance, 'a_type': a_type}) diff --git a/tests/test_plan_refsols/cryptbank_agg_02_rewrite.txt b/tests/test_plan_refsols/cryptbank_agg_02_rewrite.txt new file mode 100644 index 000000000..a64473209 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_agg_02_rewrite.txt @@ -0,0 +1,3 @@ +ROOT(columns=[('account_type', unmask_a_type), ('n', n_rows), ('avg_bal', ROUND(avg_unmask_a_balance, 2:numeric))], orderings=[]) + AGGREGATE(keys={'unmask_a_type': UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1))}, aggregations={'avg_unmask_a_balance': AVG(UNMASK::(SQRT([a_balance]))), 'n_rows': COUNT()}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_balance': a_balance, 'a_type': a_type}) diff --git a/tests/test_plan_refsols/cryptbank_agg_03.txt b/tests/test_plan_refsols/cryptbank_agg_03.txt deleted file mode 100644 index 67301820a..000000000 --- a/tests/test_plan_refsols/cryptbank_agg_03.txt +++ /dev/null @@ -1,5 +0,0 @@ -ROOT(columns=[('account_type', a_type), ('balance', a_balance), ('name', JOIN_STRINGS(' ':string, c_fname, c_lname))], orderings=[]) - FILTER(condition=RANKING(args=[], partition=[a_type], order=[(a_balance):desc_first], allow_ties=False) == 1:numeric, columns={'a_balance': a_balance, 'a_type': a_type, 'c_fname': c_fname, 'c_lname': c_lname}) - JOIN(condition=t0.a_custkey == t1.c_key, type=INNER, cardinality=SINGULAR_ACCESS, columns={'a_balance': t0.a_balance, 'a_type': t0.a_type, 'c_fname': t1.c_fname, 'c_lname': t1.c_lname}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_balance': a_balance, 'a_custkey': a_custkey, 'a_type': a_type}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_agg_03_raw.txt b/tests/test_plan_refsols/cryptbank_agg_03_raw.txt new file mode 100644 index 000000000..f5c4c2b91 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_agg_03_raw.txt @@ -0,0 +1,5 @@ +ROOT(columns=[('account_type', UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1))), ('balance', UNMASK::(SQRT([a_balance]))), ('name', JOIN_STRINGS(' ':string, UNMASK::(LOWER([c_fname])), UNMASK::(LOWER([c_lname]))))], orderings=[]) + FILTER(condition=RANKING(args=[], partition=[UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1))], order=[(UNMASK::(SQRT([a_balance]))):desc_first], allow_ties=False) == 1:numeric, columns={'a_balance': a_balance, 'a_type': a_type, 'c_fname': c_fname, 'c_lname': c_lname}) + JOIN(condition=t0.a_custkey == UNMASK::((42 - ([t1.c_key]))), type=INNER, cardinality=SINGULAR_ACCESS, columns={'a_balance': t0.a_balance, 'a_type': t0.a_type, 'c_fname': t1.c_fname, 'c_lname': t1.c_lname}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_balance': a_balance, 'a_custkey': a_custkey, 'a_type': a_type}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_agg_03_rewrite.txt b/tests/test_plan_refsols/cryptbank_agg_03_rewrite.txt new file mode 100644 index 000000000..f5c4c2b91 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_agg_03_rewrite.txt @@ -0,0 +1,5 @@ +ROOT(columns=[('account_type', UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1))), ('balance', UNMASK::(SQRT([a_balance]))), ('name', JOIN_STRINGS(' ':string, UNMASK::(LOWER([c_fname])), UNMASK::(LOWER([c_lname]))))], orderings=[]) + FILTER(condition=RANKING(args=[], partition=[UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1))], order=[(UNMASK::(SQRT([a_balance]))):desc_first], allow_ties=False) == 1:numeric, columns={'a_balance': a_balance, 'a_type': a_type, 'c_fname': c_fname, 'c_lname': c_lname}) + JOIN(condition=t0.a_custkey == UNMASK::((42 - ([t1.c_key]))), type=INNER, cardinality=SINGULAR_ACCESS, columns={'a_balance': t0.a_balance, 'a_type': t0.a_type, 'c_fname': t1.c_fname, 'c_lname': t1.c_lname}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_balance': a_balance, 'a_custkey': a_custkey, 'a_type': a_type}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_agg_04.txt b/tests/test_plan_refsols/cryptbank_agg_04_raw.txt similarity index 51% rename from tests/test_plan_refsols/cryptbank_agg_04.txt rename to tests/test_plan_refsols/cryptbank_agg_04_raw.txt index f5a320c73..a9dde052e 100644 --- a/tests/test_plan_refsols/cryptbank_agg_04.txt +++ b/tests/test_plan_refsols/cryptbank_agg_04_raw.txt @@ -1,5 +1,5 @@ -ROOT(columns=[('branch_key', b_key), ('pct_total_wealth', ROUND(DEFAULT_TO(sum_a_balance, 0:numeric) / RELSUM(args=[DEFAULT_TO(sum_a_balance, 0:numeric)], partition=[], order=[]), 2:numeric))], orderings=[]) - JOIN(condition=t0.b_key == t1.a_branchkey, type=INNER, cardinality=SINGULAR_ACCESS, columns={'b_key': t0.b_key, 'sum_a_balance': t1.sum_a_balance}) +ROOT(columns=[('branch_key', b_key), ('pct_total_wealth', ROUND(DEFAULT_TO(sum_unmask_a_balance, 0:numeric) / RELSUM(args=[DEFAULT_TO(sum_unmask_a_balance, 0:numeric)], partition=[], order=[]), 2:numeric))], orderings=[]) + JOIN(condition=t0.b_key == t1.a_branchkey, type=INNER, cardinality=SINGULAR_ACCESS, columns={'b_key': t0.b_key, 'sum_unmask_a_balance': t1.sum_unmask_a_balance}) SCAN(table=CRBNK.BRANCHES, columns={'b_key': b_key}) - AGGREGATE(keys={'a_branchkey': a_branchkey}, aggregations={'sum_a_balance': SUM(a_balance)}) + AGGREGATE(keys={'a_branchkey': a_branchkey}, aggregations={'sum_unmask_a_balance': SUM(UNMASK::(SQRT([a_balance])))}) SCAN(table=CRBNK.ACCOUNTS, columns={'a_balance': a_balance, 'a_branchkey': a_branchkey}) diff --git a/tests/test_plan_refsols/cryptbank_agg_04_rewrite.txt b/tests/test_plan_refsols/cryptbank_agg_04_rewrite.txt new file mode 100644 index 000000000..a9dde052e --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_agg_04_rewrite.txt @@ -0,0 +1,5 @@ +ROOT(columns=[('branch_key', b_key), ('pct_total_wealth', ROUND(DEFAULT_TO(sum_unmask_a_balance, 0:numeric) / RELSUM(args=[DEFAULT_TO(sum_unmask_a_balance, 0:numeric)], partition=[], order=[]), 2:numeric))], orderings=[]) + JOIN(condition=t0.b_key == t1.a_branchkey, type=INNER, cardinality=SINGULAR_ACCESS, columns={'b_key': t0.b_key, 'sum_unmask_a_balance': t1.sum_unmask_a_balance}) + SCAN(table=CRBNK.BRANCHES, columns={'b_key': b_key}) + AGGREGATE(keys={'a_branchkey': a_branchkey}, aggregations={'sum_unmask_a_balance': SUM(UNMASK::(SQRT([a_balance])))}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_balance': a_balance, 'a_branchkey': a_branchkey}) diff --git a/tests/test_plan_refsols/cryptbank_agg_05.txt b/tests/test_plan_refsols/cryptbank_agg_05.txt deleted file mode 100644 index e798f7045..000000000 --- a/tests/test_plan_refsols/cryptbank_agg_05.txt +++ /dev/null @@ -1,6 +0,0 @@ -ROOT(columns=[('avg_secs', ROUND(avg_expr, 2:numeric))], orderings=[]) - AGGREGATE(keys={}, aggregations={'avg_expr': AVG(DATEDIFF('seconds':string, a_open_ts, min_t_ts))}) - JOIN(condition=t0.a_key == t1.t_sourceaccount, type=LEFT, cardinality=SINGULAR_FILTER, columns={'a_open_ts': t0.a_open_ts, 'min_t_ts': t1.min_t_ts}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_key': a_key, 'a_open_ts': a_open_ts}) - AGGREGATE(keys={'t_sourceaccount': t_sourceaccount}, aggregations={'min_t_ts': MIN(t_ts)}) - SCAN(table=CRBNK.TRANSACTIONS, columns={'t_sourceaccount': t_sourceaccount, 't_ts': t_ts}) diff --git a/tests/test_plan_refsols/cryptbank_agg_05_raw.txt b/tests/test_plan_refsols/cryptbank_agg_05_raw.txt new file mode 100644 index 000000000..94469a2f5 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_agg_05_raw.txt @@ -0,0 +1,6 @@ +ROOT(columns=[('avg_secs', ROUND(avg_expr, 2:numeric))], orderings=[]) + AGGREGATE(keys={}, aggregations={'avg_expr': AVG(DATEDIFF('seconds':string, UNMASK::(DATETIME([a_open_ts], '+123456789 seconds')), min_unmask_t_ts))}) + JOIN(condition=UNMASK::(CASE WHEN [t0.a_key] = 0 THEN 0 ELSE (CASE WHEN [t0.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t0.a_key], 1 + INSTR([t0.a_key], '-'), LENGTH([t0.a_key]) / 2) AS INTEGER) END) == t1.t_sourceaccount, type=LEFT, cardinality=SINGULAR_FILTER, columns={'a_open_ts': t0.a_open_ts, 'min_unmask_t_ts': t1.min_unmask_t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_key': a_key, 'a_open_ts': a_open_ts}) + AGGREGATE(keys={'t_sourceaccount': t_sourceaccount}, aggregations={'min_unmask_t_ts': MIN(UNMASK::(DATETIME([t_ts], '+54321 seconds')))}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_sourceaccount': t_sourceaccount, 't_ts': t_ts}) diff --git a/tests/test_plan_refsols/cryptbank_agg_05_rewrite.txt b/tests/test_plan_refsols/cryptbank_agg_05_rewrite.txt new file mode 100644 index 000000000..94469a2f5 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_agg_05_rewrite.txt @@ -0,0 +1,6 @@ +ROOT(columns=[('avg_secs', ROUND(avg_expr, 2:numeric))], orderings=[]) + AGGREGATE(keys={}, aggregations={'avg_expr': AVG(DATEDIFF('seconds':string, UNMASK::(DATETIME([a_open_ts], '+123456789 seconds')), min_unmask_t_ts))}) + JOIN(condition=UNMASK::(CASE WHEN [t0.a_key] = 0 THEN 0 ELSE (CASE WHEN [t0.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t0.a_key], 1 + INSTR([t0.a_key], '-'), LENGTH([t0.a_key]) / 2) AS INTEGER) END) == t1.t_sourceaccount, type=LEFT, cardinality=SINGULAR_FILTER, columns={'a_open_ts': t0.a_open_ts, 'min_unmask_t_ts': t1.min_unmask_t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_key': a_key, 'a_open_ts': a_open_ts}) + AGGREGATE(keys={'t_sourceaccount': t_sourceaccount}, aggregations={'min_unmask_t_ts': MIN(UNMASK::(DATETIME([t_ts], '+54321 seconds')))}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_sourceaccount': t_sourceaccount, 't_ts': t_ts}) diff --git a/tests/test_plan_refsols/cryptbank_analysis_01.txt b/tests/test_plan_refsols/cryptbank_analysis_01.txt deleted file mode 100644 index 89a258b57..000000000 --- a/tests/test_plan_refsols/cryptbank_analysis_01.txt +++ /dev/null @@ -1,13 +0,0 @@ -ROOT(columns=[('key', c_key), ('name', JOIN_STRINGS(' ':string, c_fname, c_lname)), ('first_sends', DEFAULT_TO(sum_t_amount, 0:numeric))], orderings=[(DEFAULT_TO(sum_t_amount, 0:numeric)):desc_last, (c_key):asc_first], limit=3:numeric) - JOIN(condition=t0.c_key == t1.a_custkey, type=LEFT, cardinality=SINGULAR_FILTER, columns={'c_fname': t0.c_fname, 'c_key': t0.c_key, 'c_lname': t0.c_lname, 'sum_t_amount': t1.sum_t_amount}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) - AGGREGATE(keys={'a_custkey': a_custkey}, aggregations={'sum_t_amount': SUM(t_amount)}) - FILTER(condition=RANKING(args=[], partition=[t_sourceaccount], order=[(t_ts):asc_last], allow_ties=False) == 1:numeric, columns={'a_custkey': a_custkey, 't_amount': t_amount}) - JOIN(condition=t0.t_destaccount == t1.a_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t0.t_amount, 't_sourceaccount': t0.t_sourceaccount, 't_ts': t0.t_ts}) - JOIN(condition=t0.a_key == t1.t_sourceaccount, type=INNER, cardinality=PLURAL_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t1.t_amount, 't_destaccount': t1.t_destaccount, 't_sourceaccount': t1.t_sourceaccount, 't_ts': t1.t_ts}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) - SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_destaccount': t_destaccount, 't_sourceaccount': t_sourceaccount, 't_ts': t_ts}) - JOIN(condition=t0.a_branchkey == t1.b_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_key': a_key}) - FILTER(condition=SLICE(b_addr, -5:numeric, None:unknown, None:unknown) == '94105':string, columns={'b_key': b_key}) - SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) diff --git a/tests/test_plan_refsols/cryptbank_analysis_01_raw.txt b/tests/test_plan_refsols/cryptbank_analysis_01_raw.txt new file mode 100644 index 000000000..4727e22b7 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_analysis_01_raw.txt @@ -0,0 +1,13 @@ +ROOT(columns=[('key', UNMASK::((42 - ([c_key])))), ('name', JOIN_STRINGS(' ':string, UNMASK::(LOWER([c_fname])), UNMASK::(LOWER([c_lname])))), ('first_sends', DEFAULT_TO(sum_unmask_t_amount, 0:numeric))], orderings=[(DEFAULT_TO(sum_unmask_t_amount, 0:numeric)):desc_last, (UNMASK::((42 - ([c_key])))):asc_first], limit=3:numeric) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey, type=LEFT, cardinality=SINGULAR_FILTER, columns={'c_fname': t0.c_fname, 'c_key': t0.c_key, 'c_lname': t0.c_lname, 'sum_unmask_t_amount': t1.sum_unmask_t_amount}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) + AGGREGATE(keys={'a_custkey': a_custkey}, aggregations={'sum_unmask_t_amount': SUM(UNMASK::((1025.67 - ([t_amount]))))}) + FILTER(condition=RANKING(args=[], partition=[t_sourceaccount], order=[(UNMASK::(DATETIME([t_ts], '+54321 seconds'))):asc_last], allow_ties=False) == 1:numeric, columns={'a_custkey': a_custkey, 't_amount': t_amount}) + JOIN(condition=t0.t_destaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t0.t_amount, 't_sourceaccount': t0.t_sourceaccount, 't_ts': t0.t_ts}) + JOIN(condition=UNMASK::(CASE WHEN [t0.a_key] = 0 THEN 0 ELSE (CASE WHEN [t0.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t0.a_key], 1 + INSTR([t0.a_key], '-'), LENGTH([t0.a_key]) / 2) AS INTEGER) END) == t1.t_sourceaccount, type=INNER, cardinality=PLURAL_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t1.t_amount, 't_destaccount': t1.t_destaccount, 't_sourceaccount': t1.t_sourceaccount, 't_ts': t1.t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_destaccount': t_destaccount, 't_sourceaccount': t_sourceaccount, 't_ts': t_ts}) + JOIN(condition=t0.a_branchkey == t1.b_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_key': a_key}) + FILTER(condition=SLICE(b_addr, -5:numeric, None:unknown, None:unknown) == '94105':string, columns={'b_key': b_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) diff --git a/tests/test_plan_refsols/cryptbank_analysis_01_rewrite.txt b/tests/test_plan_refsols/cryptbank_analysis_01_rewrite.txt new file mode 100644 index 000000000..4727e22b7 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_analysis_01_rewrite.txt @@ -0,0 +1,13 @@ +ROOT(columns=[('key', UNMASK::((42 - ([c_key])))), ('name', JOIN_STRINGS(' ':string, UNMASK::(LOWER([c_fname])), UNMASK::(LOWER([c_lname])))), ('first_sends', DEFAULT_TO(sum_unmask_t_amount, 0:numeric))], orderings=[(DEFAULT_TO(sum_unmask_t_amount, 0:numeric)):desc_last, (UNMASK::((42 - ([c_key])))):asc_first], limit=3:numeric) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey, type=LEFT, cardinality=SINGULAR_FILTER, columns={'c_fname': t0.c_fname, 'c_key': t0.c_key, 'c_lname': t0.c_lname, 'sum_unmask_t_amount': t1.sum_unmask_t_amount}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) + AGGREGATE(keys={'a_custkey': a_custkey}, aggregations={'sum_unmask_t_amount': SUM(UNMASK::((1025.67 - ([t_amount]))))}) + FILTER(condition=RANKING(args=[], partition=[t_sourceaccount], order=[(UNMASK::(DATETIME([t_ts], '+54321 seconds'))):asc_last], allow_ties=False) == 1:numeric, columns={'a_custkey': a_custkey, 't_amount': t_amount}) + JOIN(condition=t0.t_destaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t0.t_amount, 't_sourceaccount': t0.t_sourceaccount, 't_ts': t0.t_ts}) + JOIN(condition=UNMASK::(CASE WHEN [t0.a_key] = 0 THEN 0 ELSE (CASE WHEN [t0.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t0.a_key], 1 + INSTR([t0.a_key], '-'), LENGTH([t0.a_key]) / 2) AS INTEGER) END) == t1.t_sourceaccount, type=INNER, cardinality=PLURAL_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t1.t_amount, 't_destaccount': t1.t_destaccount, 't_sourceaccount': t1.t_sourceaccount, 't_ts': t1.t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_destaccount': t_destaccount, 't_sourceaccount': t_sourceaccount, 't_ts': t_ts}) + JOIN(condition=t0.a_branchkey == t1.b_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_key': a_key}) + FILTER(condition=SLICE(b_addr, -5:numeric, None:unknown, None:unknown) == '94105':string, columns={'b_key': b_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) diff --git a/tests/test_plan_refsols/cryptbank_analysis_02.txt b/tests/test_plan_refsols/cryptbank_analysis_02.txt deleted file mode 100644 index 302d8f79e..000000000 --- a/tests/test_plan_refsols/cryptbank_analysis_02.txt +++ /dev/null @@ -1,13 +0,0 @@ -ROOT(columns=[('key', c_key), ('name', JOIN_STRINGS(' ':string, c_fname, c_lname)), ('first_recvs', DEFAULT_TO(sum_t_amount, 0:numeric))], orderings=[(DEFAULT_TO(sum_t_amount, 0:numeric)):desc_last, (c_key):asc_first], limit=3:numeric) - JOIN(condition=t0.c_key == t1.a_custkey, type=LEFT, cardinality=SINGULAR_FILTER, columns={'c_fname': t0.c_fname, 'c_key': t0.c_key, 'c_lname': t0.c_lname, 'sum_t_amount': t1.sum_t_amount}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) - AGGREGATE(keys={'a_custkey': a_custkey}, aggregations={'sum_t_amount': SUM(t_amount)}) - FILTER(condition=RANKING(args=[], partition=[t_destaccount], order=[(t_ts):asc_last], allow_ties=False) == 1:numeric, columns={'a_custkey': a_custkey, 't_amount': t_amount}) - JOIN(condition=t0.t_sourceaccount == t1.a_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t0.t_amount, 't_destaccount': t0.t_destaccount, 't_ts': t0.t_ts}) - JOIN(condition=t0.a_key == t1.t_destaccount, type=INNER, cardinality=PLURAL_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t1.t_amount, 't_destaccount': t1.t_destaccount, 't_sourceaccount': t1.t_sourceaccount, 't_ts': t1.t_ts}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) - SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_destaccount': t_destaccount, 't_sourceaccount': t_sourceaccount, 't_ts': t_ts}) - JOIN(condition=t0.a_branchkey == t1.b_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_key': a_key}) - FILTER(condition=SLICE(b_addr, -5:numeric, None:unknown, None:unknown) == '94105':string, columns={'b_key': b_key}) - SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) diff --git a/tests/test_plan_refsols/cryptbank_analysis_02_raw.txt b/tests/test_plan_refsols/cryptbank_analysis_02_raw.txt new file mode 100644 index 000000000..f48c754b1 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_analysis_02_raw.txt @@ -0,0 +1,13 @@ +ROOT(columns=[('key', UNMASK::((42 - ([c_key])))), ('name', JOIN_STRINGS(' ':string, UNMASK::(LOWER([c_fname])), UNMASK::(LOWER([c_lname])))), ('first_recvs', DEFAULT_TO(sum_unmask_t_amount, 0:numeric))], orderings=[(DEFAULT_TO(sum_unmask_t_amount, 0:numeric)):desc_last, (UNMASK::((42 - ([c_key])))):asc_first], limit=3:numeric) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey, type=LEFT, cardinality=SINGULAR_FILTER, columns={'c_fname': t0.c_fname, 'c_key': t0.c_key, 'c_lname': t0.c_lname, 'sum_unmask_t_amount': t1.sum_unmask_t_amount}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) + AGGREGATE(keys={'a_custkey': a_custkey}, aggregations={'sum_unmask_t_amount': SUM(UNMASK::((1025.67 - ([t_amount]))))}) + FILTER(condition=RANKING(args=[], partition=[t_destaccount], order=[(UNMASK::(DATETIME([t_ts], '+54321 seconds'))):asc_last], allow_ties=False) == 1:numeric, columns={'a_custkey': a_custkey, 't_amount': t_amount}) + JOIN(condition=t0.t_sourceaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t0.t_amount, 't_destaccount': t0.t_destaccount, 't_ts': t0.t_ts}) + JOIN(condition=UNMASK::(CASE WHEN [t0.a_key] = 0 THEN 0 ELSE (CASE WHEN [t0.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t0.a_key], 1 + INSTR([t0.a_key], '-'), LENGTH([t0.a_key]) / 2) AS INTEGER) END) == t1.t_destaccount, type=INNER, cardinality=PLURAL_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t1.t_amount, 't_destaccount': t1.t_destaccount, 't_sourceaccount': t1.t_sourceaccount, 't_ts': t1.t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_destaccount': t_destaccount, 't_sourceaccount': t_sourceaccount, 't_ts': t_ts}) + JOIN(condition=t0.a_branchkey == t1.b_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_key': a_key}) + FILTER(condition=SLICE(b_addr, -5:numeric, None:unknown, None:unknown) == '94105':string, columns={'b_key': b_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) diff --git a/tests/test_plan_refsols/cryptbank_analysis_02_rewrite.txt b/tests/test_plan_refsols/cryptbank_analysis_02_rewrite.txt new file mode 100644 index 000000000..f48c754b1 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_analysis_02_rewrite.txt @@ -0,0 +1,13 @@ +ROOT(columns=[('key', UNMASK::((42 - ([c_key])))), ('name', JOIN_STRINGS(' ':string, UNMASK::(LOWER([c_fname])), UNMASK::(LOWER([c_lname])))), ('first_recvs', DEFAULT_TO(sum_unmask_t_amount, 0:numeric))], orderings=[(DEFAULT_TO(sum_unmask_t_amount, 0:numeric)):desc_last, (UNMASK::((42 - ([c_key])))):asc_first], limit=3:numeric) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey, type=LEFT, cardinality=SINGULAR_FILTER, columns={'c_fname': t0.c_fname, 'c_key': t0.c_key, 'c_lname': t0.c_lname, 'sum_unmask_t_amount': t1.sum_unmask_t_amount}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) + AGGREGATE(keys={'a_custkey': a_custkey}, aggregations={'sum_unmask_t_amount': SUM(UNMASK::((1025.67 - ([t_amount]))))}) + FILTER(condition=RANKING(args=[], partition=[t_destaccount], order=[(UNMASK::(DATETIME([t_ts], '+54321 seconds'))):asc_last], allow_ties=False) == 1:numeric, columns={'a_custkey': a_custkey, 't_amount': t_amount}) + JOIN(condition=t0.t_sourceaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t0.t_amount, 't_destaccount': t0.t_destaccount, 't_ts': t0.t_ts}) + JOIN(condition=UNMASK::(CASE WHEN [t0.a_key] = 0 THEN 0 ELSE (CASE WHEN [t0.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t0.a_key], 1 + INSTR([t0.a_key], '-'), LENGTH([t0.a_key]) / 2) AS INTEGER) END) == t1.t_destaccount, type=INNER, cardinality=PLURAL_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t1.t_amount, 't_destaccount': t1.t_destaccount, 't_sourceaccount': t1.t_sourceaccount, 't_ts': t1.t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_destaccount': t_destaccount, 't_sourceaccount': t_sourceaccount, 't_ts': t_ts}) + JOIN(condition=t0.a_branchkey == t1.b_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_key': a_key}) + FILTER(condition=SLICE(b_addr, -5:numeric, None:unknown, None:unknown) == '94105':string, columns={'b_key': b_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) diff --git a/tests/test_plan_refsols/cryptbank_analysis_03.txt b/tests/test_plan_refsols/cryptbank_analysis_03.txt deleted file mode 100644 index d476b74a0..000000000 --- a/tests/test_plan_refsols/cryptbank_analysis_03.txt +++ /dev/null @@ -1,24 +0,0 @@ -ROOT(columns=[('key', c_key), ('name', JOIN_STRINGS(' ':string, c_fname, c_lname)), ('first_sends', DEFAULT_TO(agg_1, 0:numeric)), ('first_recvs', DEFAULT_TO(sum_t_amount, 0:numeric))], orderings=[(DEFAULT_TO(agg_1, 0:numeric) + DEFAULT_TO(sum_t_amount, 0:numeric)):desc_last, (c_key):asc_first], limit=3:numeric) - JOIN(condition=t0.c_key == t1.a_custkey, type=LEFT, cardinality=SINGULAR_FILTER, columns={'agg_1': t0.sum_t_amount, 'c_fname': t0.c_fname, 'c_key': t0.c_key, 'c_lname': t0.c_lname, 'sum_t_amount': t1.sum_t_amount}) - JOIN(condition=t0.c_key == t1.a_custkey, type=LEFT, cardinality=SINGULAR_FILTER, columns={'c_fname': t0.c_fname, 'c_key': t0.c_key, 'c_lname': t0.c_lname, 'sum_t_amount': t1.sum_t_amount}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) - AGGREGATE(keys={'a_custkey': a_custkey}, aggregations={'sum_t_amount': SUM(t_amount)}) - FILTER(condition=RANKING(args=[], partition=[t_sourceaccount], order=[(t_ts):asc_last], allow_ties=False) == 1:numeric, columns={'a_custkey': a_custkey, 't_amount': t_amount}) - JOIN(condition=t0.t_destaccount == t1.a_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t0.t_amount, 't_sourceaccount': t0.t_sourceaccount, 't_ts': t0.t_ts}) - JOIN(condition=t0.a_key == t1.t_sourceaccount, type=INNER, cardinality=PLURAL_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t1.t_amount, 't_destaccount': t1.t_destaccount, 't_sourceaccount': t1.t_sourceaccount, 't_ts': t1.t_ts}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) - SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_destaccount': t_destaccount, 't_sourceaccount': t_sourceaccount, 't_ts': t_ts}) - JOIN(condition=t0.a_branchkey == t1.b_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_key': a_key}) - FILTER(condition=SLICE(b_addr, -5:numeric, None:unknown, None:unknown) == '94105':string, columns={'b_key': b_key}) - SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) - AGGREGATE(keys={'a_custkey': a_custkey}, aggregations={'sum_t_amount': SUM(t_amount)}) - FILTER(condition=RANKING(args=[], partition=[t_destaccount], order=[(t_ts):asc_last], allow_ties=False) == 1:numeric, columns={'a_custkey': a_custkey, 't_amount': t_amount}) - JOIN(condition=t0.t_sourceaccount == t1.a_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t0.t_amount, 't_destaccount': t0.t_destaccount, 't_ts': t0.t_ts}) - JOIN(condition=t0.a_key == t1.t_destaccount, type=INNER, cardinality=PLURAL_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t1.t_amount, 't_destaccount': t1.t_destaccount, 't_sourceaccount': t1.t_sourceaccount, 't_ts': t1.t_ts}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) - SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_destaccount': t_destaccount, 't_sourceaccount': t_sourceaccount, 't_ts': t_ts}) - JOIN(condition=t0.a_branchkey == t1.b_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_key': a_key}) - FILTER(condition=SLICE(b_addr, -5:numeric, None:unknown, None:unknown) == '94105':string, columns={'b_key': b_key}) - SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) diff --git a/tests/test_plan_refsols/cryptbank_analysis_03_raw.txt b/tests/test_plan_refsols/cryptbank_analysis_03_raw.txt new file mode 100644 index 000000000..706e0e7cd --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_analysis_03_raw.txt @@ -0,0 +1,24 @@ +ROOT(columns=[('key', UNMASK::((42 - ([c_key])))), ('name', JOIN_STRINGS(' ':string, UNMASK::(LOWER([c_fname])), UNMASK::(LOWER([c_lname])))), ('first_sends', DEFAULT_TO(agg_1, 0:numeric)), ('first_recvs', DEFAULT_TO(sum_unmask_t_amount, 0:numeric))], orderings=[(DEFAULT_TO(agg_1, 0:numeric) + DEFAULT_TO(sum_unmask_t_amount, 0:numeric)):desc_last, (UNMASK::((42 - ([c_key])))):asc_first], limit=3:numeric) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey, type=LEFT, cardinality=SINGULAR_FILTER, columns={'agg_1': t0.sum_unmask_t_amount, 'c_fname': t0.c_fname, 'c_key': t0.c_key, 'c_lname': t0.c_lname, 'sum_unmask_t_amount': t1.sum_unmask_t_amount}) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey, type=LEFT, cardinality=SINGULAR_FILTER, columns={'c_fname': t0.c_fname, 'c_key': t0.c_key, 'c_lname': t0.c_lname, 'sum_unmask_t_amount': t1.sum_unmask_t_amount}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) + AGGREGATE(keys={'a_custkey': a_custkey}, aggregations={'sum_unmask_t_amount': SUM(UNMASK::((1025.67 - ([t_amount]))))}) + FILTER(condition=RANKING(args=[], partition=[t_sourceaccount], order=[(UNMASK::(DATETIME([t_ts], '+54321 seconds'))):asc_last], allow_ties=False) == 1:numeric, columns={'a_custkey': a_custkey, 't_amount': t_amount}) + JOIN(condition=t0.t_destaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t0.t_amount, 't_sourceaccount': t0.t_sourceaccount, 't_ts': t0.t_ts}) + JOIN(condition=UNMASK::(CASE WHEN [t0.a_key] = 0 THEN 0 ELSE (CASE WHEN [t0.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t0.a_key], 1 + INSTR([t0.a_key], '-'), LENGTH([t0.a_key]) / 2) AS INTEGER) END) == t1.t_sourceaccount, type=INNER, cardinality=PLURAL_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t1.t_amount, 't_destaccount': t1.t_destaccount, 't_sourceaccount': t1.t_sourceaccount, 't_ts': t1.t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_destaccount': t_destaccount, 't_sourceaccount': t_sourceaccount, 't_ts': t_ts}) + JOIN(condition=t0.a_branchkey == t1.b_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_key': a_key}) + FILTER(condition=SLICE(b_addr, -5:numeric, None:unknown, None:unknown) == '94105':string, columns={'b_key': b_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) + AGGREGATE(keys={'a_custkey': a_custkey}, aggregations={'sum_unmask_t_amount': SUM(UNMASK::((1025.67 - ([t_amount]))))}) + FILTER(condition=RANKING(args=[], partition=[t_destaccount], order=[(UNMASK::(DATETIME([t_ts], '+54321 seconds'))):asc_last], allow_ties=False) == 1:numeric, columns={'a_custkey': a_custkey, 't_amount': t_amount}) + JOIN(condition=t0.t_sourceaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t0.t_amount, 't_destaccount': t0.t_destaccount, 't_ts': t0.t_ts}) + JOIN(condition=UNMASK::(CASE WHEN [t0.a_key] = 0 THEN 0 ELSE (CASE WHEN [t0.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t0.a_key], 1 + INSTR([t0.a_key], '-'), LENGTH([t0.a_key]) / 2) AS INTEGER) END) == t1.t_destaccount, type=INNER, cardinality=PLURAL_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t1.t_amount, 't_destaccount': t1.t_destaccount, 't_sourceaccount': t1.t_sourceaccount, 't_ts': t1.t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_destaccount': t_destaccount, 't_sourceaccount': t_sourceaccount, 't_ts': t_ts}) + JOIN(condition=t0.a_branchkey == t1.b_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_key': a_key}) + FILTER(condition=SLICE(b_addr, -5:numeric, None:unknown, None:unknown) == '94105':string, columns={'b_key': b_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) diff --git a/tests/test_plan_refsols/cryptbank_analysis_03_rewrite.txt b/tests/test_plan_refsols/cryptbank_analysis_03_rewrite.txt new file mode 100644 index 000000000..706e0e7cd --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_analysis_03_rewrite.txt @@ -0,0 +1,24 @@ +ROOT(columns=[('key', UNMASK::((42 - ([c_key])))), ('name', JOIN_STRINGS(' ':string, UNMASK::(LOWER([c_fname])), UNMASK::(LOWER([c_lname])))), ('first_sends', DEFAULT_TO(agg_1, 0:numeric)), ('first_recvs', DEFAULT_TO(sum_unmask_t_amount, 0:numeric))], orderings=[(DEFAULT_TO(agg_1, 0:numeric) + DEFAULT_TO(sum_unmask_t_amount, 0:numeric)):desc_last, (UNMASK::((42 - ([c_key])))):asc_first], limit=3:numeric) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey, type=LEFT, cardinality=SINGULAR_FILTER, columns={'agg_1': t0.sum_unmask_t_amount, 'c_fname': t0.c_fname, 'c_key': t0.c_key, 'c_lname': t0.c_lname, 'sum_unmask_t_amount': t1.sum_unmask_t_amount}) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey, type=LEFT, cardinality=SINGULAR_FILTER, columns={'c_fname': t0.c_fname, 'c_key': t0.c_key, 'c_lname': t0.c_lname, 'sum_unmask_t_amount': t1.sum_unmask_t_amount}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) + AGGREGATE(keys={'a_custkey': a_custkey}, aggregations={'sum_unmask_t_amount': SUM(UNMASK::((1025.67 - ([t_amount]))))}) + FILTER(condition=RANKING(args=[], partition=[t_sourceaccount], order=[(UNMASK::(DATETIME([t_ts], '+54321 seconds'))):asc_last], allow_ties=False) == 1:numeric, columns={'a_custkey': a_custkey, 't_amount': t_amount}) + JOIN(condition=t0.t_destaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t0.t_amount, 't_sourceaccount': t0.t_sourceaccount, 't_ts': t0.t_ts}) + JOIN(condition=UNMASK::(CASE WHEN [t0.a_key] = 0 THEN 0 ELSE (CASE WHEN [t0.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t0.a_key], 1 + INSTR([t0.a_key], '-'), LENGTH([t0.a_key]) / 2) AS INTEGER) END) == t1.t_sourceaccount, type=INNER, cardinality=PLURAL_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t1.t_amount, 't_destaccount': t1.t_destaccount, 't_sourceaccount': t1.t_sourceaccount, 't_ts': t1.t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_destaccount': t_destaccount, 't_sourceaccount': t_sourceaccount, 't_ts': t_ts}) + JOIN(condition=t0.a_branchkey == t1.b_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_key': a_key}) + FILTER(condition=SLICE(b_addr, -5:numeric, None:unknown, None:unknown) == '94105':string, columns={'b_key': b_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) + AGGREGATE(keys={'a_custkey': a_custkey}, aggregations={'sum_unmask_t_amount': SUM(UNMASK::((1025.67 - ([t_amount]))))}) + FILTER(condition=RANKING(args=[], partition=[t_destaccount], order=[(UNMASK::(DATETIME([t_ts], '+54321 seconds'))):asc_last], allow_ties=False) == 1:numeric, columns={'a_custkey': a_custkey, 't_amount': t_amount}) + JOIN(condition=t0.t_sourceaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t0.t_amount, 't_destaccount': t0.t_destaccount, 't_ts': t0.t_ts}) + JOIN(condition=UNMASK::(CASE WHEN [t0.a_key] = 0 THEN 0 ELSE (CASE WHEN [t0.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t0.a_key], 1 + INSTR([t0.a_key], '-'), LENGTH([t0.a_key]) / 2) AS INTEGER) END) == t1.t_destaccount, type=INNER, cardinality=PLURAL_FILTER, columns={'a_custkey': t0.a_custkey, 't_amount': t1.t_amount, 't_destaccount': t1.t_destaccount, 't_sourceaccount': t1.t_sourceaccount, 't_ts': t1.t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_destaccount': t_destaccount, 't_sourceaccount': t_sourceaccount, 't_ts': t_ts}) + JOIN(condition=t0.a_branchkey == t1.b_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_key': a_key}) + FILTER(condition=SLICE(b_addr, -5:numeric, None:unknown, None:unknown) == '94105':string, columns={'b_key': b_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) diff --git a/tests/test_plan_refsols/cryptbank_analysis_04.txt b/tests/test_plan_refsols/cryptbank_analysis_04.txt deleted file mode 100644 index b5c240f4b..000000000 --- a/tests/test_plan_refsols/cryptbank_analysis_04.txt +++ /dev/null @@ -1,9 +0,0 @@ -ROOT(columns=[('key', a_key), ('cust_name', JOIN_STRINGS(' ':string, c_fname, c_lname)), ('n_trans', n_rows)], orderings=[(a_key):asc_first]) - JOIN(condition=t0.a_key == t1.t_sourceaccount, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key, 'c_fname': t0.c_fname, 'c_lname': t0.c_lname, 'n_rows': t1.n_rows}) - JOIN(condition=t0.a_custkey == t1.c_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key, 'c_fname': t1.c_fname, 'c_lname': t1.c_lname}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) - FILTER(condition=MONOTONIC(1980:numeric, YEAR(c_birthday), 1985:numeric), columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday, 'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) - AGGREGATE(keys={'t_sourceaccount': t_sourceaccount}, aggregations={'n_rows': COUNT()}) - FILTER(condition=t_amount > 9000.0:numeric, columns={'t_sourceaccount': t_sourceaccount}) - SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_sourceaccount': t_sourceaccount}) diff --git a/tests/test_plan_refsols/cryptbank_analysis_04_raw.txt b/tests/test_plan_refsols/cryptbank_analysis_04_raw.txt new file mode 100644 index 000000000..f50eaf23c --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_analysis_04_raw.txt @@ -0,0 +1,9 @@ +ROOT(columns=[('key', UNMASK::(CASE WHEN [a_key] = 0 THEN 0 ELSE (CASE WHEN [a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([a_key], 1 + INSTR([a_key], '-'), LENGTH([a_key]) / 2) AS INTEGER) END)), ('cust_name', JOIN_STRINGS(' ':string, UNMASK::(LOWER([c_fname])), UNMASK::(LOWER([c_lname])))), ('n_trans', n_rows)], orderings=[(UNMASK::(CASE WHEN [a_key] = 0 THEN 0 ELSE (CASE WHEN [a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([a_key], 1 + INSTR([a_key], '-'), LENGTH([a_key]) / 2) AS INTEGER) END)):asc_first]) + JOIN(condition=UNMASK::(CASE WHEN [t0.a_key] = 0 THEN 0 ELSE (CASE WHEN [t0.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t0.a_key], 1 + INSTR([t0.a_key], '-'), LENGTH([t0.a_key]) / 2) AS INTEGER) END) == t1.t_sourceaccount, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key, 'c_fname': t0.c_fname, 'c_lname': t0.c_lname, 'n_rows': t1.n_rows}) + JOIN(condition=t0.a_custkey == UNMASK::((42 - ([t1.c_key]))), type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key, 'c_fname': t1.c_fname, 'c_lname': t1.c_lname}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) + FILTER(condition=MONOTONIC(1980:numeric, YEAR(UNMASK::(DATE([c_birthday], '+472 days'))), 1985:numeric), columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday, 'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) + AGGREGATE(keys={'t_sourceaccount': t_sourceaccount}, aggregations={'n_rows': COUNT()}) + FILTER(condition=UNMASK::((1025.67 - ([t_amount]))) > 9000.0:numeric, columns={'t_sourceaccount': t_sourceaccount}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_sourceaccount': t_sourceaccount}) diff --git a/tests/test_plan_refsols/cryptbank_analysis_04_rewrite.txt b/tests/test_plan_refsols/cryptbank_analysis_04_rewrite.txt new file mode 100644 index 000000000..f50eaf23c --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_analysis_04_rewrite.txt @@ -0,0 +1,9 @@ +ROOT(columns=[('key', UNMASK::(CASE WHEN [a_key] = 0 THEN 0 ELSE (CASE WHEN [a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([a_key], 1 + INSTR([a_key], '-'), LENGTH([a_key]) / 2) AS INTEGER) END)), ('cust_name', JOIN_STRINGS(' ':string, UNMASK::(LOWER([c_fname])), UNMASK::(LOWER([c_lname])))), ('n_trans', n_rows)], orderings=[(UNMASK::(CASE WHEN [a_key] = 0 THEN 0 ELSE (CASE WHEN [a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([a_key], 1 + INSTR([a_key], '-'), LENGTH([a_key]) / 2) AS INTEGER) END)):asc_first]) + JOIN(condition=UNMASK::(CASE WHEN [t0.a_key] = 0 THEN 0 ELSE (CASE WHEN [t0.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t0.a_key], 1 + INSTR([t0.a_key], '-'), LENGTH([t0.a_key]) / 2) AS INTEGER) END) == t1.t_sourceaccount, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key, 'c_fname': t0.c_fname, 'c_lname': t0.c_lname, 'n_rows': t1.n_rows}) + JOIN(condition=t0.a_custkey == UNMASK::((42 - ([t1.c_key]))), type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key, 'c_fname': t1.c_fname, 'c_lname': t1.c_lname}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) + FILTER(condition=MONOTONIC(1980:numeric, YEAR(UNMASK::(DATE([c_birthday], '+472 days'))), 1985:numeric), columns={'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday, 'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname}) + AGGREGATE(keys={'t_sourceaccount': t_sourceaccount}, aggregations={'n_rows': COUNT()}) + FILTER(condition=UNMASK::((1025.67 - ([t_amount]))) > 9000.0:numeric, columns={'t_sourceaccount': t_sourceaccount}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount, 't_sourceaccount': t_sourceaccount}) diff --git a/tests/test_plan_refsols/cryptbank_basic_scan_topk.txt b/tests/test_plan_refsols/cryptbank_basic_scan_topk.txt deleted file mode 100644 index 3ec0cacb8..000000000 --- a/tests/test_plan_refsols/cryptbank_basic_scan_topk.txt +++ /dev/null @@ -1,2 +0,0 @@ -ROOT(columns=[('key', c_key), ('first_name', c_fname), ('last_name', c_lname), ('phone_number', c_phone), ('email', c_email), ('address', c_addr), ('birthday', c_birthday)], orderings=[(c_key):asc_first], limit=3:numeric) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_birthday': c_birthday, 'c_email': c_email, 'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname, 'c_phone': c_phone}) diff --git a/tests/test_plan_refsols/cryptbank_basic_scan_topk_raw.txt b/tests/test_plan_refsols/cryptbank_basic_scan_topk_raw.txt new file mode 100644 index 000000000..907a10b60 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_basic_scan_topk_raw.txt @@ -0,0 +1,2 @@ +ROOT(columns=[('key', UNMASK::((42 - ([c_key])))), ('first_name', UNMASK::(LOWER([c_fname]))), ('last_name', UNMASK::(LOWER([c_lname]))), ('phone_number', UNMASK::(REPLACE(REPLACE(REPLACE([c_phone], '9', '*'), '0', '9'), '*', '0'))), ('email', UNMASK::(SUBSTRING([c_email], -1) || SUBSTRING([c_email], 1, LENGTH([c_email]) - 1))), ('address', UNMASK::(SUBSTRING([c_addr], -1) || SUBSTRING([c_addr], 1, LENGTH([c_addr]) - 1))), ('birthday', UNMASK::(DATE([c_birthday], '+472 days')))], orderings=[(UNMASK::((42 - ([c_key])))):asc_first], limit=3:numeric) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_birthday': c_birthday, 'c_email': c_email, 'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname, 'c_phone': c_phone}) diff --git a/tests/test_plan_refsols/cryptbank_basic_scan_topk_rewrite.txt b/tests/test_plan_refsols/cryptbank_basic_scan_topk_rewrite.txt new file mode 100644 index 000000000..907a10b60 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_basic_scan_topk_rewrite.txt @@ -0,0 +1,2 @@ +ROOT(columns=[('key', UNMASK::((42 - ([c_key])))), ('first_name', UNMASK::(LOWER([c_fname]))), ('last_name', UNMASK::(LOWER([c_lname]))), ('phone_number', UNMASK::(REPLACE(REPLACE(REPLACE([c_phone], '9', '*'), '0', '9'), '*', '0'))), ('email', UNMASK::(SUBSTRING([c_email], -1) || SUBSTRING([c_email], 1, LENGTH([c_email]) - 1))), ('address', UNMASK::(SUBSTRING([c_addr], -1) || SUBSTRING([c_addr], 1, LENGTH([c_addr]) - 1))), ('birthday', UNMASK::(DATE([c_birthday], '+472 days')))], orderings=[(UNMASK::((42 - ([c_key])))):asc_first], limit=3:numeric) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_birthday': c_birthday, 'c_email': c_email, 'c_fname': c_fname, 'c_key': c_key, 'c_lname': c_lname, 'c_phone': c_phone}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_01.txt b/tests/test_plan_refsols/cryptbank_filter_count_01_raw.txt similarity index 67% rename from tests/test_plan_refsols/cryptbank_filter_count_01.txt rename to tests/test_plan_refsols/cryptbank_filter_count_01_raw.txt index 231df5c1d..4f1b912cb 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_01.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_01_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=c_lname == 'lee':string, columns={}) + FILTER(condition=UNMASK::(LOWER([c_lname])) == 'lee':string, columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_02.txt b/tests/test_plan_refsols/cryptbank_filter_count_01_rewrite.txt similarity index 67% rename from tests/test_plan_refsols/cryptbank_filter_count_02.txt rename to tests/test_plan_refsols/cryptbank_filter_count_01_rewrite.txt index d18a98d6d..4f1b912cb 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_02.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_01_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=c_lname != 'lee':string, columns={}) + FILTER(condition=UNMASK::(LOWER([c_lname])) == 'lee':string, columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_03.txt b/tests/test_plan_refsols/cryptbank_filter_count_02_raw.txt similarity index 63% rename from tests/test_plan_refsols/cryptbank_filter_count_03.txt rename to tests/test_plan_refsols/cryptbank_filter_count_02_raw.txt index 53ac27d79..411ff99fe 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_03.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_02_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ISIN(c_lname, ['lee', 'smith', 'rodriguez']:array[unknown]), columns={}) + FILTER(condition=UNMASK::(LOWER([c_lname])) != 'lee':string, columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_04.txt b/tests/test_plan_refsols/cryptbank_filter_count_02_rewrite.txt similarity index 62% rename from tests/test_plan_refsols/cryptbank_filter_count_04.txt rename to tests/test_plan_refsols/cryptbank_filter_count_02_rewrite.txt index 023233da0..411ff99fe 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_04.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_02_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=NOT(ISIN(c_lname, ['lee', 'smith', 'rodriguez']:array[unknown])), columns={}) + FILTER(condition=UNMASK::(LOWER([c_lname])) != 'lee':string, columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_03_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_03_raw.txt new file mode 100644 index 000000000..f881e5028 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_03_raw.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=ISIN(UNMASK::(LOWER([c_lname])), ['lee', 'smith', 'rodriguez']:array[unknown]), columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_03_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_03_rewrite.txt new file mode 100644 index 000000000..f881e5028 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_03_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=ISIN(UNMASK::(LOWER([c_lname])), ['lee', 'smith', 'rodriguez']:array[unknown]), columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_04_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_04_raw.txt new file mode 100644 index 000000000..afcecfd28 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_04_raw.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=NOT(ISIN(UNMASK::(LOWER([c_lname])), ['lee', 'smith', 'rodriguez']:array[unknown])), columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_04_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_04_rewrite.txt new file mode 100644 index 000000000..afcecfd28 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_04_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=NOT(ISIN(UNMASK::(LOWER([c_lname])), ['lee', 'smith', 'rodriguez']:array[unknown])), columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_05_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_05_raw.txt new file mode 100644 index 000000000..80d0ffef1 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_05_raw.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=STARTSWITH(UNMASK::(REPLACE(REPLACE(REPLACE([c_phone], '9', '*'), '0', '9'), '*', '0')), '555-8':string), columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_phone': c_phone}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_05_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_05_rewrite.txt new file mode 100644 index 000000000..80d0ffef1 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_05_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=STARTSWITH(UNMASK::(REPLACE(REPLACE(REPLACE([c_phone], '9', '*'), '0', '9'), '*', '0')), '555-8':string), columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_phone': c_phone}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_06_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_06_raw.txt new file mode 100644 index 000000000..80671abda --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_06_raw.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=ENDSWITH(UNMASK::(SUBSTRING([c_email], -1) || SUBSTRING([c_email], 1, LENGTH([c_email]) - 1)), 'gmail.com':string), columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_email': c_email}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_06_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_06_rewrite.txt new file mode 100644 index 000000000..80671abda --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_06_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=ENDSWITH(UNMASK::(SUBSTRING([c_email], -1) || SUBSTRING([c_email], 1, LENGTH([c_email]) - 1)), 'gmail.com':string), columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_email': c_email}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_07.txt b/tests/test_plan_refsols/cryptbank_filter_count_07_raw.txt similarity index 63% rename from tests/test_plan_refsols/cryptbank_filter_count_07.txt rename to tests/test_plan_refsols/cryptbank_filter_count_07_raw.txt index a41320e98..1311df68a 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_07.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_07_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=YEAR(c_birthday) == 1978:numeric, columns={}) + FILTER(condition=YEAR(UNMASK::(DATE([c_birthday], '+472 days'))) == 1978:numeric, columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_08.txt b/tests/test_plan_refsols/cryptbank_filter_count_07_rewrite.txt similarity index 63% rename from tests/test_plan_refsols/cryptbank_filter_count_08.txt rename to tests/test_plan_refsols/cryptbank_filter_count_07_rewrite.txt index 48d24b0ff..1311df68a 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_08.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_07_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=c_birthday == '1985-04-12':string, columns={}) + FILTER(condition=YEAR(UNMASK::(DATE([c_birthday], '+472 days'))) == 1978:numeric, columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_08_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_08_raw.txt new file mode 100644 index 000000000..f29a000d2 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_08_raw.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=UNMASK::(DATE([c_birthday], '+472 days')) == '1985-04-12':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_08_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_08_rewrite.txt new file mode 100644 index 000000000..f29a000d2 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_08_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=UNMASK::(DATE([c_birthday], '+472 days')) == '1985-04-12':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_09.txt b/tests/test_plan_refsols/cryptbank_filter_count_09_raw.txt similarity index 60% rename from tests/test_plan_refsols/cryptbank_filter_count_09.txt rename to tests/test_plan_refsols/cryptbank_filter_count_09_raw.txt index 7328787ad..77aa1f6f4 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_09.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_09_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=MONOTONIC(8000:numeric, t_amount, 9000:numeric), columns={}) + FILTER(condition=MONOTONIC(8000:numeric, UNMASK::((1025.67 - ([t_amount]))), 9000:numeric), columns={}) SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_09_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_09_rewrite.txt new file mode 100644 index 000000000..77aa1f6f4 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_09_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=MONOTONIC(8000:numeric, UNMASK::((1025.67 - ([t_amount]))), 9000:numeric), columns={}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_amount': t_amount}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_10.txt b/tests/test_plan_refsols/cryptbank_filter_count_10_raw.txt similarity index 51% rename from tests/test_plan_refsols/cryptbank_filter_count_10.txt rename to tests/test_plan_refsols/cryptbank_filter_count_10_raw.txt index 5b0a5c85f..ba1f8f094 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_10.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_10_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=MONOTONIC('2021-05-10 12:00:00':string, t_ts, '2021-05-20 12:00:00':string), columns={}) + FILTER(condition=MONOTONIC('2021-05-10 12:00:00':string, UNMASK::(DATETIME([t_ts], '+54321 seconds')), '2021-05-20 12:00:00':string), columns={}) SCAN(table=CRBNK.TRANSACTIONS, columns={'t_ts': t_ts}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_10_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_10_rewrite.txt new file mode 100644 index 000000000..ba1f8f094 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_10_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=MONOTONIC('2021-05-10 12:00:00':string, UNMASK::(DATETIME([t_ts], '+54321 seconds')), '2021-05-20 12:00:00':string), columns={}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_ts': t_ts}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_11.txt b/tests/test_plan_refsols/cryptbank_filter_count_11.txt deleted file mode 100644 index 617714670..000000000 --- a/tests/test_plan_refsols/cryptbank_filter_count_11.txt +++ /dev/null @@ -1,8 +0,0 @@ -ROOT(columns=[('n', n_rows)], orderings=[]) - AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.t_sourceaccount == t1.a_key, type=INNER, cardinality=SINGULAR_FILTER, columns={}) - SCAN(table=CRBNK.TRANSACTIONS, columns={'t_sourceaccount': t_sourceaccount}) - JOIN(condition=t0.a_custkey == t1.c_key, type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) - FILTER(condition=c_fname == 'alice':string, columns={'c_key': c_key}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_11_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_11_raw.txt new file mode 100644 index 000000000..9e3370b55 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_11_raw.txt @@ -0,0 +1,8 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=t0.t_sourceaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_sourceaccount': t_sourceaccount}) + JOIN(condition=t0.a_custkey == UNMASK::((42 - ([t1.c_key]))), type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) + FILTER(condition=UNMASK::(LOWER([c_fname])) == 'alice':string, columns={'c_key': c_key}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_11_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_11_rewrite.txt new file mode 100644 index 000000000..9e3370b55 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_11_rewrite.txt @@ -0,0 +1,8 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=t0.t_sourceaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_sourceaccount': t_sourceaccount}) + JOIN(condition=t0.a_custkey == UNMASK::((42 - ([t1.c_key]))), type=INNER, cardinality=SINGULAR_FILTER, columns={'a_key': t0.a_key}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_key': a_key}) + FILTER(condition=UNMASK::(LOWER([c_fname])) == 'alice':string, columns={'c_key': c_key}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_key': c_key}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_12.txt b/tests/test_plan_refsols/cryptbank_filter_count_12.txt deleted file mode 100644 index d82e53d7c..000000000 --- a/tests/test_plan_refsols/cryptbank_filter_count_12.txt +++ /dev/null @@ -1,5 +0,0 @@ -ROOT(columns=[('n', n_rows)], orderings=[]) - AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=YEAR(t0.t_ts) == YEAR(t1.a_open_ts) & t0.t_sourceaccount == t1.a_key, type=INNER, cardinality=SINGULAR_FILTER, columns={}) - SCAN(table=CRBNK.TRANSACTIONS, columns={'t_sourceaccount': t_sourceaccount, 't_ts': t_ts}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_key': a_key, 'a_open_ts': a_open_ts}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_12_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_12_raw.txt new file mode 100644 index 000000000..31b5e650f --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_12_raw.txt @@ -0,0 +1,5 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=YEAR(UNMASK::(DATETIME([t0.t_ts], '+54321 seconds'))) == YEAR(UNMASK::(DATETIME([t1.a_open_ts], '+123456789 seconds'))) & t0.t_sourceaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_sourceaccount': t_sourceaccount, 't_ts': t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_key': a_key, 'a_open_ts': a_open_ts}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_12_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_12_rewrite.txt new file mode 100644 index 000000000..31b5e650f --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_12_rewrite.txt @@ -0,0 +1,5 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=YEAR(UNMASK::(DATETIME([t0.t_ts], '+54321 seconds'))) == YEAR(UNMASK::(DATETIME([t1.a_open_ts], '+123456789 seconds'))) & t0.t_sourceaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_sourceaccount': t_sourceaccount, 't_ts': t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_key': a_key, 'a_open_ts': a_open_ts}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_13.txt b/tests/test_plan_refsols/cryptbank_filter_count_13.txt deleted file mode 100644 index 4137aadaf..000000000 --- a/tests/test_plan_refsols/cryptbank_filter_count_13.txt +++ /dev/null @@ -1,5 +0,0 @@ -ROOT(columns=[('n', n_rows)], orderings=[]) - AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.t_ts < DATETIME(t1.a_open_ts, '+2 years':string) & t0.t_destaccount == t1.a_key, type=INNER, cardinality=SINGULAR_FILTER, columns={}) - SCAN(table=CRBNK.TRANSACTIONS, columns={'t_destaccount': t_destaccount, 't_ts': t_ts}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_key': a_key, 'a_open_ts': a_open_ts}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_13_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_13_raw.txt new file mode 100644 index 000000000..33d41e092 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_13_raw.txt @@ -0,0 +1,5 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=UNMASK::(DATETIME([t0.t_ts], '+54321 seconds')) < DATETIME(UNMASK::(DATETIME([t1.a_open_ts], '+123456789 seconds')), '+2 years':string) & t0.t_destaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_destaccount': t_destaccount, 't_ts': t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_key': a_key, 'a_open_ts': a_open_ts}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_13_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_13_rewrite.txt new file mode 100644 index 000000000..33d41e092 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_13_rewrite.txt @@ -0,0 +1,5 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=UNMASK::(DATETIME([t0.t_ts], '+54321 seconds')) < DATETIME(UNMASK::(DATETIME([t1.a_open_ts], '+123456789 seconds')), '+2 years':string) & t0.t_destaccount == UNMASK::(CASE WHEN [t1.a_key] = 0 THEN 0 ELSE (CASE WHEN [t1.a_key] > 0 THEN 1 ELSE -1 END) * CAST(SUBSTRING([t1.a_key], 1 + INSTR([t1.a_key], '-'), LENGTH([t1.a_key]) / 2) AS INTEGER) END), type=INNER, cardinality=SINGULAR_FILTER, columns={}) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_destaccount': t_destaccount, 't_ts': t_ts}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_key': a_key, 'a_open_ts': a_open_ts}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_14.txt b/tests/test_plan_refsols/cryptbank_filter_count_14_raw.txt similarity index 57% rename from tests/test_plan_refsols/cryptbank_filter_count_14.txt rename to tests/test_plan_refsols/cryptbank_filter_count_14_raw.txt index cf234957e..b623ae10e 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_14.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_14_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ENDSWITH(c_fname, 'e':string) | ENDSWITH(c_lname, 'e':string), columns={}) + FILTER(condition=ENDSWITH(UNMASK::(LOWER([c_fname])), 'e':string) | ENDSWITH(UNMASK::(LOWER([c_lname])), 'e':string), columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_14_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_14_rewrite.txt new file mode 100644 index 000000000..b623ae10e --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_14_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=ENDSWITH(UNMASK::(LOWER([c_fname])), 'e':string) | ENDSWITH(UNMASK::(LOWER([c_lname])), 'e':string), columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname, 'c_lname': c_lname}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_15.txt b/tests/test_plan_refsols/cryptbank_filter_count_15.txt deleted file mode 100644 index 8e04c55b7..000000000 --- a/tests/test_plan_refsols/cryptbank_filter_count_15.txt +++ /dev/null @@ -1,6 +0,0 @@ -ROOT(columns=[('n', n_rows)], orderings=[]) - AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.c_key == t1.a_custkey, type=SEMI, cardinality=SINGULAR_FILTER, columns={}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_key': c_key}) - FILTER(condition=a_type == 'retirement':string, columns={'a_custkey': a_custkey}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_type': a_type}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_15_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_15_raw.txt new file mode 100644 index 000000000..47c888a3b --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_15_raw.txt @@ -0,0 +1,6 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey, type=SEMI, cardinality=SINGULAR_FILTER, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_key': c_key}) + FILTER(condition=UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1)) == 'retirement':string, columns={'a_custkey': a_custkey}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_type': a_type}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_15_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_15_rewrite.txt new file mode 100644 index 000000000..47c888a3b --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_15_rewrite.txt @@ -0,0 +1,6 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey, type=SEMI, cardinality=SINGULAR_FILTER, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_key': c_key}) + FILTER(condition=UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1)) == 'retirement':string, columns={'a_custkey': a_custkey}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_type': a_type}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_16.txt b/tests/test_plan_refsols/cryptbank_filter_count_16.txt deleted file mode 100644 index 7ba7c75dc..000000000 --- a/tests/test_plan_refsols/cryptbank_filter_count_16.txt +++ /dev/null @@ -1,6 +0,0 @@ -ROOT(columns=[('n', n_rows)], orderings=[]) - AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.c_key == t1.a_custkey, type=SEMI, cardinality=SINGULAR_FILTER, columns={}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_key': c_key}) - FILTER(condition=a_type != 'checking':string & a_type != 'savings':string, columns={'a_custkey': a_custkey}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_type': a_type}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_16_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_16_raw.txt new file mode 100644 index 000000000..6301888e1 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_16_raw.txt @@ -0,0 +1,6 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey, type=SEMI, cardinality=SINGULAR_FILTER, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_key': c_key}) + FILTER(condition=UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1)) != 'checking':string & UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1)) != 'savings':string, columns={'a_custkey': a_custkey}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_type': a_type}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_16_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_16_rewrite.txt new file mode 100644 index 000000000..6301888e1 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_16_rewrite.txt @@ -0,0 +1,6 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey, type=SEMI, cardinality=SINGULAR_FILTER, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_key': c_key}) + FILTER(condition=UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1)) != 'checking':string & UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1)) != 'savings':string, columns={'a_custkey': a_custkey}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_custkey': a_custkey, 'a_type': a_type}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_17.txt b/tests/test_plan_refsols/cryptbank_filter_count_17_raw.txt similarity index 57% rename from tests/test_plan_refsols/cryptbank_filter_count_17.txt rename to tests/test_plan_refsols/cryptbank_filter_count_17_raw.txt index b44f3f660..e4dbca684 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_17.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_17_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=SLICE(c_fname, 1:numeric, 2:numeric, None:unknown) == 'a':string, columns={}) + FILTER(condition=SLICE(UNMASK::(LOWER([c_fname])), 1:numeric, 2:numeric, None:unknown) == 'a':string, columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_17_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_17_rewrite.txt new file mode 100644 index 000000000..e4dbca684 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_17_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=SLICE(UNMASK::(LOWER([c_fname])), 1:numeric, 2:numeric, None:unknown) == 'a':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_fname': c_fname}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_19.txt b/tests/test_plan_refsols/cryptbank_filter_count_18_raw.txt similarity index 52% rename from tests/test_plan_refsols/cryptbank_filter_count_19.txt rename to tests/test_plan_refsols/cryptbank_filter_count_18_raw.txt index 193280041..935e582ed 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_19.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_18_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=CONTAINS(c_email, 'mail':string), columns={}) + FILTER(condition=LIKE(UNMASK::(SUBSTRING([c_email], -1) || SUBSTRING([c_email], 1, LENGTH([c_email]) - 1)), '%.%@%mail%':string), columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_email': c_email}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_18_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_18_rewrite.txt new file mode 100644 index 000000000..935e582ed --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_18_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=LIKE(UNMASK::(SUBSTRING([c_email], -1) || SUBSTRING([c_email], 1, LENGTH([c_email]) - 1)), '%.%@%mail%':string), columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_email': c_email}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_06.txt b/tests/test_plan_refsols/cryptbank_filter_count_19_raw.txt similarity index 52% rename from tests/test_plan_refsols/cryptbank_filter_count_06.txt rename to tests/test_plan_refsols/cryptbank_filter_count_19_raw.txt index 6ae283e88..3da1c4ddd 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_06.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_19_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ENDSWITH(c_email, 'gmail.com':string), columns={}) + FILTER(condition=CONTAINS(UNMASK::(SUBSTRING([c_email], -1) || SUBSTRING([c_email], 1, LENGTH([c_email]) - 1)), 'mail':string), columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_email': c_email}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_18.txt b/tests/test_plan_refsols/cryptbank_filter_count_19_rewrite.txt similarity index 52% rename from tests/test_plan_refsols/cryptbank_filter_count_18.txt rename to tests/test_plan_refsols/cryptbank_filter_count_19_rewrite.txt index 32a550e18..3da1c4ddd 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_18.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_19_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=LIKE(c_email, '%.%@%mail%':string), columns={}) + FILTER(condition=CONTAINS(UNMASK::(SUBSTRING([c_email], -1) || SUBSTRING([c_email], 1, LENGTH([c_email]) - 1)), 'mail':string), columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_email': c_email}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_21.txt b/tests/test_plan_refsols/cryptbank_filter_count_20_raw.txt similarity index 63% rename from tests/test_plan_refsols/cryptbank_filter_count_21.txt rename to tests/test_plan_refsols/cryptbank_filter_count_20_raw.txt index 260e33d79..462814855 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_21.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_20_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=c_birthday >= '1991-11-15':string, columns={}) + FILTER(condition=UNMASK::(DATE([c_birthday], '+472 days')) > '1991-11-15':string, columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_20.txt b/tests/test_plan_refsols/cryptbank_filter_count_20_rewrite.txt similarity index 63% rename from tests/test_plan_refsols/cryptbank_filter_count_20.txt rename to tests/test_plan_refsols/cryptbank_filter_count_20_rewrite.txt index 5c6f0028e..462814855 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_20.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_20_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=c_birthday > '1991-11-15':string, columns={}) + FILTER(condition=UNMASK::(DATE([c_birthday], '+472 days')) > '1991-11-15':string, columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_21_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_21_raw.txt new file mode 100644 index 000000000..9742c2261 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_21_raw.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=UNMASK::(DATE([c_birthday], '+472 days')) >= '1991-11-15':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_21_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_21_rewrite.txt new file mode 100644 index 000000000..9742c2261 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_21_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=UNMASK::(DATE([c_birthday], '+472 days')) >= '1991-11-15':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_22.txt b/tests/test_plan_refsols/cryptbank_filter_count_22.txt deleted file mode 100644 index 0af092c46..000000000 --- a/tests/test_plan_refsols/cryptbank_filter_count_22.txt +++ /dev/null @@ -1,4 +0,0 @@ -ROOT(columns=[('n', n_rows)], orderings=[]) - AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=c_birthday < '1991-11-15':string, columns={}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_22_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_22_raw.txt new file mode 100644 index 000000000..13dfd466f --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_22_raw.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=UNMASK::(DATE([c_birthday], '+472 days')) < '1991-11-15':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_22_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_22_rewrite.txt new file mode 100644 index 000000000..13dfd466f --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_22_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=UNMASK::(DATE([c_birthday], '+472 days')) < '1991-11-15':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_23.txt b/tests/test_plan_refsols/cryptbank_filter_count_23.txt deleted file mode 100644 index ef060f6e9..000000000 --- a/tests/test_plan_refsols/cryptbank_filter_count_23.txt +++ /dev/null @@ -1,4 +0,0 @@ -ROOT(columns=[('n', n_rows)], orderings=[]) - AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=c_birthday <= '1991-11-15':string, columns={}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_23_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_23_raw.txt new file mode 100644 index 000000000..56faca00f --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_23_raw.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=UNMASK::(DATE([c_birthday], '+472 days')) <= '1991-11-15':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_23_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_23_rewrite.txt new file mode 100644 index 000000000..56faca00f --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_23_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=UNMASK::(DATE([c_birthday], '+472 days')) <= '1991-11-15':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_24.txt b/tests/test_plan_refsols/cryptbank_filter_count_24.txt deleted file mode 100644 index 1df1c3e08..000000000 --- a/tests/test_plan_refsols/cryptbank_filter_count_24.txt +++ /dev/null @@ -1,4 +0,0 @@ -ROOT(columns=[('n', n_rows)], orderings=[]) - AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=c_birthday == '1991-11-15':string, columns={}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_24_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_24_raw.txt new file mode 100644 index 000000000..473a4d7f7 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_24_raw.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=UNMASK::(DATE([c_birthday], '+472 days')) == '1991-11-15':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_24_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_24_rewrite.txt new file mode 100644 index 000000000..473a4d7f7 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_24_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=UNMASK::(DATE([c_birthday], '+472 days')) == '1991-11-15':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_25.txt b/tests/test_plan_refsols/cryptbank_filter_count_25.txt deleted file mode 100644 index 1b76fe224..000000000 --- a/tests/test_plan_refsols/cryptbank_filter_count_25.txt +++ /dev/null @@ -1,4 +0,0 @@ -ROOT(columns=[('n', n_rows)], orderings=[]) - AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ABSENT(c_birthday) | c_birthday != '1991-11-15':string, columns={}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_25_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_25_raw.txt new file mode 100644 index 000000000..02f3fd20d --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_25_raw.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=ABSENT(UNMASK::(DATE([c_birthday], '+472 days'))) | UNMASK::(DATE([c_birthday], '+472 days')) != '1991-11-15':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_25_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_25_rewrite.txt new file mode 100644 index 000000000..02f3fd20d --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_25_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=ABSENT(UNMASK::(DATE([c_birthday], '+472 days'))) | UNMASK::(DATE([c_birthday], '+472 days')) != '1991-11-15':string, columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_birthday': c_birthday}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_05.txt b/tests/test_plan_refsols/cryptbank_filter_count_26_raw.txt similarity index 54% rename from tests/test_plan_refsols/cryptbank_filter_count_05.txt rename to tests/test_plan_refsols/cryptbank_filter_count_26_raw.txt index c9781a555..540da15bd 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_05.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_26_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=STARTSWITH(c_phone, '555-8':string), columns={}) + FILTER(condition=UNMASK::(REPLACE(REPLACE(REPLACE([c_phone], '9', '*'), '0', '9'), '*', '0')) == '555-123-456':string, columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_phone': c_phone}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_26.txt b/tests/test_plan_refsols/cryptbank_filter_count_26_rewrite.txt similarity index 54% rename from tests/test_plan_refsols/cryptbank_filter_count_26.txt rename to tests/test_plan_refsols/cryptbank_filter_count_26_rewrite.txt index b282ef29e..540da15bd 100644 --- a/tests/test_plan_refsols/cryptbank_filter_count_26.txt +++ b/tests/test_plan_refsols/cryptbank_filter_count_26_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=c_phone == '555-123-456':string, columns={}) + FILTER(condition=UNMASK::(REPLACE(REPLACE(REPLACE([c_phone], '9', '*'), '0', '9'), '*', '0')) == '555-123-456':string, columns={}) SCAN(table=CRBNK.CUSTOMERS, columns={'c_phone': c_phone}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_27.txt b/tests/test_plan_refsols/cryptbank_filter_count_27.txt deleted file mode 100644 index 4a5a63088..000000000 --- a/tests/test_plan_refsols/cryptbank_filter_count_27.txt +++ /dev/null @@ -1,4 +0,0 @@ -ROOT(columns=[('n', n_rows)], orderings=[]) - AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=PRESENT(c_addr) & PRESENT(c_birthday) & c_lname != 'lopez':string & ENDSWITH(c_fname, 'a':string) | ENDSWITH(c_fname, 'e':string) | ENDSWITH(c_fname, 's':string) | ABSENT(c_birthday) & ENDSWITH(c_phone, '5':string), columns={}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_birthday': c_birthday, 'c_fname': c_fname, 'c_lname': c_lname, 'c_phone': c_phone}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_27_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_27_raw.txt new file mode 100644 index 000000000..eec9ddd9e --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_27_raw.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=PRESENT(UNMASK::(SUBSTRING([c_addr], -1) || SUBSTRING([c_addr], 1, LENGTH([c_addr]) - 1))) & PRESENT(UNMASK::(DATE([c_birthday], '+472 days'))) & UNMASK::(LOWER([c_lname])) != 'lopez':string & ENDSWITH(UNMASK::(LOWER([c_fname])), 'a':string) | ENDSWITH(UNMASK::(LOWER([c_fname])), 'e':string) | ENDSWITH(UNMASK::(LOWER([c_fname])), 's':string) | ABSENT(UNMASK::(DATE([c_birthday], '+472 days'))) & ENDSWITH(UNMASK::(REPLACE(REPLACE(REPLACE([c_phone], '9', '*'), '0', '9'), '*', '0')), '5':string), columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_birthday': c_birthday, 'c_fname': c_fname, 'c_lname': c_lname, 'c_phone': c_phone}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_27_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_27_rewrite.txt new file mode 100644 index 000000000..eec9ddd9e --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_27_rewrite.txt @@ -0,0 +1,4 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + FILTER(condition=PRESENT(UNMASK::(SUBSTRING([c_addr], -1) || SUBSTRING([c_addr], 1, LENGTH([c_addr]) - 1))) & PRESENT(UNMASK::(DATE([c_birthday], '+472 days'))) & UNMASK::(LOWER([c_lname])) != 'lopez':string & ENDSWITH(UNMASK::(LOWER([c_fname])), 'a':string) | ENDSWITH(UNMASK::(LOWER([c_fname])), 'e':string) | ENDSWITH(UNMASK::(LOWER([c_fname])), 's':string) | ABSENT(UNMASK::(DATE([c_birthday], '+472 days'))) & ENDSWITH(UNMASK::(REPLACE(REPLACE(REPLACE([c_phone], '9', '*'), '0', '9'), '*', '0')), '5':string), columns={}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_birthday': c_birthday, 'c_fname': c_fname, 'c_lname': c_lname, 'c_phone': c_phone}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_28.txt b/tests/test_plan_refsols/cryptbank_filter_count_28.txt deleted file mode 100644 index 2f4efda84..000000000 --- a/tests/test_plan_refsols/cryptbank_filter_count_28.txt +++ /dev/null @@ -1,7 +0,0 @@ -ROOT(columns=[('n', n_rows)], orderings=[]) - AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.a_custkey == t1.c_key, type=INNER, cardinality=SINGULAR_FILTER, columns={}) - FILTER(condition=YEAR(a_open_ts) < 2020:numeric & a_balance >= 5000:numeric & a_type == 'retirement':string | a_type == 'savings':string, columns={'a_custkey': a_custkey}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_balance': a_balance, 'a_custkey': a_custkey, 'a_open_ts': a_open_ts, 'a_type': a_type}) - FILTER(condition=CONTAINS(c_email, 'outlook':string) | CONTAINS(c_email, 'gmail':string), columns={'c_key': c_key}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_email': c_email, 'c_key': c_key}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_28_raw.txt b/tests/test_plan_refsols/cryptbank_filter_count_28_raw.txt new file mode 100644 index 000000000..7dcd73652 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_28_raw.txt @@ -0,0 +1,7 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=t0.a_custkey == UNMASK::((42 - ([t1.c_key]))), type=INNER, cardinality=SINGULAR_FILTER, columns={}) + FILTER(condition=YEAR(UNMASK::(DATETIME([a_open_ts], '+123456789 seconds'))) < 2020:numeric & UNMASK::(SQRT([a_balance])) >= 5000:numeric & UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1)) == 'retirement':string | UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1)) == 'savings':string, columns={'a_custkey': a_custkey}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_balance': a_balance, 'a_custkey': a_custkey, 'a_open_ts': a_open_ts, 'a_type': a_type}) + FILTER(condition=CONTAINS(UNMASK::(SUBSTRING([c_email], -1) || SUBSTRING([c_email], 1, LENGTH([c_email]) - 1)), 'outlook':string) | CONTAINS(UNMASK::(SUBSTRING([c_email], -1) || SUBSTRING([c_email], 1, LENGTH([c_email]) - 1)), 'gmail':string), columns={'c_key': c_key}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_email': c_email, 'c_key': c_key}) diff --git a/tests/test_plan_refsols/cryptbank_filter_count_28_rewrite.txt b/tests/test_plan_refsols/cryptbank_filter_count_28_rewrite.txt new file mode 100644 index 000000000..7dcd73652 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_filter_count_28_rewrite.txt @@ -0,0 +1,7 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=t0.a_custkey == UNMASK::((42 - ([t1.c_key]))), type=INNER, cardinality=SINGULAR_FILTER, columns={}) + FILTER(condition=YEAR(UNMASK::(DATETIME([a_open_ts], '+123456789 seconds'))) < 2020:numeric & UNMASK::(SQRT([a_balance])) >= 5000:numeric & UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1)) == 'retirement':string | UNMASK::(SUBSTRING([a_type], -1) || SUBSTRING([a_type], 1, LENGTH([a_type]) - 1)) == 'savings':string, columns={'a_custkey': a_custkey}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_balance': a_balance, 'a_custkey': a_custkey, 'a_open_ts': a_open_ts, 'a_type': a_type}) + FILTER(condition=CONTAINS(UNMASK::(SUBSTRING([c_email], -1) || SUBSTRING([c_email], 1, LENGTH([c_email]) - 1)), 'outlook':string) | CONTAINS(UNMASK::(SUBSTRING([c_email], -1) || SUBSTRING([c_email], 1, LENGTH([c_email]) - 1)), 'gmail':string), columns={'c_key': c_key}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_email': c_email, 'c_key': c_key}) diff --git a/tests/test_plan_refsols/cryptbank_general_join_01.txt b/tests/test_plan_refsols/cryptbank_general_join_01.txt deleted file mode 100644 index 31ffd9a58..000000000 --- a/tests/test_plan_refsols/cryptbank_general_join_01.txt +++ /dev/null @@ -1,12 +0,0 @@ -ROOT(columns=[('branch_key', b_key), ('n_local_cust', n_rows), ('n_local_cust_local_acct', DEFAULT_TO(sum_n_rows, 0:numeric))], orderings=[]) - AGGREGATE(keys={'b_key': b_key}, aggregations={'n_rows': COUNT(), 'sum_n_rows': SUM(n_rows)}) - JOIN(condition=t0.b_key == t1.b_key & t0.c_key == t1.c_key, type=LEFT, cardinality=SINGULAR_FILTER, columns={'b_key': t0.b_key, 'n_rows': t1.n_rows}) - JOIN(condition=SLICE(t0.b_addr, -8:numeric, -6:numeric, None:unknown) == SLICE(t1.c_addr, -8:numeric, -6:numeric, None:unknown), type=INNER, cardinality=PLURAL_FILTER, columns={'b_key': t0.b_key, 'c_key': t1.c_key}) - SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_key': c_key}) - AGGREGATE(keys={'b_key': b_key, 'c_key': c_key}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.c_key == t1.a_custkey & t1.a_branchkey == t0.b_key, type=INNER, cardinality=PLURAL_FILTER, columns={'b_key': t0.b_key, 'c_key': t0.c_key}) - JOIN(condition=SLICE(t0.b_addr, -8:numeric, -6:numeric, None:unknown) == SLICE(t1.c_addr, -8:numeric, -6:numeric, None:unknown), type=INNER, cardinality=PLURAL_ACCESS, columns={'b_key': t0.b_key, 'c_key': t1.c_key}) - SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_key': c_key}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_custkey': a_custkey}) diff --git a/tests/test_plan_refsols/cryptbank_general_join_01_raw.txt b/tests/test_plan_refsols/cryptbank_general_join_01_raw.txt new file mode 100644 index 000000000..91d0fcf03 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_general_join_01_raw.txt @@ -0,0 +1,12 @@ +ROOT(columns=[('branch_key', b_key), ('n_local_cust', n_rows), ('n_local_cust_local_acct', DEFAULT_TO(sum_n_rows, 0:numeric))], orderings=[]) + AGGREGATE(keys={'b_key': b_key}, aggregations={'n_rows': COUNT(), 'sum_n_rows': SUM(n_rows)}) + JOIN(condition=t0.b_key == t1.b_key & UNMASK::((42 - ([t0.c_key]))) == t1.unmask_c_key, type=LEFT, cardinality=SINGULAR_FILTER, columns={'b_key': t0.b_key, 'n_rows': t1.n_rows}) + JOIN(condition=SLICE(t0.b_addr, -8:numeric, -6:numeric, None:unknown) == SLICE(UNMASK::(SUBSTRING([t1.c_addr], -1) || SUBSTRING([t1.c_addr], 1, LENGTH([t1.c_addr]) - 1)), -8:numeric, -6:numeric, None:unknown), type=INNER, cardinality=PLURAL_FILTER, columns={'b_key': t0.b_key, 'c_key': t1.c_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_key': c_key}) + AGGREGATE(keys={'b_key': b_key, 'unmask_c_key': UNMASK::((42 - ([c_key])))}, aggregations={'n_rows': COUNT()}) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey & t1.a_branchkey == t0.b_key, type=INNER, cardinality=PLURAL_FILTER, columns={'b_key': t0.b_key, 'c_key': t0.c_key}) + JOIN(condition=SLICE(t0.b_addr, -8:numeric, -6:numeric, None:unknown) == SLICE(UNMASK::(SUBSTRING([t1.c_addr], -1) || SUBSTRING([t1.c_addr], 1, LENGTH([t1.c_addr]) - 1)), -8:numeric, -6:numeric, None:unknown), type=INNER, cardinality=PLURAL_ACCESS, columns={'b_key': t0.b_key, 'c_key': t1.c_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_key': c_key}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_custkey': a_custkey}) diff --git a/tests/test_plan_refsols/cryptbank_general_join_01_rewrite.txt b/tests/test_plan_refsols/cryptbank_general_join_01_rewrite.txt new file mode 100644 index 000000000..91d0fcf03 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_general_join_01_rewrite.txt @@ -0,0 +1,12 @@ +ROOT(columns=[('branch_key', b_key), ('n_local_cust', n_rows), ('n_local_cust_local_acct', DEFAULT_TO(sum_n_rows, 0:numeric))], orderings=[]) + AGGREGATE(keys={'b_key': b_key}, aggregations={'n_rows': COUNT(), 'sum_n_rows': SUM(n_rows)}) + JOIN(condition=t0.b_key == t1.b_key & UNMASK::((42 - ([t0.c_key]))) == t1.unmask_c_key, type=LEFT, cardinality=SINGULAR_FILTER, columns={'b_key': t0.b_key, 'n_rows': t1.n_rows}) + JOIN(condition=SLICE(t0.b_addr, -8:numeric, -6:numeric, None:unknown) == SLICE(UNMASK::(SUBSTRING([t1.c_addr], -1) || SUBSTRING([t1.c_addr], 1, LENGTH([t1.c_addr]) - 1)), -8:numeric, -6:numeric, None:unknown), type=INNER, cardinality=PLURAL_FILTER, columns={'b_key': t0.b_key, 'c_key': t1.c_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_key': c_key}) + AGGREGATE(keys={'b_key': b_key, 'unmask_c_key': UNMASK::((42 - ([c_key])))}, aggregations={'n_rows': COUNT()}) + JOIN(condition=UNMASK::((42 - ([t0.c_key]))) == t1.a_custkey & t1.a_branchkey == t0.b_key, type=INNER, cardinality=PLURAL_FILTER, columns={'b_key': t0.b_key, 'c_key': t0.c_key}) + JOIN(condition=SLICE(t0.b_addr, -8:numeric, -6:numeric, None:unknown) == SLICE(UNMASK::(SUBSTRING([t1.c_addr], -1) || SUBSTRING([t1.c_addr], 1, LENGTH([t1.c_addr]) - 1)), -8:numeric, -6:numeric, None:unknown), type=INNER, cardinality=PLURAL_ACCESS, columns={'b_key': t0.b_key, 'c_key': t1.c_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_key': c_key}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_custkey': a_custkey}) diff --git a/tests/test_plan_refsols/cryptbank_general_join_02.txt b/tests/test_plan_refsols/cryptbank_general_join_02.txt deleted file mode 100644 index a118ab640..000000000 --- a/tests/test_plan_refsols/cryptbank_general_join_02.txt +++ /dev/null @@ -1,7 +0,0 @@ -ROOT(columns=[('n', n_rows)], orderings=[]) - AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.a_custkey == t1.c_key & t0.a_branchkey == t1.b_key, type=SEMI, cardinality=SINGULAR_FILTER, columns={}) - SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_custkey': a_custkey}) - JOIN(condition=SLICE(t1.b_addr, -8:numeric, -6:numeric, None:unknown) == SLICE(t0.c_addr, -8:numeric, -6:numeric, None:unknown), type=INNER, cardinality=PLURAL_ACCESS, columns={'b_key': t1.b_key, 'c_key': t0.c_key}) - SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_key': c_key}) - SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) diff --git a/tests/test_plan_refsols/cryptbank_general_join_02_raw.txt b/tests/test_plan_refsols/cryptbank_general_join_02_raw.txt new file mode 100644 index 000000000..e880f9026 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_general_join_02_raw.txt @@ -0,0 +1,8 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=t0.a_custkey == t1.unmask_c_key & t0.a_branchkey == t1.b_key, type=SEMI, cardinality=SINGULAR_FILTER, columns={}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_custkey': a_custkey}) + PROJECT(columns={'b_key': b_key, 'unmask_c_key': UNMASK::((42 - ([c_key])))}) + JOIN(condition=SLICE(t1.b_addr, -8:numeric, -6:numeric, None:unknown) == SLICE(UNMASK::(SUBSTRING([t0.c_addr], -1) || SUBSTRING([t0.c_addr], 1, LENGTH([t0.c_addr]) - 1)), -8:numeric, -6:numeric, None:unknown), type=INNER, cardinality=PLURAL_ACCESS, columns={'b_key': t1.b_key, 'c_key': t0.c_key}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_key': c_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) diff --git a/tests/test_plan_refsols/cryptbank_general_join_02_rewrite.txt b/tests/test_plan_refsols/cryptbank_general_join_02_rewrite.txt new file mode 100644 index 000000000..e880f9026 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_general_join_02_rewrite.txt @@ -0,0 +1,8 @@ +ROOT(columns=[('n', n_rows)], orderings=[]) + AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) + JOIN(condition=t0.a_custkey == t1.unmask_c_key & t0.a_branchkey == t1.b_key, type=SEMI, cardinality=SINGULAR_FILTER, columns={}) + SCAN(table=CRBNK.ACCOUNTS, columns={'a_branchkey': a_branchkey, 'a_custkey': a_custkey}) + PROJECT(columns={'b_key': b_key, 'unmask_c_key': UNMASK::((42 - ([c_key])))}) + JOIN(condition=SLICE(t1.b_addr, -8:numeric, -6:numeric, None:unknown) == SLICE(UNMASK::(SUBSTRING([t0.c_addr], -1) || SUBSTRING([t0.c_addr], 1, LENGTH([t0.c_addr]) - 1)), -8:numeric, -6:numeric, None:unknown), type=INNER, cardinality=PLURAL_ACCESS, columns={'b_key': t1.b_key, 'c_key': t0.c_key}) + SCAN(table=CRBNK.CUSTOMERS, columns={'c_addr': c_addr, 'c_key': c_key}) + SCAN(table=CRBNK.BRANCHES, columns={'b_addr': b_addr, 'b_key': b_key}) diff --git a/tests/test_plan_refsols/cryptbank_partially_encrypted_scan_topk.txt b/tests/test_plan_refsols/cryptbank_partially_encrypted_scan_topk.txt deleted file mode 100644 index 56a759773..000000000 --- a/tests/test_plan_refsols/cryptbank_partially_encrypted_scan_topk.txt +++ /dev/null @@ -1,2 +0,0 @@ -ROOT(columns=[('key', t_key), ('time_stamp', t_ts)], orderings=[(t_ts):desc_last], limit=5:numeric) - SCAN(table=CRBNK.TRANSACTIONS, columns={'t_key': t_key, 't_ts': t_ts}) diff --git a/tests/test_plan_refsols/cryptbank_partially_encrypted_scan_topk_raw.txt b/tests/test_plan_refsols/cryptbank_partially_encrypted_scan_topk_raw.txt new file mode 100644 index 000000000..c5b4db155 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_partially_encrypted_scan_topk_raw.txt @@ -0,0 +1,2 @@ +ROOT(columns=[('key', t_key), ('time_stamp', UNMASK::(DATETIME([t_ts], '+54321 seconds')))], orderings=[(UNMASK::(DATETIME([t_ts], '+54321 seconds'))):desc_last], limit=5:numeric) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_key': t_key, 't_ts': t_ts}) diff --git a/tests/test_plan_refsols/cryptbank_partially_encrypted_scan_topk_rewrite.txt b/tests/test_plan_refsols/cryptbank_partially_encrypted_scan_topk_rewrite.txt new file mode 100644 index 000000000..c5b4db155 --- /dev/null +++ b/tests/test_plan_refsols/cryptbank_partially_encrypted_scan_topk_rewrite.txt @@ -0,0 +1,2 @@ +ROOT(columns=[('key', t_key), ('time_stamp', UNMASK::(DATETIME([t_ts], '+54321 seconds')))], orderings=[(UNMASK::(DATETIME([t_ts], '+54321 seconds'))):desc_last], limit=5:numeric) + SCAN(table=CRBNK.TRANSACTIONS, columns={'t_key': t_key, 't_ts': t_ts}) diff --git a/tests/test_plan_refsols/fsi_accounts_agg_pct_total_raw.txt b/tests/test_plan_refsols/fsi_accounts_agg_pct_total_raw.txt index edc85f7ae..2111f4825 100644 --- a/tests/test_plan_refsols/fsi_accounts_agg_pct_total_raw.txt +++ b/tests/test_plan_refsols/fsi_accounts_agg_pct_total_raw.txt @@ -1,4 +1,4 @@ -ROOT(columns=[('acct_type', accounttype), ('pct_total_txn', ROUND(DEFAULT_TO(sum_amount, 0:numeric) / RELSUM(args=[DEFAULT_TO(sum_amount, 0:numeric)], partition=[], order=[]), 2:numeric))], orderings=[(ROUND(DEFAULT_TO(sum_amount, 0:numeric) / RELSUM(args=[DEFAULT_TO(sum_amount, 0:numeric)], partition=[], order=[]), 2:numeric)):desc_last], limit=5:numeric) +ROOT(columns=[('acct_type', UNMASK::(PTY_UNPROTECT([accounttype], 'deAccount'))), ('pct_total_txn', ROUND(DEFAULT_TO(sum_amount, 0:numeric) / RELSUM(args=[DEFAULT_TO(sum_amount, 0:numeric)], partition=[], order=[]), 2:numeric))], orderings=[(ROUND(DEFAULT_TO(sum_amount, 0:numeric) / RELSUM(args=[DEFAULT_TO(sum_amount, 0:numeric)], partition=[], order=[]), 2:numeric)):desc_last], limit=5:numeric) JOIN(condition=t0.accountid == t1.accountid, type=INNER, cardinality=SINGULAR_ACCESS, columns={'accounttype': t0.accounttype, 'sum_amount': t1.sum_amount}) SCAN(table=bodo.fsi.accounts, columns={'accountid': accountid, 'accounttype': accounttype}) AGGREGATE(keys={'accountid': accountid}, aggregations={'sum_amount': SUM(amount)}) diff --git a/tests/test_plan_refsols/fsi_accounts_agg_pct_total_rewrite.txt b/tests/test_plan_refsols/fsi_accounts_agg_pct_total_rewrite.txt index edc85f7ae..2111f4825 100644 --- a/tests/test_plan_refsols/fsi_accounts_agg_pct_total_rewrite.txt +++ b/tests/test_plan_refsols/fsi_accounts_agg_pct_total_rewrite.txt @@ -1,4 +1,4 @@ -ROOT(columns=[('acct_type', accounttype), ('pct_total_txn', ROUND(DEFAULT_TO(sum_amount, 0:numeric) / RELSUM(args=[DEFAULT_TO(sum_amount, 0:numeric)], partition=[], order=[]), 2:numeric))], orderings=[(ROUND(DEFAULT_TO(sum_amount, 0:numeric) / RELSUM(args=[DEFAULT_TO(sum_amount, 0:numeric)], partition=[], order=[]), 2:numeric)):desc_last], limit=5:numeric) +ROOT(columns=[('acct_type', UNMASK::(PTY_UNPROTECT([accounttype], 'deAccount'))), ('pct_total_txn', ROUND(DEFAULT_TO(sum_amount, 0:numeric) / RELSUM(args=[DEFAULT_TO(sum_amount, 0:numeric)], partition=[], order=[]), 2:numeric))], orderings=[(ROUND(DEFAULT_TO(sum_amount, 0:numeric) / RELSUM(args=[DEFAULT_TO(sum_amount, 0:numeric)], partition=[], order=[]), 2:numeric)):desc_last], limit=5:numeric) JOIN(condition=t0.accountid == t1.accountid, type=INNER, cardinality=SINGULAR_ACCESS, columns={'accounttype': t0.accounttype, 'sum_amount': t1.sum_amount}) SCAN(table=bodo.fsi.accounts, columns={'accountid': accountid, 'accounttype': accounttype}) AGGREGATE(keys={'accountid': accountid}, aggregations={'sum_amount': SUM(amount)}) diff --git a/tests/test_plan_refsols/fsi_accounts_customers_compound_a_raw.txt b/tests/test_plan_refsols/fsi_accounts_customers_compound_a_raw.txt index 2a2ef8511..cc6be933b 100644 --- a/tests/test_plan_refsols/fsi_accounts_customers_compound_a_raw.txt +++ b/tests/test_plan_refsols/fsi_accounts_customers_compound_a_raw.txt @@ -1,7 +1,7 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.customerid == t1.customerid, type=INNER, cardinality=SINGULAR_FILTER, columns={}) - FILTER(condition=currency != 'GBP':string & balance < 20000:numeric, columns={'customerid': customerid}) + JOIN(condition=UNMASK::(PTY_UNPROTECT_ACCOUNT([t0.customerid])) == UNMASK::(PTY_UNPROTECT([t1.customerid], 'deAccount')), type=INNER, cardinality=SINGULAR_FILTER, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT_ACCOUNT([currency])) != 'GBP':string & balance < 20000:numeric, columns={'customerid': customerid}) SCAN(table=bodo.fsi.accounts, columns={'balance': balance, 'currency': currency, 'customerid': customerid}) - FILTER(condition=state == 'California':string, columns={'customerid': customerid}) + FILTER(condition=UNMASK::(PTY_UNPROTECT([state], 'deAddress')) == 'California':string, columns={'customerid': customerid}) SCAN(table=bodo.fsi.protected_customers, columns={'customerid': customerid, 'state': state}) diff --git a/tests/test_plan_refsols/fsi_accounts_customers_compound_a_rewrite.txt b/tests/test_plan_refsols/fsi_accounts_customers_compound_a_rewrite.txt index 2a2ef8511..cc6be933b 100644 --- a/tests/test_plan_refsols/fsi_accounts_customers_compound_a_rewrite.txt +++ b/tests/test_plan_refsols/fsi_accounts_customers_compound_a_rewrite.txt @@ -1,7 +1,7 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.customerid == t1.customerid, type=INNER, cardinality=SINGULAR_FILTER, columns={}) - FILTER(condition=currency != 'GBP':string & balance < 20000:numeric, columns={'customerid': customerid}) + JOIN(condition=UNMASK::(PTY_UNPROTECT_ACCOUNT([t0.customerid])) == UNMASK::(PTY_UNPROTECT([t1.customerid], 'deAccount')), type=INNER, cardinality=SINGULAR_FILTER, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT_ACCOUNT([currency])) != 'GBP':string & balance < 20000:numeric, columns={'customerid': customerid}) SCAN(table=bodo.fsi.accounts, columns={'balance': balance, 'currency': currency, 'customerid': customerid}) - FILTER(condition=state == 'California':string, columns={'customerid': customerid}) + FILTER(condition=UNMASK::(PTY_UNPROTECT([state], 'deAddress')) == 'California':string, columns={'customerid': customerid}) SCAN(table=bodo.fsi.protected_customers, columns={'customerid': customerid, 'state': state}) diff --git a/tests/test_plan_refsols/fsi_accounts_customers_compound_b_raw.txt b/tests/test_plan_refsols/fsi_accounts_customers_compound_b_raw.txt index cfdc46319..97b405997 100644 --- a/tests/test_plan_refsols/fsi_accounts_customers_compound_b_raw.txt +++ b/tests/test_plan_refsols/fsi_accounts_customers_compound_b_raw.txt @@ -1,7 +1,7 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.customerid == t1.customerid, type=INNER, cardinality=SINGULAR_FILTER, columns={}) - FILTER(condition=YEAR(createddate) <= 2022:numeric & ISIN(currency, ['USD', 'GPB', 'EUR', 'JPY', 'AUD']:array[unknown]), columns={'customerid': customerid}) + JOIN(condition=UNMASK::(PTY_UNPROTECT_ACCOUNT([t0.customerid])) == UNMASK::(PTY_UNPROTECT([t1.customerid], 'deAccount')), type=INNER, cardinality=SINGULAR_FILTER, columns={}) + FILTER(condition=YEAR(UNMASK::(PTY_UNPROTECT_DOB([createddate]))) <= 2022:numeric & ISIN(UNMASK::(PTY_UNPROTECT_ACCOUNT([currency])), ['USD', 'GPB', 'EUR', 'JPY', 'AUD']:array[unknown]), columns={'customerid': customerid}) SCAN(table=bodo.fsi.accounts, columns={'createddate': createddate, 'currency': currency, 'customerid': customerid}) - FILTER(condition=ISIN(state, ['Georgia', 'Alabama', 'Mississippi', 'Arkansas', 'Louisiana', 'Florida', 'South Carolina', 'North Carolina', 'Texas', 'Tennessee', 'Missouri']:array[unknown]) & NOT(ISIN(firstname, ['Jennifer', 'Julio', 'Johnson', 'Jameson', 'Michael', 'Robert']:array[unknown])), columns={'customerid': customerid}) + FILTER(condition=ISIN(UNMASK::(PTY_UNPROTECT([state], 'deAddress')), ['Georgia', 'Alabama', 'Mississippi', 'Arkansas', 'Louisiana', 'Florida', 'South Carolina', 'North Carolina', 'Texas', 'Tennessee', 'Missouri']:array[unknown]) & NOT(ISIN(UNMASK::(PTY_UNPROTECT([firstname], 'deName')), ['Jennifer', 'Julio', 'Johnson', 'Jameson', 'Michael', 'Robert']:array[unknown])), columns={'customerid': customerid}) SCAN(table=bodo.fsi.protected_customers, columns={'customerid': customerid, 'firstname': firstname, 'state': state}) diff --git a/tests/test_plan_refsols/fsi_accounts_customers_compound_b_rewrite.txt b/tests/test_plan_refsols/fsi_accounts_customers_compound_b_rewrite.txt index cfdc46319..97b405997 100644 --- a/tests/test_plan_refsols/fsi_accounts_customers_compound_b_rewrite.txt +++ b/tests/test_plan_refsols/fsi_accounts_customers_compound_b_rewrite.txt @@ -1,7 +1,7 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.customerid == t1.customerid, type=INNER, cardinality=SINGULAR_FILTER, columns={}) - FILTER(condition=YEAR(createddate) <= 2022:numeric & ISIN(currency, ['USD', 'GPB', 'EUR', 'JPY', 'AUD']:array[unknown]), columns={'customerid': customerid}) + JOIN(condition=UNMASK::(PTY_UNPROTECT_ACCOUNT([t0.customerid])) == UNMASK::(PTY_UNPROTECT([t1.customerid], 'deAccount')), type=INNER, cardinality=SINGULAR_FILTER, columns={}) + FILTER(condition=YEAR(UNMASK::(PTY_UNPROTECT_DOB([createddate]))) <= 2022:numeric & ISIN(UNMASK::(PTY_UNPROTECT_ACCOUNT([currency])), ['USD', 'GPB', 'EUR', 'JPY', 'AUD']:array[unknown]), columns={'customerid': customerid}) SCAN(table=bodo.fsi.accounts, columns={'createddate': createddate, 'currency': currency, 'customerid': customerid}) - FILTER(condition=ISIN(state, ['Georgia', 'Alabama', 'Mississippi', 'Arkansas', 'Louisiana', 'Florida', 'South Carolina', 'North Carolina', 'Texas', 'Tennessee', 'Missouri']:array[unknown]) & NOT(ISIN(firstname, ['Jennifer', 'Julio', 'Johnson', 'Jameson', 'Michael', 'Robert']:array[unknown])), columns={'customerid': customerid}) + FILTER(condition=ISIN(UNMASK::(PTY_UNPROTECT([state], 'deAddress')), ['Georgia', 'Alabama', 'Mississippi', 'Arkansas', 'Louisiana', 'Florida', 'South Carolina', 'North Carolina', 'Texas', 'Tennessee', 'Missouri']:array[unknown]) & NOT(ISIN(UNMASK::(PTY_UNPROTECT([firstname], 'deName')), ['Jennifer', 'Julio', 'Johnson', 'Jameson', 'Michael', 'Robert']:array[unknown])), columns={'customerid': customerid}) SCAN(table=bodo.fsi.protected_customers, columns={'customerid': customerid, 'firstname': firstname, 'state': state}) diff --git a/tests/test_plan_refsols/fsi_accounts_customers_compound_c_raw.txt b/tests/test_plan_refsols/fsi_accounts_customers_compound_c_raw.txt index f7f6edaa1..6bc643316 100644 --- a/tests/test_plan_refsols/fsi_accounts_customers_compound_c_raw.txt +++ b/tests/test_plan_refsols/fsi_accounts_customers_compound_c_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=MONOTONIC('2020-01-31':string, createddate, '2020-03-13':string) | MONOTONIC('2022-12-25':string, createddate, '2023-01-15':string) | MONOTONIC('2024-08-04':string, createddate, '2024-11-08':string) | MONOTONIC('2025-06-07':string, createddate, '2026-03-07':string), columns={}) + FILTER(condition=MONOTONIC('2020-01-31':string, UNMASK::(PTY_UNPROTECT_DOB([createddate])), '2020-03-13':string) | MONOTONIC('2022-12-25':string, UNMASK::(PTY_UNPROTECT_DOB([createddate])), '2023-01-15':string) | MONOTONIC('2024-08-04':string, UNMASK::(PTY_UNPROTECT_DOB([createddate])), '2024-11-08':string) | MONOTONIC('2025-06-07':string, UNMASK::(PTY_UNPROTECT_DOB([createddate])), '2026-03-07':string), columns={}) SCAN(table=bodo.fsi.accounts, columns={'createddate': createddate}) diff --git a/tests/test_plan_refsols/fsi_accounts_customers_compound_c_rewrite.txt b/tests/test_plan_refsols/fsi_accounts_customers_compound_c_rewrite.txt index f7f6edaa1..6bc643316 100644 --- a/tests/test_plan_refsols/fsi_accounts_customers_compound_c_rewrite.txt +++ b/tests/test_plan_refsols/fsi_accounts_customers_compound_c_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=MONOTONIC('2020-01-31':string, createddate, '2020-03-13':string) | MONOTONIC('2022-12-25':string, createddate, '2023-01-15':string) | MONOTONIC('2024-08-04':string, createddate, '2024-11-08':string) | MONOTONIC('2025-06-07':string, createddate, '2026-03-07':string), columns={}) + FILTER(condition=MONOTONIC('2020-01-31':string, UNMASK::(PTY_UNPROTECT_DOB([createddate])), '2020-03-13':string) | MONOTONIC('2022-12-25':string, UNMASK::(PTY_UNPROTECT_DOB([createddate])), '2023-01-15':string) | MONOTONIC('2024-08-04':string, UNMASK::(PTY_UNPROTECT_DOB([createddate])), '2024-11-08':string) | MONOTONIC('2025-06-07':string, UNMASK::(PTY_UNPROTECT_DOB([createddate])), '2026-03-07':string), columns={}) SCAN(table=bodo.fsi.accounts, columns={'createddate': createddate}) diff --git a/tests/test_plan_refsols/fsi_accounts_partition_agg_raw.txt b/tests/test_plan_refsols/fsi_accounts_partition_agg_raw.txt index 98647c460..bf0df1600 100644 --- a/tests/test_plan_refsols/fsi_accounts_partition_agg_raw.txt +++ b/tests/test_plan_refsols/fsi_accounts_partition_agg_raw.txt @@ -1,3 +1,3 @@ -ROOT(columns=[('account_type', accounttype), ('n', n_rows), ('avg_bal', ROUND(avg_balance, 2:numeric))], orderings=[]) - AGGREGATE(keys={'accounttype': accounttype}, aggregations={'avg_balance': AVG(balance), 'n_rows': COUNT()}) +ROOT(columns=[('account_type', unmask_accounttype), ('n', n_rows), ('avg_bal', ROUND(avg_balance, 2:numeric))], orderings=[]) + AGGREGATE(keys={'unmask_accounttype': UNMASK::(PTY_UNPROTECT([accounttype], 'deAccount'))}, aggregations={'avg_balance': AVG(balance), 'n_rows': COUNT()}) SCAN(table=bodo.fsi.accounts, columns={'accounttype': accounttype, 'balance': balance}) diff --git a/tests/test_plan_refsols/fsi_accounts_partition_agg_rewrite.txt b/tests/test_plan_refsols/fsi_accounts_partition_agg_rewrite.txt index 98647c460..bf0df1600 100644 --- a/tests/test_plan_refsols/fsi_accounts_partition_agg_rewrite.txt +++ b/tests/test_plan_refsols/fsi_accounts_partition_agg_rewrite.txt @@ -1,3 +1,3 @@ -ROOT(columns=[('account_type', accounttype), ('n', n_rows), ('avg_bal', ROUND(avg_balance, 2:numeric))], orderings=[]) - AGGREGATE(keys={'accounttype': accounttype}, aggregations={'avg_balance': AVG(balance), 'n_rows': COUNT()}) +ROOT(columns=[('account_type', unmask_accounttype), ('n', n_rows), ('avg_bal', ROUND(avg_balance, 2:numeric))], orderings=[]) + AGGREGATE(keys={'unmask_accounttype': UNMASK::(PTY_UNPROTECT([accounttype], 'deAccount'))}, aggregations={'avg_balance': AVG(balance), 'n_rows': COUNT()}) SCAN(table=bodo.fsi.accounts, columns={'accounttype': accounttype, 'balance': balance}) diff --git a/tests/test_plan_refsols/fsi_best_account_customers_per_state_raw.txt b/tests/test_plan_refsols/fsi_best_account_customers_per_state_raw.txt index ae0782722..2f140e9be 100644 --- a/tests/test_plan_refsols/fsi_best_account_customers_per_state_raw.txt +++ b/tests/test_plan_refsols/fsi_best_account_customers_per_state_raw.txt @@ -1,9 +1,9 @@ -ROOT(columns=[('state', state), ('balance', balance), ('first_name', firstname), ('last_name', lastname)], orderings=[(state):asc_first]) - FILTER(condition=RANKING(args=[], partition=[state], order=[(balance):desc_first], allow_ties=False) == 1:numeric, columns={'balance': balance, 'firstname': firstname, 'lastname': lastname, 'state': state}) - JOIN(condition=t0.customerid == t1.customerid, type=INNER, cardinality=PLURAL_ACCESS, columns={'balance': t1.balance, 'firstname': t0.firstname, 'lastname': t0.lastname, 'state': t0.state}) - JOIN(condition=t0.state == t1.state, type=INNER, cardinality=PLURAL_FILTER, columns={'customerid': t1.customerid, 'firstname': t1.firstname, 'lastname': t1.lastname, 'state': t0.state}) - LIMIT(limit=5:numeric, columns={'state': state}, orderings=[(state):asc_first]) - AGGREGATE(keys={'state': state}, aggregations={}) +ROOT(columns=[('state', unmask_state), ('balance', balance), ('first_name', UNMASK::(PTY_UNPROTECT([firstname], 'deName'))), ('last_name', UNMASK::(PTY_UNPROTECT([lastname], 'deName')))], orderings=[(unmask_state):asc_first]) + FILTER(condition=RANKING(args=[], partition=[unmask_state], order=[(balance):desc_first], allow_ties=False) == 1:numeric, columns={'balance': balance, 'firstname': firstname, 'lastname': lastname, 'unmask_state': unmask_state}) + JOIN(condition=UNMASK::(PTY_UNPROTECT([t0.customerid], 'deAccount')) == UNMASK::(PTY_UNPROTECT_ACCOUNT([t1.customerid])), type=INNER, cardinality=PLURAL_ACCESS, columns={'balance': t1.balance, 'firstname': t0.firstname, 'lastname': t0.lastname, 'unmask_state': t0.unmask_state}) + JOIN(condition=t0.unmask_state == UNMASK::(PTY_UNPROTECT([t1.state], 'deAddress')), type=INNER, cardinality=PLURAL_FILTER, columns={'customerid': t1.customerid, 'firstname': t1.firstname, 'lastname': t1.lastname, 'unmask_state': t0.unmask_state}) + LIMIT(limit=5:numeric, columns={'unmask_state': unmask_state}, orderings=[(unmask_state):asc_first]) + AGGREGATE(keys={'unmask_state': UNMASK::(PTY_UNPROTECT([state], 'deAddress'))}, aggregations={}) SCAN(table=bodo.fsi.protected_customers, columns={'state': state}) SCAN(table=bodo.fsi.protected_customers, columns={'customerid': customerid, 'firstname': firstname, 'lastname': lastname, 'state': state}) SCAN(table=bodo.fsi.accounts, columns={'balance': balance, 'customerid': customerid}) diff --git a/tests/test_plan_refsols/fsi_best_account_customers_per_state_rewrite.txt b/tests/test_plan_refsols/fsi_best_account_customers_per_state_rewrite.txt index ae0782722..2f140e9be 100644 --- a/tests/test_plan_refsols/fsi_best_account_customers_per_state_rewrite.txt +++ b/tests/test_plan_refsols/fsi_best_account_customers_per_state_rewrite.txt @@ -1,9 +1,9 @@ -ROOT(columns=[('state', state), ('balance', balance), ('first_name', firstname), ('last_name', lastname)], orderings=[(state):asc_first]) - FILTER(condition=RANKING(args=[], partition=[state], order=[(balance):desc_first], allow_ties=False) == 1:numeric, columns={'balance': balance, 'firstname': firstname, 'lastname': lastname, 'state': state}) - JOIN(condition=t0.customerid == t1.customerid, type=INNER, cardinality=PLURAL_ACCESS, columns={'balance': t1.balance, 'firstname': t0.firstname, 'lastname': t0.lastname, 'state': t0.state}) - JOIN(condition=t0.state == t1.state, type=INNER, cardinality=PLURAL_FILTER, columns={'customerid': t1.customerid, 'firstname': t1.firstname, 'lastname': t1.lastname, 'state': t0.state}) - LIMIT(limit=5:numeric, columns={'state': state}, orderings=[(state):asc_first]) - AGGREGATE(keys={'state': state}, aggregations={}) +ROOT(columns=[('state', unmask_state), ('balance', balance), ('first_name', UNMASK::(PTY_UNPROTECT([firstname], 'deName'))), ('last_name', UNMASK::(PTY_UNPROTECT([lastname], 'deName')))], orderings=[(unmask_state):asc_first]) + FILTER(condition=RANKING(args=[], partition=[unmask_state], order=[(balance):desc_first], allow_ties=False) == 1:numeric, columns={'balance': balance, 'firstname': firstname, 'lastname': lastname, 'unmask_state': unmask_state}) + JOIN(condition=UNMASK::(PTY_UNPROTECT([t0.customerid], 'deAccount')) == UNMASK::(PTY_UNPROTECT_ACCOUNT([t1.customerid])), type=INNER, cardinality=PLURAL_ACCESS, columns={'balance': t1.balance, 'firstname': t0.firstname, 'lastname': t0.lastname, 'unmask_state': t0.unmask_state}) + JOIN(condition=t0.unmask_state == UNMASK::(PTY_UNPROTECT([t1.state], 'deAddress')), type=INNER, cardinality=PLURAL_FILTER, columns={'customerid': t1.customerid, 'firstname': t1.firstname, 'lastname': t1.lastname, 'unmask_state': t0.unmask_state}) + LIMIT(limit=5:numeric, columns={'unmask_state': unmask_state}, orderings=[(unmask_state):asc_first]) + AGGREGATE(keys={'unmask_state': UNMASK::(PTY_UNPROTECT([state], 'deAddress'))}, aggregations={}) SCAN(table=bodo.fsi.protected_customers, columns={'state': state}) SCAN(table=bodo.fsi.protected_customers, columns={'customerid': customerid, 'firstname': firstname, 'lastname': lastname, 'state': state}) SCAN(table=bodo.fsi.accounts, columns={'balance': balance, 'customerid': customerid}) diff --git a/tests/test_plan_refsols/fsi_customers_accounts_join_raw.txt b/tests/test_plan_refsols/fsi_customers_accounts_join_raw.txt index 82d3a2806..13aabee8c 100644 --- a/tests/test_plan_refsols/fsi_customers_accounts_join_raw.txt +++ b/tests/test_plan_refsols/fsi_customers_accounts_join_raw.txt @@ -1,6 +1,6 @@ ROOT(columns=[('num_customers_checking_accounts', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.customerid == t1.customerid, type=INNER, cardinality=PLURAL_FILTER, columns={}) + JOIN(condition=UNMASK::(PTY_UNPROTECT([t0.customerid], 'deAccount')) == UNMASK::(PTY_UNPROTECT_ACCOUNT([t1.customerid])), type=INNER, cardinality=PLURAL_FILTER, columns={}) SCAN(table=bodo.fsi.protected_customers, columns={'customerid': customerid}) - FILTER(condition=accounttype != 'checking':string, columns={'customerid': customerid}) + FILTER(condition=UNMASK::(PTY_UNPROTECT([accounttype], 'deAccount')) != 'checking':string, columns={'customerid': customerid}) SCAN(table=bodo.fsi.accounts, columns={'accounttype': accounttype, 'customerid': customerid}) diff --git a/tests/test_plan_refsols/fsi_customers_accounts_join_rewrite.txt b/tests/test_plan_refsols/fsi_customers_accounts_join_rewrite.txt index 82d3a2806..13aabee8c 100644 --- a/tests/test_plan_refsols/fsi_customers_accounts_join_rewrite.txt +++ b/tests/test_plan_refsols/fsi_customers_accounts_join_rewrite.txt @@ -1,6 +1,6 @@ ROOT(columns=[('num_customers_checking_accounts', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - JOIN(condition=t0.customerid == t1.customerid, type=INNER, cardinality=PLURAL_FILTER, columns={}) + JOIN(condition=UNMASK::(PTY_UNPROTECT([t0.customerid], 'deAccount')) == UNMASK::(PTY_UNPROTECT_ACCOUNT([t1.customerid])), type=INNER, cardinality=PLURAL_FILTER, columns={}) SCAN(table=bodo.fsi.protected_customers, columns={'customerid': customerid}) - FILTER(condition=accounttype != 'checking':string, columns={'customerid': customerid}) + FILTER(condition=UNMASK::(PTY_UNPROTECT([accounttype], 'deAccount')) != 'checking':string, columns={'customerid': customerid}) SCAN(table=bodo.fsi.accounts, columns={'accounttype': accounttype, 'customerid': customerid}) diff --git a/tests/test_plan_refsols/fsi_customers_filter_isin_raw.txt b/tests/test_plan_refsols/fsi_customers_filter_isin_raw.txt index 7c26a01ae..6629a23f5 100644 --- a/tests/test_plan_refsols/fsi_customers_filter_isin_raw.txt +++ b/tests/test_plan_refsols/fsi_customers_filter_isin_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ISIN(lastname, ['Barnes', 'Hernandez', 'Moore']:array[unknown]), columns={}) + FILTER(condition=ISIN(UNMASK::(PTY_UNPROTECT([lastname], 'deName')), ['Barnes', 'Hernandez', 'Moore']:array[unknown]), columns={}) SCAN(table=bodo.fsi.protected_customers, columns={'lastname': lastname}) diff --git a/tests/test_plan_refsols/fsi_customers_filter_isin_rewrite.txt b/tests/test_plan_refsols/fsi_customers_filter_isin_rewrite.txt index 7c26a01ae..6629a23f5 100644 --- a/tests/test_plan_refsols/fsi_customers_filter_isin_rewrite.txt +++ b/tests/test_plan_refsols/fsi_customers_filter_isin_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ISIN(lastname, ['Barnes', 'Hernandez', 'Moore']:array[unknown]), columns={}) + FILTER(condition=ISIN(UNMASK::(PTY_UNPROTECT([lastname], 'deName')), ['Barnes', 'Hernandez', 'Moore']:array[unknown]), columns={}) SCAN(table=bodo.fsi.protected_customers, columns={'lastname': lastname}) diff --git a/tests/test_plan_refsols/fsi_customers_filter_not_isin_raw.txt b/tests/test_plan_refsols/fsi_customers_filter_not_isin_raw.txt index 5920155e7..fe4f139f1 100644 --- a/tests/test_plan_refsols/fsi_customers_filter_not_isin_raw.txt +++ b/tests/test_plan_refsols/fsi_customers_filter_not_isin_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=NOT(ISIN(lastname, ['Barnes', 'Hernandez', 'Moore']:array[unknown])), columns={}) + FILTER(condition=NOT(ISIN(UNMASK::(PTY_UNPROTECT([lastname], 'deName')), ['Barnes', 'Hernandez', 'Moore']:array[unknown])), columns={}) SCAN(table=bodo.fsi.protected_customers, columns={'lastname': lastname}) diff --git a/tests/test_plan_refsols/fsi_customers_filter_not_isin_rewrite.txt b/tests/test_plan_refsols/fsi_customers_filter_not_isin_rewrite.txt index 5920155e7..fe4f139f1 100644 --- a/tests/test_plan_refsols/fsi_customers_filter_not_isin_rewrite.txt +++ b/tests/test_plan_refsols/fsi_customers_filter_not_isin_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=NOT(ISIN(lastname, ['Barnes', 'Hernandez', 'Moore']:array[unknown])), columns={}) + FILTER(condition=NOT(ISIN(UNMASK::(PTY_UNPROTECT([lastname], 'deName')), ['Barnes', 'Hernandez', 'Moore']:array[unknown])), columns={}) SCAN(table=bodo.fsi.protected_customers, columns={'lastname': lastname}) diff --git a/tests/test_plan_refsols/fsi_scan_topk_raw.txt b/tests/test_plan_refsols/fsi_scan_topk_raw.txt index df174be7d..7cdb1ce13 100644 --- a/tests/test_plan_refsols/fsi_scan_topk_raw.txt +++ b/tests/test_plan_refsols/fsi_scan_topk_raw.txt @@ -1,2 +1,2 @@ -ROOT(columns=[('first_name', firstname), ('last_name', lastname), ('city', city), ('zipcode', zipcode), ('date_of_birth', dob)], orderings=[(lastname):asc_first], limit=5:numeric) +ROOT(columns=[('first_name', UNMASK::(PTY_UNPROTECT([firstname], 'deName'))), ('last_name', UNMASK::(PTY_UNPROTECT([lastname], 'deName'))), ('city', UNMASK::(PTY_UNPROTECT_ADDRESS([city]))), ('zipcode', zipcode), ('date_of_birth', UNMASK::(PTY_UNPROTECT([dob], 'deDOB')))], orderings=[(UNMASK::(PTY_UNPROTECT([lastname], 'deName'))):asc_first], limit=5:numeric) SCAN(table=bodo.fsi.protected_customers, columns={'city': city, 'dob': dob, 'firstname': firstname, 'lastname': lastname, 'zipcode': zipcode}) diff --git a/tests/test_plan_refsols/fsi_scan_topk_rewrite.txt b/tests/test_plan_refsols/fsi_scan_topk_rewrite.txt index df174be7d..7cdb1ce13 100644 --- a/tests/test_plan_refsols/fsi_scan_topk_rewrite.txt +++ b/tests/test_plan_refsols/fsi_scan_topk_rewrite.txt @@ -1,2 +1,2 @@ -ROOT(columns=[('first_name', firstname), ('last_name', lastname), ('city', city), ('zipcode', zipcode), ('date_of_birth', dob)], orderings=[(lastname):asc_first], limit=5:numeric) +ROOT(columns=[('first_name', UNMASK::(PTY_UNPROTECT([firstname], 'deName'))), ('last_name', UNMASK::(PTY_UNPROTECT([lastname], 'deName'))), ('city', UNMASK::(PTY_UNPROTECT_ADDRESS([city]))), ('zipcode', zipcode), ('date_of_birth', UNMASK::(PTY_UNPROTECT([dob], 'deDOB')))], orderings=[(UNMASK::(PTY_UNPROTECT([lastname], 'deName'))):asc_first], limit=5:numeric) SCAN(table=bodo.fsi.protected_customers, columns={'city': city, 'dob': dob, 'firstname': firstname, 'lastname': lastname, 'zipcode': zipcode}) diff --git a/tests/test_plan_refsols/health_claim_scan_topk_raw.txt b/tests/test_plan_refsols/health_claim_scan_topk_raw.txt index 60935be3a..542540042 100644 --- a/tests/test_plan_refsols/health_claim_scan_topk_raw.txt +++ b/tests/test_plan_refsols/health_claim_scan_topk_raw.txt @@ -1,2 +1,2 @@ -ROOT(columns=[('key', claim_id), ('patient_key', patient_id), ('claim_date', claim_date), ('provider_name', provider_name), ('diagnosis_code', diagnosis_code), ('procedure_code', procedure_code), ('claim_amount', claim_amount), ('approved_amount', approved_amount), ('claim_status', claim_status)], orderings=[(claim_amount):desc_last], limit=2:numeric) +ROOT(columns=[('key', claim_id), ('patient_key', UNMASK::(PTY_UNPROTECT([patient_id], 'deAccount'))), ('claim_date', UNMASK::(PTY_UNPROTECT_DOB([claim_date]))), ('provider_name', UNMASK::(PTY_UNPROTECT([provider_name], 'deName'))), ('diagnosis_code', diagnosis_code), ('procedure_code', procedure_code), ('claim_amount', claim_amount), ('approved_amount', approved_amount), ('claim_status', UNMASK::(PTY_UNPROTECT([claim_status], 'deAccount')))], orderings=[(claim_amount):desc_last], limit=2:numeric) SCAN(table=bodo.health.claims, columns={'approved_amount': approved_amount, 'claim_amount': claim_amount, 'claim_date': claim_date, 'claim_id': claim_id, 'claim_status': claim_status, 'diagnosis_code': diagnosis_code, 'patient_id': patient_id, 'procedure_code': procedure_code, 'provider_name': provider_name}) diff --git a/tests/test_plan_refsols/health_claim_scan_topk_rewrite.txt b/tests/test_plan_refsols/health_claim_scan_topk_rewrite.txt index 60935be3a..542540042 100644 --- a/tests/test_plan_refsols/health_claim_scan_topk_rewrite.txt +++ b/tests/test_plan_refsols/health_claim_scan_topk_rewrite.txt @@ -1,2 +1,2 @@ -ROOT(columns=[('key', claim_id), ('patient_key', patient_id), ('claim_date', claim_date), ('provider_name', provider_name), ('diagnosis_code', diagnosis_code), ('procedure_code', procedure_code), ('claim_amount', claim_amount), ('approved_amount', approved_amount), ('claim_status', claim_status)], orderings=[(claim_amount):desc_last], limit=2:numeric) +ROOT(columns=[('key', claim_id), ('patient_key', UNMASK::(PTY_UNPROTECT([patient_id], 'deAccount'))), ('claim_date', UNMASK::(PTY_UNPROTECT_DOB([claim_date]))), ('provider_name', UNMASK::(PTY_UNPROTECT([provider_name], 'deName'))), ('diagnosis_code', diagnosis_code), ('procedure_code', procedure_code), ('claim_amount', claim_amount), ('approved_amount', approved_amount), ('claim_status', UNMASK::(PTY_UNPROTECT([claim_status], 'deAccount')))], orderings=[(claim_amount):desc_last], limit=2:numeric) SCAN(table=bodo.health.claims, columns={'approved_amount': approved_amount, 'claim_amount': claim_amount, 'claim_date': claim_date, 'claim_id': claim_id, 'claim_status': claim_status, 'diagnosis_code': diagnosis_code, 'patient_id': patient_id, 'procedure_code': procedure_code, 'provider_name': provider_name}) diff --git a/tests/test_plan_refsols/health_claims_filter_day_raw.txt b/tests/test_plan_refsols/health_claims_filter_day_raw.txt index d66577041..5541f71b5 100644 --- a/tests/test_plan_refsols/health_claims_filter_day_raw.txt +++ b/tests/test_plan_refsols/health_claims_filter_day_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=DAY(claim_date) == 31:numeric, columns={}) + FILTER(condition=DAY(UNMASK::(PTY_UNPROTECT_DOB([claim_date]))) == 31:numeric, columns={}) SCAN(table=bodo.health.claims, columns={'claim_date': claim_date}) diff --git a/tests/test_plan_refsols/health_claims_filter_day_rewrite.txt b/tests/test_plan_refsols/health_claims_filter_day_rewrite.txt index d66577041..5541f71b5 100644 --- a/tests/test_plan_refsols/health_claims_filter_day_rewrite.txt +++ b/tests/test_plan_refsols/health_claims_filter_day_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=DAY(claim_date) == 31:numeric, columns={}) + FILTER(condition=DAY(UNMASK::(PTY_UNPROTECT_DOB([claim_date]))) == 31:numeric, columns={}) SCAN(table=bodo.health.claims, columns={'claim_date': claim_date}) diff --git a/tests/test_plan_refsols/health_claims_filter_month_raw.txt b/tests/test_plan_refsols/health_claims_filter_month_raw.txt index ef3c91d5e..afbe605f8 100644 --- a/tests/test_plan_refsols/health_claims_filter_month_raw.txt +++ b/tests/test_plan_refsols/health_claims_filter_month_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=MONTH(claim_date) == 12:numeric, columns={}) + FILTER(condition=MONTH(UNMASK::(PTY_UNPROTECT_DOB([claim_date]))) == 12:numeric, columns={}) SCAN(table=bodo.health.claims, columns={'claim_date': claim_date}) diff --git a/tests/test_plan_refsols/health_claims_filter_month_rewrite.txt b/tests/test_plan_refsols/health_claims_filter_month_rewrite.txt index ef3c91d5e..afbe605f8 100644 --- a/tests/test_plan_refsols/health_claims_filter_month_rewrite.txt +++ b/tests/test_plan_refsols/health_claims_filter_month_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=MONTH(claim_date) == 12:numeric, columns={}) + FILTER(condition=MONTH(UNMASK::(PTY_UNPROTECT_DOB([claim_date]))) == 12:numeric, columns={}) SCAN(table=bodo.health.claims, columns={'claim_date': claim_date}) diff --git a/tests/test_plan_refsols/health_claims_filter_year_raw.txt b/tests/test_plan_refsols/health_claims_filter_year_raw.txt index 7eb1663d0..2e8b1b757 100644 --- a/tests/test_plan_refsols/health_claims_filter_year_raw.txt +++ b/tests/test_plan_refsols/health_claims_filter_year_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=YEAR(claim_date) > 2020:numeric, columns={}) + FILTER(condition=YEAR(UNMASK::(PTY_UNPROTECT_DOB([claim_date]))) > 2020:numeric, columns={}) SCAN(table=bodo.health.claims, columns={'claim_date': claim_date}) diff --git a/tests/test_plan_refsols/health_claims_filter_year_rewrite.txt b/tests/test_plan_refsols/health_claims_filter_year_rewrite.txt index 7eb1663d0..2e8b1b757 100644 --- a/tests/test_plan_refsols/health_claims_filter_year_rewrite.txt +++ b/tests/test_plan_refsols/health_claims_filter_year_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=YEAR(claim_date) > 2020:numeric, columns={}) + FILTER(condition=YEAR(UNMASK::(PTY_UNPROTECT_DOB([claim_date]))) > 2020:numeric, columns={}) SCAN(table=bodo.health.claims, columns={'claim_date': claim_date}) diff --git a/tests/test_plan_refsols/health_first_patient_by_coverage_type_raw.txt b/tests/test_plan_refsols/health_first_patient_by_coverage_type_raw.txt index d8f0169a4..0a1a54739 100644 --- a/tests/test_plan_refsols/health_first_patient_by_coverage_type_raw.txt +++ b/tests/test_plan_refsols/health_first_patient_by_coverage_type_raw.txt @@ -1,10 +1,10 @@ -ROOT(columns=[('coverage_type', coverage_type), ('first_name', max_anything_first_name), ('last_name', max_anything_last_name), ('date_of_birth', max_anything_date_of_birth)], orderings=[(coverage_type):asc_first]) - FILTER(condition=sum_n_rows > 0:numeric, columns={'coverage_type': coverage_type, 'max_anything_date_of_birth': max_anything_date_of_birth, 'max_anything_first_name': max_anything_first_name, 'max_anything_last_name': max_anything_last_name}) - AGGREGATE(keys={'coverage_type': coverage_type}, aggregations={'max_anything_date_of_birth': MAX(anything_date_of_birth), 'max_anything_first_name': MAX(anything_first_name), 'max_anything_last_name': MAX(anything_last_name), 'sum_n_rows': SUM(n_rows)}) - JOIN(condition=t0.insurance_plan_id == t1.insurance_plan_id, type=LEFT, cardinality=SINGULAR_FILTER, columns={'anything_date_of_birth': t1.anything_date_of_birth, 'anything_first_name': t1.anything_first_name, 'anything_last_name': t1.anything_last_name, 'coverage_type': t0.coverage_type, 'n_rows': t1.n_rows}) +ROOT(columns=[('coverage_type', coverage_type), ('first_name', max_anything_unmask_first_name), ('last_name', max_anything_unmask_last_name), ('date_of_birth', max_anything_unmask_date_of_birth)], orderings=[(coverage_type):asc_first]) + FILTER(condition=sum_n_rows > 0:numeric, columns={'coverage_type': coverage_type, 'max_anything_unmask_date_of_birth': max_anything_unmask_date_of_birth, 'max_anything_unmask_first_name': max_anything_unmask_first_name, 'max_anything_unmask_last_name': max_anything_unmask_last_name}) + AGGREGATE(keys={'coverage_type': coverage_type}, aggregations={'max_anything_unmask_date_of_birth': MAX(anything_unmask_date_of_birth), 'max_anything_unmask_first_name': MAX(anything_unmask_first_name), 'max_anything_unmask_last_name': MAX(anything_unmask_last_name), 'sum_n_rows': SUM(n_rows)}) + JOIN(condition=t0.insurance_plan_id == t1.insurance_plan_id, type=LEFT, cardinality=SINGULAR_FILTER, columns={'anything_unmask_date_of_birth': t1.anything_unmask_date_of_birth, 'anything_unmask_first_name': t1.anything_unmask_first_name, 'anything_unmask_last_name': t1.anything_unmask_last_name, 'coverage_type': t0.coverage_type, 'n_rows': t1.n_rows}) SCAN(table=bodo.health.insurance_plans, columns={'coverage_type': coverage_type, 'insurance_plan_id': insurance_plan_id}) - AGGREGATE(keys={'insurance_plan_id': insurance_plan_id}, aggregations={'anything_date_of_birth': ANYTHING(date_of_birth), 'anything_first_name': ANYTHING(first_name), 'anything_last_name': ANYTHING(last_name), 'n_rows': COUNT()}) - FILTER(condition=RANKING(args=[], partition=[coverage_type], order=[(date_of_birth):asc_last, (patient_id):asc_last], allow_ties=False) == 1:numeric, columns={'date_of_birth': date_of_birth, 'first_name': first_name, 'insurance_plan_id': insurance_plan_id, 'last_name': last_name}) + AGGREGATE(keys={'insurance_plan_id': insurance_plan_id}, aggregations={'anything_unmask_date_of_birth': ANYTHING(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))), 'anything_unmask_first_name': ANYTHING(UNMASK::(PTY_UNPROTECT_NAME([first_name]))), 'anything_unmask_last_name': ANYTHING(UNMASK::(PTY_UNPROTECT([last_name], 'deName'))), 'n_rows': COUNT()}) + FILTER(condition=RANKING(args=[], partition=[coverage_type], order=[(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))):asc_last, (UNMASK::(PTY_UNPROTECT_ACCOUNT([patient_id]))):asc_last], allow_ties=False) == 1:numeric, columns={'date_of_birth': date_of_birth, 'first_name': first_name, 'insurance_plan_id': insurance_plan_id, 'last_name': last_name}) JOIN(condition=t0.insurance_plan_id == t1.insurance_plan_id, type=INNER, cardinality=PLURAL_ACCESS, columns={'coverage_type': t0.coverage_type, 'date_of_birth': t1.date_of_birth, 'first_name': t1.first_name, 'insurance_plan_id': t0.insurance_plan_id, 'last_name': t1.last_name, 'patient_id': t1.patient_id}) SCAN(table=bodo.health.insurance_plans, columns={'coverage_type': coverage_type, 'insurance_plan_id': insurance_plan_id}) SCAN(table=bodo.health.protected_patients, columns={'date_of_birth': date_of_birth, 'first_name': first_name, 'insurance_plan_id': insurance_plan_id, 'last_name': last_name, 'patient_id': patient_id}) diff --git a/tests/test_plan_refsols/health_first_patient_by_coverage_type_rewrite.txt b/tests/test_plan_refsols/health_first_patient_by_coverage_type_rewrite.txt index d8f0169a4..0a1a54739 100644 --- a/tests/test_plan_refsols/health_first_patient_by_coverage_type_rewrite.txt +++ b/tests/test_plan_refsols/health_first_patient_by_coverage_type_rewrite.txt @@ -1,10 +1,10 @@ -ROOT(columns=[('coverage_type', coverage_type), ('first_name', max_anything_first_name), ('last_name', max_anything_last_name), ('date_of_birth', max_anything_date_of_birth)], orderings=[(coverage_type):asc_first]) - FILTER(condition=sum_n_rows > 0:numeric, columns={'coverage_type': coverage_type, 'max_anything_date_of_birth': max_anything_date_of_birth, 'max_anything_first_name': max_anything_first_name, 'max_anything_last_name': max_anything_last_name}) - AGGREGATE(keys={'coverage_type': coverage_type}, aggregations={'max_anything_date_of_birth': MAX(anything_date_of_birth), 'max_anything_first_name': MAX(anything_first_name), 'max_anything_last_name': MAX(anything_last_name), 'sum_n_rows': SUM(n_rows)}) - JOIN(condition=t0.insurance_plan_id == t1.insurance_plan_id, type=LEFT, cardinality=SINGULAR_FILTER, columns={'anything_date_of_birth': t1.anything_date_of_birth, 'anything_first_name': t1.anything_first_name, 'anything_last_name': t1.anything_last_name, 'coverage_type': t0.coverage_type, 'n_rows': t1.n_rows}) +ROOT(columns=[('coverage_type', coverage_type), ('first_name', max_anything_unmask_first_name), ('last_name', max_anything_unmask_last_name), ('date_of_birth', max_anything_unmask_date_of_birth)], orderings=[(coverage_type):asc_first]) + FILTER(condition=sum_n_rows > 0:numeric, columns={'coverage_type': coverage_type, 'max_anything_unmask_date_of_birth': max_anything_unmask_date_of_birth, 'max_anything_unmask_first_name': max_anything_unmask_first_name, 'max_anything_unmask_last_name': max_anything_unmask_last_name}) + AGGREGATE(keys={'coverage_type': coverage_type}, aggregations={'max_anything_unmask_date_of_birth': MAX(anything_unmask_date_of_birth), 'max_anything_unmask_first_name': MAX(anything_unmask_first_name), 'max_anything_unmask_last_name': MAX(anything_unmask_last_name), 'sum_n_rows': SUM(n_rows)}) + JOIN(condition=t0.insurance_plan_id == t1.insurance_plan_id, type=LEFT, cardinality=SINGULAR_FILTER, columns={'anything_unmask_date_of_birth': t1.anything_unmask_date_of_birth, 'anything_unmask_first_name': t1.anything_unmask_first_name, 'anything_unmask_last_name': t1.anything_unmask_last_name, 'coverage_type': t0.coverage_type, 'n_rows': t1.n_rows}) SCAN(table=bodo.health.insurance_plans, columns={'coverage_type': coverage_type, 'insurance_plan_id': insurance_plan_id}) - AGGREGATE(keys={'insurance_plan_id': insurance_plan_id}, aggregations={'anything_date_of_birth': ANYTHING(date_of_birth), 'anything_first_name': ANYTHING(first_name), 'anything_last_name': ANYTHING(last_name), 'n_rows': COUNT()}) - FILTER(condition=RANKING(args=[], partition=[coverage_type], order=[(date_of_birth):asc_last, (patient_id):asc_last], allow_ties=False) == 1:numeric, columns={'date_of_birth': date_of_birth, 'first_name': first_name, 'insurance_plan_id': insurance_plan_id, 'last_name': last_name}) + AGGREGATE(keys={'insurance_plan_id': insurance_plan_id}, aggregations={'anything_unmask_date_of_birth': ANYTHING(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))), 'anything_unmask_first_name': ANYTHING(UNMASK::(PTY_UNPROTECT_NAME([first_name]))), 'anything_unmask_last_name': ANYTHING(UNMASK::(PTY_UNPROTECT([last_name], 'deName'))), 'n_rows': COUNT()}) + FILTER(condition=RANKING(args=[], partition=[coverage_type], order=[(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))):asc_last, (UNMASK::(PTY_UNPROTECT_ACCOUNT([patient_id]))):asc_last], allow_ties=False) == 1:numeric, columns={'date_of_birth': date_of_birth, 'first_name': first_name, 'insurance_plan_id': insurance_plan_id, 'last_name': last_name}) JOIN(condition=t0.insurance_plan_id == t1.insurance_plan_id, type=INNER, cardinality=PLURAL_ACCESS, columns={'coverage_type': t0.coverage_type, 'date_of_birth': t1.date_of_birth, 'first_name': t1.first_name, 'insurance_plan_id': t0.insurance_plan_id, 'last_name': t1.last_name, 'patient_id': t1.patient_id}) SCAN(table=bodo.health.insurance_plans, columns={'coverage_type': coverage_type, 'insurance_plan_id': insurance_plan_id}) SCAN(table=bodo.health.protected_patients, columns={'date_of_birth': date_of_birth, 'first_name': first_name, 'insurance_plan_id': insurance_plan_id, 'last_name': last_name, 'patient_id': patient_id}) diff --git a/tests/test_plan_refsols/health_patients_filter_absent_raw.txt b/tests/test_plan_refsols/health_patients_filter_absent_raw.txt index 3a0fda382..8ffbd3649 100644 --- a/tests/test_plan_refsols/health_patients_filter_absent_raw.txt +++ b/tests/test_plan_refsols/health_patients_filter_absent_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ABSENT(date_of_birth) | date_of_birth > '2003-06-29':string, columns={}) + FILTER(condition=ABSENT(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))) | UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) > '2003-06-29':string, columns={}) SCAN(table=bodo.health.protected_patients, columns={'date_of_birth': date_of_birth}) diff --git a/tests/test_plan_refsols/health_patients_filter_absent_rewrite.txt b/tests/test_plan_refsols/health_patients_filter_absent_rewrite.txt index 3a0fda382..8ffbd3649 100644 --- a/tests/test_plan_refsols/health_patients_filter_absent_rewrite.txt +++ b/tests/test_plan_refsols/health_patients_filter_absent_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ABSENT(date_of_birth) | date_of_birth > '2003-06-29':string, columns={}) + FILTER(condition=ABSENT(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))) | UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) > '2003-06-29':string, columns={}) SCAN(table=bodo.health.protected_patients, columns={'date_of_birth': date_of_birth}) diff --git a/tests/test_plan_refsols/health_patients_filter_endswith_raw.txt b/tests/test_plan_refsols/health_patients_filter_endswith_raw.txt index ea2743d28..0e2afb69c 100644 --- a/tests/test_plan_refsols/health_patients_filter_endswith_raw.txt +++ b/tests/test_plan_refsols/health_patients_filter_endswith_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ENDSWITH(email, 'gmail.com':string), columns={}) + FILTER(condition=ENDSWITH(UNMASK::(PTY_UNPROTECT([email], 'deEmail')), 'gmail.com':string), columns={}) SCAN(table=bodo.health.protected_patients, columns={'email': email}) diff --git a/tests/test_plan_refsols/health_patients_filter_endswith_rewrite.txt b/tests/test_plan_refsols/health_patients_filter_endswith_rewrite.txt index ea2743d28..0e2afb69c 100644 --- a/tests/test_plan_refsols/health_patients_filter_endswith_rewrite.txt +++ b/tests/test_plan_refsols/health_patients_filter_endswith_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ENDSWITH(email, 'gmail.com':string), columns={}) + FILTER(condition=ENDSWITH(UNMASK::(PTY_UNPROTECT([email], 'deEmail')), 'gmail.com':string), columns={}) SCAN(table=bodo.health.protected_patients, columns={'email': email}) diff --git a/tests/test_plan_refsols/health_patients_filter_startswith_raw.txt b/tests/test_plan_refsols/health_patients_filter_startswith_raw.txt index 1df7d8bc9..8eb19eabf 100644 --- a/tests/test_plan_refsols/health_patients_filter_startswith_raw.txt +++ b/tests/test_plan_refsols/health_patients_filter_startswith_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=STARTSWITH(phone_number, '001':string), columns={}) + FILTER(condition=STARTSWITH(UNMASK::(PTY_UNPROTECT([phone_number], 'dePhone')), '001':string), columns={}) SCAN(table=bodo.health.protected_patients, columns={'phone_number': phone_number}) diff --git a/tests/test_plan_refsols/health_patients_filter_startswith_rewrite.txt b/tests/test_plan_refsols/health_patients_filter_startswith_rewrite.txt index 1df7d8bc9..8eb19eabf 100644 --- a/tests/test_plan_refsols/health_patients_filter_startswith_rewrite.txt +++ b/tests/test_plan_refsols/health_patients_filter_startswith_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=STARTSWITH(phone_number, '001':string), columns={}) + FILTER(condition=STARTSWITH(UNMASK::(PTY_UNPROTECT([phone_number], 'dePhone')), '001':string), columns={}) SCAN(table=bodo.health.protected_patients, columns={'phone_number': phone_number}) diff --git a/tests/test_plan_refsols/retail_members_agg_best_raw.txt b/tests/test_plan_refsols/retail_members_agg_best_raw.txt index 7ac0c91f3..5be82292c 100644 --- a/tests/test_plan_refsols/retail_members_agg_best_raw.txt +++ b/tests/test_plan_refsols/retail_members_agg_best_raw.txt @@ -1,5 +1,5 @@ -ROOT(columns=[('store_location', store_location), ('total_amount', total_amount), ('name', JOIN_STRINGS(' ':string, first_name, last_name))], orderings=[(total_amount):desc_last], limit=5:numeric) - FILTER(condition=RANKING(args=[], partition=[store_location], order=[(total_amount):desc_first], allow_ties=False) == 1:numeric, columns={'first_name': first_name, 'last_name': last_name, 'store_location': store_location, 'total_amount': total_amount}) +ROOT(columns=[('store_location', UNMASK::(PTY_UNPROTECT_ADDRESS([store_location]))), ('total_amount', total_amount), ('name', JOIN_STRINGS(' ':string, UNMASK::(PTY_UNPROTECT([first_name], 'deName')), UNMASK::(PTY_UNPROTECT_NAME([last_name]))))], orderings=[(total_amount):desc_last], limit=5:numeric) + FILTER(condition=RANKING(args=[], partition=[UNMASK::(PTY_UNPROTECT_ADDRESS([store_location]))], order=[(total_amount):desc_first], allow_ties=False) == 1:numeric, columns={'first_name': first_name, 'last_name': last_name, 'store_location': store_location, 'total_amount': total_amount}) JOIN(condition=t0.customer_id == t1.customer_id, type=INNER, cardinality=SINGULAR_ACCESS, columns={'first_name': t1.first_name, 'last_name': t1.last_name, 'store_location': t0.store_location, 'total_amount': t0.total_amount}) SCAN(table=bodo.retail.transactions, columns={'customer_id': customer_id, 'store_location': store_location, 'total_amount': total_amount}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'customer_id': customer_id, 'first_name': first_name, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_agg_best_rewrite.txt b/tests/test_plan_refsols/retail_members_agg_best_rewrite.txt index 7ac0c91f3..5be82292c 100644 --- a/tests/test_plan_refsols/retail_members_agg_best_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_agg_best_rewrite.txt @@ -1,5 +1,5 @@ -ROOT(columns=[('store_location', store_location), ('total_amount', total_amount), ('name', JOIN_STRINGS(' ':string, first_name, last_name))], orderings=[(total_amount):desc_last], limit=5:numeric) - FILTER(condition=RANKING(args=[], partition=[store_location], order=[(total_amount):desc_first], allow_ties=False) == 1:numeric, columns={'first_name': first_name, 'last_name': last_name, 'store_location': store_location, 'total_amount': total_amount}) +ROOT(columns=[('store_location', UNMASK::(PTY_UNPROTECT_ADDRESS([store_location]))), ('total_amount', total_amount), ('name', JOIN_STRINGS(' ':string, UNMASK::(PTY_UNPROTECT([first_name], 'deName')), UNMASK::(PTY_UNPROTECT_NAME([last_name]))))], orderings=[(total_amount):desc_last], limit=5:numeric) + FILTER(condition=RANKING(args=[], partition=[UNMASK::(PTY_UNPROTECT_ADDRESS([store_location]))], order=[(total_amount):desc_first], allow_ties=False) == 1:numeric, columns={'first_name': first_name, 'last_name': last_name, 'store_location': store_location, 'total_amount': total_amount}) JOIN(condition=t0.customer_id == t1.customer_id, type=INNER, cardinality=SINGULAR_ACCESS, columns={'first_name': t1.first_name, 'last_name': t1.last_name, 'store_location': t0.store_location, 'total_amount': t0.total_amount}) SCAN(table=bodo.retail.transactions, columns={'customer_id': customer_id, 'store_location': store_location, 'total_amount': total_amount}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'customer_id': customer_id, 'first_name': first_name, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_agg_raw.txt b/tests/test_plan_refsols/retail_members_agg_raw.txt index fa934aaae..7c1ce7880 100644 --- a/tests/test_plan_refsols/retail_members_agg_raw.txt +++ b/tests/test_plan_refsols/retail_members_agg_raw.txt @@ -1,6 +1,6 @@ ROOT(columns=[('avg_secs', ROUND(avg_expr, 2:numeric))], orderings=[]) - AGGREGATE(keys={}, aggregations={'avg_expr': AVG(DATEDIFF('seconds':string, join_date, min_transaction_date))}) - JOIN(condition=t0.customer_id == t1.customer_id, type=LEFT, cardinality=SINGULAR_FILTER, columns={'join_date': t0.join_date, 'min_transaction_date': t1.min_transaction_date}) + AGGREGATE(keys={}, aggregations={'avg_expr': AVG(DATEDIFF('seconds':string, join_date, min_unmask_transaction_date))}) + JOIN(condition=t0.customer_id == t1.customer_id, type=LEFT, cardinality=SINGULAR_FILTER, columns={'join_date': t0.join_date, 'min_unmask_transaction_date': t1.min_unmask_transaction_date}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'customer_id': customer_id, 'join_date': join_date}) - AGGREGATE(keys={'customer_id': customer_id}, aggregations={'min_transaction_date': MIN(transaction_date)}) + AGGREGATE(keys={'customer_id': customer_id}, aggregations={'min_unmask_transaction_date': MIN(UNMASK::(PTY_UNPROTECT_TS([transaction_date])))}) SCAN(table=bodo.retail.transactions, columns={'customer_id': customer_id, 'transaction_date': transaction_date}) diff --git a/tests/test_plan_refsols/retail_members_agg_rewrite.txt b/tests/test_plan_refsols/retail_members_agg_rewrite.txt index fa934aaae..7c1ce7880 100644 --- a/tests/test_plan_refsols/retail_members_agg_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_agg_rewrite.txt @@ -1,6 +1,6 @@ ROOT(columns=[('avg_secs', ROUND(avg_expr, 2:numeric))], orderings=[]) - AGGREGATE(keys={}, aggregations={'avg_expr': AVG(DATEDIFF('seconds':string, join_date, min_transaction_date))}) - JOIN(condition=t0.customer_id == t1.customer_id, type=LEFT, cardinality=SINGULAR_FILTER, columns={'join_date': t0.join_date, 'min_transaction_date': t1.min_transaction_date}) + AGGREGATE(keys={}, aggregations={'avg_expr': AVG(DATEDIFF('seconds':string, join_date, min_unmask_transaction_date))}) + JOIN(condition=t0.customer_id == t1.customer_id, type=LEFT, cardinality=SINGULAR_FILTER, columns={'join_date': t0.join_date, 'min_unmask_transaction_date': t1.min_unmask_transaction_date}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'customer_id': customer_id, 'join_date': join_date}) - AGGREGATE(keys={'customer_id': customer_id}, aggregations={'min_transaction_date': MIN(transaction_date)}) + AGGREGATE(keys={'customer_id': customer_id}, aggregations={'min_unmask_transaction_date': MIN(UNMASK::(PTY_UNPROTECT_TS([transaction_date])))}) SCAN(table=bodo.retail.transactions, columns={'customer_id': customer_id, 'transaction_date': transaction_date}) diff --git a/tests/test_plan_refsols/retail_members_compound_a_raw.txt b/tests/test_plan_refsols/retail_members_compound_a_raw.txt index 4a358fc93..f30c88a17 100644 --- a/tests/test_plan_refsols/retail_members_compound_a_raw.txt +++ b/tests/test_plan_refsols/retail_members_compound_a_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=date_of_birth >= datetime.date(2002, 1, 1):datetime & ISIN(last_name, ['Johnson', 'Robinson']:array[unknown]), columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) >= datetime.date(2002, 1, 1):datetime & ISIN(UNMASK::(PTY_UNPROTECT_NAME([last_name])), ['Johnson', 'Robinson']:array[unknown]), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_a_rewrite.txt b/tests/test_plan_refsols/retail_members_compound_a_rewrite.txt index 4a358fc93..f30c88a17 100644 --- a/tests/test_plan_refsols/retail_members_compound_a_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_compound_a_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=date_of_birth >= datetime.date(2002, 1, 1):datetime & ISIN(last_name, ['Johnson', 'Robinson']:array[unknown]), columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) >= datetime.date(2002, 1, 1):datetime & ISIN(UNMASK::(PTY_UNPROTECT_NAME([last_name])), ['Johnson', 'Robinson']:array[unknown]), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_b_raw.txt b/tests/test_plan_refsols/retail_members_compound_b_raw.txt index ebef671fd..81ca813f2 100644 --- a/tests/test_plan_refsols/retail_members_compound_b_raw.txt +++ b/tests/test_plan_refsols/retail_members_compound_b_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=last_name != 'Smith':string & date_of_birth == datetime.date(1979, 3, 7):datetime, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT_NAME([last_name])) != 'Smith':string & UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) == datetime.date(1979, 3, 7):datetime, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_b_rewrite.txt b/tests/test_plan_refsols/retail_members_compound_b_rewrite.txt index ebef671fd..81ca813f2 100644 --- a/tests/test_plan_refsols/retail_members_compound_b_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_compound_b_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=last_name != 'Smith':string & date_of_birth == datetime.date(1979, 3, 7):datetime, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT_NAME([last_name])) != 'Smith':string & UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) == datetime.date(1979, 3, 7):datetime, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_c_raw.txt b/tests/test_plan_refsols/retail_members_compound_c_raw.txt index eedc25720..e7a1a9561 100644 --- a/tests/test_plan_refsols/retail_members_compound_c_raw.txt +++ b/tests/test_plan_refsols/retail_members_compound_c_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=last_name < 'Cross':string & date_of_birth > datetime.date(1995, 12, 22):datetime, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT_NAME([last_name])) < 'Cross':string & UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) > datetime.date(1995, 12, 22):datetime, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_c_rewrite.txt b/tests/test_plan_refsols/retail_members_compound_c_rewrite.txt index eedc25720..e7a1a9561 100644 --- a/tests/test_plan_refsols/retail_members_compound_c_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_compound_c_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=last_name < 'Cross':string & date_of_birth > datetime.date(1995, 12, 22):datetime, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT_NAME([last_name])) < 'Cross':string & UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) > datetime.date(1995, 12, 22):datetime, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_d_raw.txt b/tests/test_plan_refsols/retail_members_compound_d_raw.txt index bbb45a1de..ebf048e36 100644 --- a/tests/test_plan_refsols/retail_members_compound_d_raw.txt +++ b/tests/test_plan_refsols/retail_members_compound_d_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=last_name <= 'Zuniga':string & date_of_birth >= datetime.date(2000, 1, 1):datetime, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT_NAME([last_name])) <= 'Zuniga':string & UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) >= datetime.date(2000, 1, 1):datetime, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_d_rewrite.txt b/tests/test_plan_refsols/retail_members_compound_d_rewrite.txt index bbb45a1de..ebf048e36 100644 --- a/tests/test_plan_refsols/retail_members_compound_d_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_compound_d_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=last_name <= 'Zuniga':string & date_of_birth >= datetime.date(2000, 1, 1):datetime, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT_NAME([last_name])) <= 'Zuniga':string & UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) >= datetime.date(2000, 1, 1):datetime, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_e_raw.txt b/tests/test_plan_refsols/retail_members_compound_e_raw.txt index 7a2660ed2..e14a2e9b0 100644 --- a/tests/test_plan_refsols/retail_members_compound_e_raw.txt +++ b/tests/test_plan_refsols/retail_members_compound_e_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=date_of_birth < datetime.date(1983, 1, 30):datetime & date_of_birth >= datetime.date(1983, 1, 10):datetime, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) < datetime.date(1983, 1, 30):datetime & UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) >= datetime.date(1983, 1, 10):datetime, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth}) diff --git a/tests/test_plan_refsols/retail_members_compound_e_rewrite.txt b/tests/test_plan_refsols/retail_members_compound_e_rewrite.txt index 7a2660ed2..e14a2e9b0 100644 --- a/tests/test_plan_refsols/retail_members_compound_e_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_compound_e_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=date_of_birth < datetime.date(1983, 1, 30):datetime & date_of_birth >= datetime.date(1983, 1, 10):datetime, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) < datetime.date(1983, 1, 30):datetime & UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) >= datetime.date(1983, 1, 10):datetime, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth}) diff --git a/tests/test_plan_refsols/retail_members_compound_f_raw.txt b/tests/test_plan_refsols/retail_members_compound_f_raw.txt index 106af2680..65af4ef09 100644 --- a/tests/test_plan_refsols/retail_members_compound_f_raw.txt +++ b/tests/test_plan_refsols/retail_members_compound_f_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=date_of_birth <= datetime.date(1976, 7, 28):datetime & date_of_birth > datetime.date(1976, 7, 1):datetime, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) <= datetime.date(1976, 7, 28):datetime & UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) > datetime.date(1976, 7, 1):datetime, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth}) diff --git a/tests/test_plan_refsols/retail_members_compound_f_rewrite.txt b/tests/test_plan_refsols/retail_members_compound_f_rewrite.txt index 106af2680..65af4ef09 100644 --- a/tests/test_plan_refsols/retail_members_compound_f_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_compound_f_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=date_of_birth <= datetime.date(1976, 7, 28):datetime & date_of_birth > datetime.date(1976, 7, 1):datetime, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) <= datetime.date(1976, 7, 28):datetime & UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) > datetime.date(1976, 7, 1):datetime, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth}) diff --git a/tests/test_plan_refsols/retail_members_compound_g_raw.txt b/tests/test_plan_refsols/retail_members_compound_g_raw.txt index 887d171c4..ab64fa711 100644 --- a/tests/test_plan_refsols/retail_members_compound_g_raw.txt +++ b/tests/test_plan_refsols/retail_members_compound_g_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=DAY(date_of_birth) <= 13:numeric & DAY(date_of_birth) > 3:numeric & ISIN(MONTH(date_of_birth), [1, 2, 5, 10, 12]:array[unknown]) & ISIN(YEAR(date_of_birth), [1960, 1970, 1980, 1990, 2000]:array[unknown]), columns={}) + FILTER(condition=DAY(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))) <= 13:numeric & DAY(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))) > 3:numeric & ISIN(MONTH(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))), [1, 2, 5, 10, 12]:array[unknown]) & ISIN(YEAR(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))), [1960, 1970, 1980, 1990, 2000]:array[unknown]), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth}) diff --git a/tests/test_plan_refsols/retail_members_compound_g_rewrite.txt b/tests/test_plan_refsols/retail_members_compound_g_rewrite.txt index 887d171c4..ab64fa711 100644 --- a/tests/test_plan_refsols/retail_members_compound_g_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_compound_g_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=DAY(date_of_birth) <= 13:numeric & DAY(date_of_birth) > 3:numeric & ISIN(MONTH(date_of_birth), [1, 2, 5, 10, 12]:array[unknown]) & ISIN(YEAR(date_of_birth), [1960, 1970, 1980, 1990, 2000]:array[unknown]), columns={}) + FILTER(condition=DAY(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))) <= 13:numeric & DAY(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))) > 3:numeric & ISIN(MONTH(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))), [1, 2, 5, 10, 12]:array[unknown]) & ISIN(YEAR(UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB'))), [1960, 1970, 1980, 1990, 2000]:array[unknown]), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth}) diff --git a/tests/test_plan_refsols/retail_members_compound_h_raw.txt b/tests/test_plan_refsols/retail_members_compound_h_raw.txt index 46672758f..88edd4783 100644 --- a/tests/test_plan_refsols/retail_members_compound_h_raw.txt +++ b/tests/test_plan_refsols/retail_members_compound_h_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=date_of_birth < datetime.date(2007, 1, 1):datetime & last_name >= 'Cross':string, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) < datetime.date(2007, 1, 1):datetime & UNMASK::(PTY_UNPROTECT_NAME([last_name])) >= 'Cross':string, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_h_rewrite.txt b/tests/test_plan_refsols/retail_members_compound_h_rewrite.txt index 46672758f..88edd4783 100644 --- a/tests/test_plan_refsols/retail_members_compound_h_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_compound_h_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=date_of_birth < datetime.date(2007, 1, 1):datetime & last_name >= 'Cross':string, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT([date_of_birth], 'deDOB')) < datetime.date(2007, 1, 1):datetime & UNMASK::(PTY_UNPROTECT_NAME([last_name])) >= 'Cross':string, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'date_of_birth': date_of_birth, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_i_raw.txt b/tests/test_plan_refsols/retail_members_compound_i_raw.txt index 49b97ced0..f06a53c8f 100644 --- a/tests/test_plan_refsols/retail_members_compound_i_raw.txt +++ b/tests/test_plan_refsols/retail_members_compound_i_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ISIN(SLICE(UPPER(last_name), 1:numeric, 3:numeric, None:unknown), ['UA', 'CO', 'AY', 'AL']:array[unknown]), columns={}) + FILTER(condition=ISIN(SLICE(UPPER(UNMASK::(PTY_UNPROTECT_NAME([last_name]))), 1:numeric, 3:numeric, None:unknown), ['UA', 'CO', 'AY', 'AL']:array[unknown]), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_i_rewrite.txt b/tests/test_plan_refsols/retail_members_compound_i_rewrite.txt index 49b97ced0..f06a53c8f 100644 --- a/tests/test_plan_refsols/retail_members_compound_i_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_compound_i_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ISIN(SLICE(UPPER(last_name), 1:numeric, 3:numeric, None:unknown), ['UA', 'CO', 'AY', 'AL']:array[unknown]), columns={}) + FILTER(condition=ISIN(SLICE(UPPER(UNMASK::(PTY_UNPROTECT_NAME([last_name]))), 1:numeric, 3:numeric, None:unknown), ['UA', 'CO', 'AY', 'AL']:array[unknown]), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_j_raw.txt b/tests/test_plan_refsols/retail_members_compound_j_raw.txt index f5ee4dc47..b9366f919 100644 --- a/tests/test_plan_refsols/retail_members_compound_j_raw.txt +++ b/tests/test_plan_refsols/retail_members_compound_j_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=CONTAINS(LOWER(last_name), 'hu':string), columns={}) + FILTER(condition=CONTAINS(LOWER(UNMASK::(PTY_UNPROTECT_NAME([last_name]))), 'hu':string), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_compound_j_rewrite.txt b/tests/test_plan_refsols/retail_members_compound_j_rewrite.txt index f5ee4dc47..b9366f919 100644 --- a/tests/test_plan_refsols/retail_members_compound_j_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_compound_j_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=CONTAINS(LOWER(last_name), 'hu':string), columns={}) + FILTER(condition=CONTAINS(LOWER(UNMASK::(PTY_UNPROTECT_NAME([last_name]))), 'hu':string), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_filter_email_contains_raw.txt b/tests/test_plan_refsols/retail_members_filter_email_contains_raw.txt index b741fafc6..85a6b3681 100644 --- a/tests/test_plan_refsols/retail_members_filter_email_contains_raw.txt +++ b/tests/test_plan_refsols/retail_members_filter_email_contains_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=NOT(CONTAINS(email, 'mail':string)), columns={}) + FILTER(condition=NOT(CONTAINS(UNMASK::(PTY_UNPROTECT_EMAIL([email])), 'mail':string)), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'email': email}) diff --git a/tests/test_plan_refsols/retail_members_filter_email_contains_rewrite.txt b/tests/test_plan_refsols/retail_members_filter_email_contains_rewrite.txt index b741fafc6..85a6b3681 100644 --- a/tests/test_plan_refsols/retail_members_filter_email_contains_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_filter_email_contains_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=NOT(CONTAINS(email, 'mail':string)), columns={}) + FILTER(condition=NOT(CONTAINS(UNMASK::(PTY_UNPROTECT_EMAIL([email])), 'mail':string)), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'email': email}) diff --git a/tests/test_plan_refsols/retail_members_filter_email_like_raw.txt b/tests/test_plan_refsols/retail_members_filter_email_like_raw.txt index c7801db47..4e1681266 100644 --- a/tests/test_plan_refsols/retail_members_filter_email_like_raw.txt +++ b/tests/test_plan_refsols/retail_members_filter_email_like_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=LIKE(email, '%.%@%mail%':string), columns={}) + FILTER(condition=LIKE(UNMASK::(PTY_UNPROTECT_EMAIL([email])), '%.%@%mail%':string), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'email': email}) diff --git a/tests/test_plan_refsols/retail_members_filter_email_like_rewrite.txt b/tests/test_plan_refsols/retail_members_filter_email_like_rewrite.txt index c7801db47..4e1681266 100644 --- a/tests/test_plan_refsols/retail_members_filter_email_like_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_filter_email_like_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=LIKE(email, '%.%@%mail%':string), columns={}) + FILTER(condition=LIKE(UNMASK::(PTY_UNPROTECT_EMAIL([email])), '%.%@%mail%':string), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'email': email}) diff --git a/tests/test_plan_refsols/retail_members_filter_name_endswith_raw.txt b/tests/test_plan_refsols/retail_members_filter_name_endswith_raw.txt index 8db9bd29e..6c2b46896 100644 --- a/tests/test_plan_refsols/retail_members_filter_name_endswith_raw.txt +++ b/tests/test_plan_refsols/retail_members_filter_name_endswith_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ENDSWITH(first_name, 'e':string) | ENDSWITH(last_name, 'e':string), columns={}) + FILTER(condition=ENDSWITH(UNMASK::(PTY_UNPROTECT([first_name], 'deName')), 'e':string) | ENDSWITH(UNMASK::(PTY_UNPROTECT_NAME([last_name])), 'e':string), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'first_name': first_name, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_filter_name_endswith_rewrite.txt b/tests/test_plan_refsols/retail_members_filter_name_endswith_rewrite.txt index 8db9bd29e..6c2b46896 100644 --- a/tests/test_plan_refsols/retail_members_filter_name_endswith_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_filter_name_endswith_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ENDSWITH(first_name, 'e':string) | ENDSWITH(last_name, 'e':string), columns={}) + FILTER(condition=ENDSWITH(UNMASK::(PTY_UNPROTECT([first_name], 'deName')), 'e':string) | ENDSWITH(UNMASK::(PTY_UNPROTECT_NAME([last_name])), 'e':string), columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'first_name': first_name, 'last_name': last_name}) diff --git a/tests/test_plan_refsols/retail_members_filter_slice_raw.txt b/tests/test_plan_refsols/retail_members_filter_slice_raw.txt index b37d36f39..3ac00f7f7 100644 --- a/tests/test_plan_refsols/retail_members_filter_slice_raw.txt +++ b/tests/test_plan_refsols/retail_members_filter_slice_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=SLICE(first_name, 1:numeric, 2:numeric, None:unknown) == 'a':string, columns={}) + FILTER(condition=SLICE(UNMASK::(PTY_UNPROTECT([first_name], 'deName')), 1:numeric, 2:numeric, None:unknown) == 'a':string, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'first_name': first_name}) diff --git a/tests/test_plan_refsols/retail_members_filter_slice_rewrite.txt b/tests/test_plan_refsols/retail_members_filter_slice_rewrite.txt index b37d36f39..3ac00f7f7 100644 --- a/tests/test_plan_refsols/retail_members_filter_slice_rewrite.txt +++ b/tests/test_plan_refsols/retail_members_filter_slice_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=SLICE(first_name, 1:numeric, 2:numeric, None:unknown) == 'a':string, columns={}) + FILTER(condition=SLICE(UNMASK::(PTY_UNPROTECT([first_name], 'deName')), 1:numeric, 2:numeric, None:unknown) == 'a':string, columns={}) SCAN(table=bodo.retail.protected_loyalty_members, columns={'first_name': first_name}) diff --git a/tests/test_plan_refsols/retail_transactions_filter_raw.txt b/tests/test_plan_refsols/retail_transactions_filter_raw.txt index 8d9d6afce..83503c8c6 100644 --- a/tests/test_plan_refsols/retail_transactions_filter_raw.txt +++ b/tests/test_plan_refsols/retail_transactions_filter_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', ROUND(avg_total_amount, 2:numeric))], orderings=[]) AGGREGATE(keys={}, aggregations={'avg_total_amount': AVG(total_amount)}) - FILTER(condition=MONTH(transaction_date) == 7:numeric & YEAR(transaction_date) == 2025:numeric, columns={'total_amount': total_amount}) + FILTER(condition=MONTH(UNMASK::(PTY_UNPROTECT_TS([transaction_date]))) == 7:numeric & YEAR(UNMASK::(PTY_UNPROTECT_TS([transaction_date]))) == 2025:numeric, columns={'total_amount': total_amount}) SCAN(table=bodo.retail.transactions, columns={'total_amount': total_amount, 'transaction_date': transaction_date}) diff --git a/tests/test_plan_refsols/retail_transactions_filter_rewrite.txt b/tests/test_plan_refsols/retail_transactions_filter_rewrite.txt index 8d9d6afce..83503c8c6 100644 --- a/tests/test_plan_refsols/retail_transactions_filter_rewrite.txt +++ b/tests/test_plan_refsols/retail_transactions_filter_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', ROUND(avg_total_amount, 2:numeric))], orderings=[]) AGGREGATE(keys={}, aggregations={'avg_total_amount': AVG(total_amount)}) - FILTER(condition=MONTH(transaction_date) == 7:numeric & YEAR(transaction_date) == 2025:numeric, columns={'total_amount': total_amount}) + FILTER(condition=MONTH(UNMASK::(PTY_UNPROTECT_TS([transaction_date]))) == 7:numeric & YEAR(UNMASK::(PTY_UNPROTECT_TS([transaction_date]))) == 2025:numeric, columns={'total_amount': total_amount}) SCAN(table=bodo.retail.transactions, columns={'total_amount': total_amount, 'transaction_date': transaction_date}) diff --git a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_a_raw.txt b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_a_raw.txt index a229eda61..36bd47d88 100644 --- a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_a_raw.txt +++ b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_a_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=payment_method == 'Cash':string, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT_ACCOUNT([payment_method])) == 'Cash':string, columns={}) SCAN(table=bodo.retail.transactions, columns={'payment_method': payment_method}) diff --git a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_a_rewrite.txt b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_a_rewrite.txt index a229eda61..36bd47d88 100644 --- a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_a_rewrite.txt +++ b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_a_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=payment_method == 'Cash':string, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT_ACCOUNT([payment_method])) == 'Cash':string, columns={}) SCAN(table=bodo.retail.transactions, columns={'payment_method': payment_method}) diff --git a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_b_raw.txt b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_b_raw.txt index 3fc23ce52..39d2f23ca 100644 --- a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_b_raw.txt +++ b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_b_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=payment_method != 'Credit Card':string, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT_ACCOUNT([payment_method])) != 'Credit Card':string, columns={}) SCAN(table=bodo.retail.transactions, columns={'payment_method': payment_method}) diff --git a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_b_rewrite.txt b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_b_rewrite.txt index 3fc23ce52..39d2f23ca 100644 --- a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_b_rewrite.txt +++ b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_b_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=payment_method != 'Credit Card':string, columns={}) + FILTER(condition=UNMASK::(PTY_UNPROTECT_ACCOUNT([payment_method])) != 'Credit Card':string, columns={}) SCAN(table=bodo.retail.transactions, columns={'payment_method': payment_method}) diff --git a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_c_raw.txt b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_c_raw.txt index 61cd5d5b6..17f7808d7 100644 --- a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_c_raw.txt +++ b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_c_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ISIN(payment_method, ['Cash', 'Gift Card']:array[unknown]), columns={}) + FILTER(condition=ISIN(UNMASK::(PTY_UNPROTECT_ACCOUNT([payment_method])), ['Cash', 'Gift Card']:array[unknown]), columns={}) SCAN(table=bodo.retail.transactions, columns={'payment_method': payment_method}) diff --git a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_c_rewrite.txt b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_c_rewrite.txt index 61cd5d5b6..17f7808d7 100644 --- a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_c_rewrite.txt +++ b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_c_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=ISIN(payment_method, ['Cash', 'Gift Card']:array[unknown]), columns={}) + FILTER(condition=ISIN(UNMASK::(PTY_UNPROTECT_ACCOUNT([payment_method])), ['Cash', 'Gift Card']:array[unknown]), columns={}) SCAN(table=bodo.retail.transactions, columns={'payment_method': payment_method}) diff --git a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_d_raw.txt b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_d_raw.txt index 991250bfb..f4ebc77d6 100644 --- a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_d_raw.txt +++ b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_d_raw.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=NOT(ISIN(payment_method, ['Mobile Payment', 'Gift Card']:array[unknown])), columns={}) + FILTER(condition=NOT(ISIN(UNMASK::(PTY_UNPROTECT_ACCOUNT([payment_method])), ['Mobile Payment', 'Gift Card']:array[unknown])), columns={}) SCAN(table=bodo.retail.transactions, columns={'payment_method': payment_method}) diff --git a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_d_rewrite.txt b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_d_rewrite.txt index 991250bfb..f4ebc77d6 100644 --- a/tests/test_plan_refsols/retail_transactions_payment_method_cmp_d_rewrite.txt +++ b/tests/test_plan_refsols/retail_transactions_payment_method_cmp_d_rewrite.txt @@ -1,4 +1,4 @@ ROOT(columns=[('n', n_rows)], orderings=[]) AGGREGATE(keys={}, aggregations={'n_rows': COUNT()}) - FILTER(condition=NOT(ISIN(payment_method, ['Mobile Payment', 'Gift Card']:array[unknown])), columns={}) + FILTER(condition=NOT(ISIN(UNMASK::(PTY_UNPROTECT_ACCOUNT([payment_method])), ['Mobile Payment', 'Gift Card']:array[unknown])), columns={}) SCAN(table=bodo.retail.transactions, columns={'payment_method': payment_method}) diff --git a/tests/test_sql_refsols/cryptbank_agg_01_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_01_raw_sqlite.sql new file mode 100644 index 000000000..ac0ae3093 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_agg_01_raw_sqlite.sql @@ -0,0 +1,8 @@ +SELECT + ROUND(AVG(( + 1025.67 - t_amount + )), 2) AS n +FROM crbnk.transactions +WHERE + CAST(STRFTIME('%Y', DATETIME(t_ts, '+54321 seconds')) AS INTEGER) = 2022 + AND CAST(STRFTIME('%m', DATETIME(t_ts, '+54321 seconds')) AS INTEGER) = 6 diff --git a/tests/test_sql_refsols/cryptbank_agg_01_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_01_rewrite_sqlite.sql new file mode 100644 index 000000000..ac0ae3093 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_agg_01_rewrite_sqlite.sql @@ -0,0 +1,8 @@ +SELECT + ROUND(AVG(( + 1025.67 - t_amount + )), 2) AS n +FROM crbnk.transactions +WHERE + CAST(STRFTIME('%Y', DATETIME(t_ts, '+54321 seconds')) AS INTEGER) = 2022 + AND CAST(STRFTIME('%m', DATETIME(t_ts, '+54321 seconds')) AS INTEGER) = 6 diff --git a/tests/test_sql_refsols/cryptbank_agg_01_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_01_sqlite.sql deleted file mode 100644 index 6471495fc..000000000 --- a/tests/test_sql_refsols/cryptbank_agg_01_sqlite.sql +++ /dev/null @@ -1,6 +0,0 @@ -SELECT - ROUND(AVG(t_amount), 2) AS n -FROM crbnk.transactions -WHERE - CAST(STRFTIME('%Y', t_ts) AS INTEGER) = 2022 - AND CAST(STRFTIME('%m', t_ts) AS INTEGER) = 6 diff --git a/tests/test_sql_refsols/cryptbank_agg_02_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_02_raw_sqlite.sql new file mode 100644 index 000000000..13d8eff87 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_agg_02_raw_sqlite.sql @@ -0,0 +1,7 @@ +SELECT + SUBSTRING(a_type, -1) || SUBSTRING(a_type, 1, LENGTH(a_type) - 1) AS account_type, + COUNT(*) AS n, + ROUND(AVG(SQRT(a_balance)), 2) AS avg_bal +FROM crbnk.accounts +GROUP BY + 1 diff --git a/tests/test_sql_refsols/cryptbank_agg_02_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_02_rewrite_sqlite.sql new file mode 100644 index 000000000..13d8eff87 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_agg_02_rewrite_sqlite.sql @@ -0,0 +1,7 @@ +SELECT + SUBSTRING(a_type, -1) || SUBSTRING(a_type, 1, LENGTH(a_type) - 1) AS account_type, + COUNT(*) AS n, + ROUND(AVG(SQRT(a_balance)), 2) AS avg_bal +FROM crbnk.accounts +GROUP BY + 1 diff --git a/tests/test_sql_refsols/cryptbank_agg_02_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_02_sqlite.sql deleted file mode 100644 index ef861c5d1..000000000 --- a/tests/test_sql_refsols/cryptbank_agg_02_sqlite.sql +++ /dev/null @@ -1,7 +0,0 @@ -SELECT - a_type AS account_type, - COUNT(*) AS n, - ROUND(AVG(a_balance), 2) AS avg_bal -FROM crbnk.accounts -GROUP BY - 1 diff --git a/tests/test_sql_refsols/cryptbank_agg_03_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_03_raw_sqlite.sql new file mode 100644 index 000000000..1edc15988 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_agg_03_raw_sqlite.sql @@ -0,0 +1,20 @@ +WITH _t AS ( + SELECT + accounts.a_balance, + accounts.a_type, + customers.c_fname, + customers.c_lname, + ROW_NUMBER() OVER (PARTITION BY SUBSTRING(accounts.a_type, -1) || SUBSTRING(accounts.a_type, 1, LENGTH(accounts.a_type) - 1) ORDER BY SQRT(accounts.a_balance) DESC) AS _w + FROM crbnk.accounts AS accounts + JOIN crbnk.customers AS customers + ON accounts.a_custkey = ( + 42 - customers.c_key + ) +) +SELECT + SUBSTRING(a_type, -1) || SUBSTRING(a_type, 1, LENGTH(a_type) - 1) AS account_type, + SQRT(a_balance) AS balance, + CONCAT_WS(' ', LOWER(c_fname), LOWER(c_lname)) AS name +FROM _t +WHERE + _w = 1 diff --git a/tests/test_sql_refsols/cryptbank_agg_03_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_03_rewrite_sqlite.sql new file mode 100644 index 000000000..1edc15988 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_agg_03_rewrite_sqlite.sql @@ -0,0 +1,20 @@ +WITH _t AS ( + SELECT + accounts.a_balance, + accounts.a_type, + customers.c_fname, + customers.c_lname, + ROW_NUMBER() OVER (PARTITION BY SUBSTRING(accounts.a_type, -1) || SUBSTRING(accounts.a_type, 1, LENGTH(accounts.a_type) - 1) ORDER BY SQRT(accounts.a_balance) DESC) AS _w + FROM crbnk.accounts AS accounts + JOIN crbnk.customers AS customers + ON accounts.a_custkey = ( + 42 - customers.c_key + ) +) +SELECT + SUBSTRING(a_type, -1) || SUBSTRING(a_type, 1, LENGTH(a_type) - 1) AS account_type, + SQRT(a_balance) AS balance, + CONCAT_WS(' ', LOWER(c_fname), LOWER(c_lname)) AS name +FROM _t +WHERE + _w = 1 diff --git a/tests/test_sql_refsols/cryptbank_agg_03_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_03_sqlite.sql deleted file mode 100644 index 21a6dca45..000000000 --- a/tests/test_sql_refsols/cryptbank_agg_03_sqlite.sql +++ /dev/null @@ -1,18 +0,0 @@ -WITH _t AS ( - SELECT - accounts.a_balance, - accounts.a_type, - customers.c_fname, - customers.c_lname, - ROW_NUMBER() OVER (PARTITION BY accounts.a_type ORDER BY accounts.a_balance DESC) AS _w - FROM crbnk.accounts AS accounts - JOIN crbnk.customers AS customers - ON accounts.a_custkey = customers.c_key -) -SELECT - a_type AS account_type, - a_balance AS balance, - CONCAT_WS(' ', c_fname, c_lname) AS name -FROM _t -WHERE - _w = 1 diff --git a/tests/test_sql_refsols/cryptbank_agg_04_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_04_raw_sqlite.sql similarity index 60% rename from tests/test_sql_refsols/cryptbank_agg_04_sqlite.sql rename to tests/test_sql_refsols/cryptbank_agg_04_raw_sqlite.sql index 3db300463..992e6eccd 100644 --- a/tests/test_sql_refsols/cryptbank_agg_04_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_agg_04_raw_sqlite.sql @@ -1,7 +1,7 @@ WITH _s1 AS ( SELECT a_branchkey, - SUM(a_balance) AS sum_a_balance + SUM(SQRT(a_balance)) AS sum_unmask_a_balance FROM crbnk.accounts GROUP BY 1 @@ -9,7 +9,7 @@ WITH _s1 AS ( SELECT branches.b_key AS branch_key, ROUND( - CAST(COALESCE(_s1.sum_a_balance, 0) AS REAL) / SUM(COALESCE(_s1.sum_a_balance, 0)) OVER (), + CAST(COALESCE(_s1.sum_unmask_a_balance, 0) AS REAL) / SUM(COALESCE(_s1.sum_unmask_a_balance, 0)) OVER (), 2 ) AS pct_total_wealth FROM crbnk.branches AS branches diff --git a/tests/test_sql_refsols/cryptbank_agg_04_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_04_rewrite_sqlite.sql new file mode 100644 index 000000000..992e6eccd --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_agg_04_rewrite_sqlite.sql @@ -0,0 +1,17 @@ +WITH _s1 AS ( + SELECT + a_branchkey, + SUM(SQRT(a_balance)) AS sum_unmask_a_balance + FROM crbnk.accounts + GROUP BY + 1 +) +SELECT + branches.b_key AS branch_key, + ROUND( + CAST(COALESCE(_s1.sum_unmask_a_balance, 0) AS REAL) / SUM(COALESCE(_s1.sum_unmask_a_balance, 0)) OVER (), + 2 + ) AS pct_total_wealth +FROM crbnk.branches AS branches +JOIN _s1 AS _s1 + ON _s1.a_branchkey = branches.b_key diff --git a/tests/test_sql_refsols/cryptbank_agg_05_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_05_raw_sqlite.sql new file mode 100644 index 000000000..a49129460 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_agg_05_raw_sqlite.sql @@ -0,0 +1,32 @@ +WITH _s1 AS ( + SELECT + t_sourceaccount, + MIN(DATETIME(t_ts, '+54321 seconds')) AS min_unmask_t_ts + FROM crbnk.transactions + GROUP BY + 1 +) +SELECT + ROUND( + AVG( + ( + ( + CAST(( + JULIANDAY(DATE(_s1.min_unmask_t_ts, 'start of day')) - JULIANDAY(DATE(DATETIME(accounts.a_open_ts, '+123456789 seconds'), 'start of day')) + ) AS INTEGER) * 24 + CAST(STRFTIME('%H', _s1.min_unmask_t_ts) AS INTEGER) - CAST(STRFTIME('%H', DATETIME(accounts.a_open_ts, '+123456789 seconds')) AS INTEGER) + ) * 60 + CAST(STRFTIME('%M', _s1.min_unmask_t_ts) AS INTEGER) - CAST(STRFTIME('%M', DATETIME(accounts.a_open_ts, '+123456789 seconds')) AS INTEGER) + ) * 60 + CAST(STRFTIME('%S', _s1.min_unmask_t_ts) AS INTEGER) - CAST(STRFTIME('%S', DATETIME(accounts.a_open_ts, '+123456789 seconds')) AS INTEGER) + ), + 2 + ) AS avg_secs +FROM crbnk.accounts AS accounts +LEFT JOIN _s1 AS _s1 + ON _s1.t_sourceaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END diff --git a/tests/test_sql_refsols/cryptbank_agg_05_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_05_rewrite_sqlite.sql new file mode 100644 index 000000000..a49129460 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_agg_05_rewrite_sqlite.sql @@ -0,0 +1,32 @@ +WITH _s1 AS ( + SELECT + t_sourceaccount, + MIN(DATETIME(t_ts, '+54321 seconds')) AS min_unmask_t_ts + FROM crbnk.transactions + GROUP BY + 1 +) +SELECT + ROUND( + AVG( + ( + ( + CAST(( + JULIANDAY(DATE(_s1.min_unmask_t_ts, 'start of day')) - JULIANDAY(DATE(DATETIME(accounts.a_open_ts, '+123456789 seconds'), 'start of day')) + ) AS INTEGER) * 24 + CAST(STRFTIME('%H', _s1.min_unmask_t_ts) AS INTEGER) - CAST(STRFTIME('%H', DATETIME(accounts.a_open_ts, '+123456789 seconds')) AS INTEGER) + ) * 60 + CAST(STRFTIME('%M', _s1.min_unmask_t_ts) AS INTEGER) - CAST(STRFTIME('%M', DATETIME(accounts.a_open_ts, '+123456789 seconds')) AS INTEGER) + ) * 60 + CAST(STRFTIME('%S', _s1.min_unmask_t_ts) AS INTEGER) - CAST(STRFTIME('%S', DATETIME(accounts.a_open_ts, '+123456789 seconds')) AS INTEGER) + ), + 2 + ) AS avg_secs +FROM crbnk.accounts AS accounts +LEFT JOIN _s1 AS _s1 + ON _s1.t_sourceaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END diff --git a/tests/test_sql_refsols/cryptbank_agg_05_sqlite.sql b/tests/test_sql_refsols/cryptbank_agg_05_sqlite.sql deleted file mode 100644 index fdb24a8ce..000000000 --- a/tests/test_sql_refsols/cryptbank_agg_05_sqlite.sql +++ /dev/null @@ -1,24 +0,0 @@ -WITH _s1 AS ( - SELECT - t_sourceaccount, - MIN(t_ts) AS min_t_ts - FROM crbnk.transactions - GROUP BY - 1 -) -SELECT - ROUND( - AVG( - ( - ( - CAST(( - JULIANDAY(DATE(_s1.min_t_ts, 'start of day')) - JULIANDAY(DATE(accounts.a_open_ts, 'start of day')) - ) AS INTEGER) * 24 + CAST(STRFTIME('%H', _s1.min_t_ts) AS INTEGER) - CAST(STRFTIME('%H', accounts.a_open_ts) AS INTEGER) - ) * 60 + CAST(STRFTIME('%M', _s1.min_t_ts) AS INTEGER) - CAST(STRFTIME('%M', accounts.a_open_ts) AS INTEGER) - ) * 60 + CAST(STRFTIME('%S', _s1.min_t_ts) AS INTEGER) - CAST(STRFTIME('%S', accounts.a_open_ts) AS INTEGER) - ), - 2 - ) AS avg_secs -FROM crbnk.accounts AS accounts -LEFT JOIN _s1 AS _s1 - ON _s1.t_sourceaccount = accounts.a_key diff --git a/tests/test_sql_refsols/cryptbank_analysis_01_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_analysis_01_raw_sqlite.sql new file mode 100644 index 000000000..b40521e85 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_analysis_01_raw_sqlite.sql @@ -0,0 +1,65 @@ +WITH _t AS ( + SELECT + accounts.a_custkey, + transactions.t_amount, + ROW_NUMBER() OVER (PARTITION BY transactions.t_sourceaccount ORDER BY DATETIME(transactions.t_ts, '+54321 seconds')) AS _w + FROM crbnk.accounts AS accounts + JOIN crbnk.transactions AS transactions + ON transactions.t_sourceaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END + JOIN crbnk.accounts AS accounts_2 + ON transactions.t_destaccount = CASE + WHEN accounts_2.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts_2.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts_2.a_key, + 1 + INSTR(accounts_2.a_key, '-'), + CAST(LENGTH(accounts_2.a_key) AS REAL) / 2 + ) AS INTEGER) + END + JOIN crbnk.branches AS branches + ON SUBSTRING( + branches.b_addr, + CASE + WHEN ( + LENGTH(branches.b_addr) + -4 + ) < 1 + THEN 1 + ELSE ( + LENGTH(branches.b_addr) + -4 + ) + END + ) = '94105' + AND accounts_2.a_branchkey = branches.b_key +), _s7 AS ( + SELECT + a_custkey, + SUM(( + 1025.67 - t_amount + )) AS sum_unmask_t_amount + FROM _t + WHERE + _w = 1 + GROUP BY + 1 +) +SELECT + 42 - customers.c_key AS key, + CONCAT_WS(' ', LOWER(customers.c_fname), LOWER(customers.c_lname)) AS name, + COALESCE(_s7.sum_unmask_t_amount, 0) AS first_sends +FROM crbnk.customers AS customers +LEFT JOIN _s7 AS _s7 + ON _s7.a_custkey = ( + 42 - customers.c_key + ) +ORDER BY + 3 DESC, + 1 +LIMIT 3 diff --git a/tests/test_sql_refsols/cryptbank_analysis_01_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_analysis_01_rewrite_sqlite.sql new file mode 100644 index 000000000..b40521e85 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_analysis_01_rewrite_sqlite.sql @@ -0,0 +1,65 @@ +WITH _t AS ( + SELECT + accounts.a_custkey, + transactions.t_amount, + ROW_NUMBER() OVER (PARTITION BY transactions.t_sourceaccount ORDER BY DATETIME(transactions.t_ts, '+54321 seconds')) AS _w + FROM crbnk.accounts AS accounts + JOIN crbnk.transactions AS transactions + ON transactions.t_sourceaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END + JOIN crbnk.accounts AS accounts_2 + ON transactions.t_destaccount = CASE + WHEN accounts_2.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts_2.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts_2.a_key, + 1 + INSTR(accounts_2.a_key, '-'), + CAST(LENGTH(accounts_2.a_key) AS REAL) / 2 + ) AS INTEGER) + END + JOIN crbnk.branches AS branches + ON SUBSTRING( + branches.b_addr, + CASE + WHEN ( + LENGTH(branches.b_addr) + -4 + ) < 1 + THEN 1 + ELSE ( + LENGTH(branches.b_addr) + -4 + ) + END + ) = '94105' + AND accounts_2.a_branchkey = branches.b_key +), _s7 AS ( + SELECT + a_custkey, + SUM(( + 1025.67 - t_amount + )) AS sum_unmask_t_amount + FROM _t + WHERE + _w = 1 + GROUP BY + 1 +) +SELECT + 42 - customers.c_key AS key, + CONCAT_WS(' ', LOWER(customers.c_fname), LOWER(customers.c_lname)) AS name, + COALESCE(_s7.sum_unmask_t_amount, 0) AS first_sends +FROM crbnk.customers AS customers +LEFT JOIN _s7 AS _s7 + ON _s7.a_custkey = ( + 42 - customers.c_key + ) +ORDER BY + 3 DESC, + 1 +LIMIT 3 diff --git a/tests/test_sql_refsols/cryptbank_analysis_01_sqlite.sql b/tests/test_sql_refsols/cryptbank_analysis_01_sqlite.sql deleted file mode 100644 index 77943f013..000000000 --- a/tests/test_sql_refsols/cryptbank_analysis_01_sqlite.sql +++ /dev/null @@ -1,45 +0,0 @@ -WITH _t AS ( - SELECT - accounts.a_custkey, - transactions.t_amount, - ROW_NUMBER() OVER (PARTITION BY transactions.t_sourceaccount ORDER BY transactions.t_ts) AS _w - FROM crbnk.accounts AS accounts - JOIN crbnk.transactions AS transactions - ON accounts.a_key = transactions.t_sourceaccount - JOIN crbnk.accounts AS accounts_2 - ON accounts_2.a_key = transactions.t_destaccount - JOIN crbnk.branches AS branches - ON SUBSTRING( - branches.b_addr, - CASE - WHEN ( - LENGTH(branches.b_addr) + -4 - ) < 1 - THEN 1 - ELSE ( - LENGTH(branches.b_addr) + -4 - ) - END - ) = '94105' - AND accounts_2.a_branchkey = branches.b_key -), _s7 AS ( - SELECT - a_custkey, - SUM(t_amount) AS sum_t_amount - FROM _t - WHERE - _w = 1 - GROUP BY - 1 -) -SELECT - customers.c_key AS key, - CONCAT_WS(' ', customers.c_fname, customers.c_lname) AS name, - COALESCE(_s7.sum_t_amount, 0) AS first_sends -FROM crbnk.customers AS customers -LEFT JOIN _s7 AS _s7 - ON _s7.a_custkey = customers.c_key -ORDER BY - 3 DESC, - 1 -LIMIT 3 diff --git a/tests/test_sql_refsols/cryptbank_analysis_02_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_analysis_02_raw_sqlite.sql new file mode 100644 index 000000000..322399c24 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_analysis_02_raw_sqlite.sql @@ -0,0 +1,65 @@ +WITH _t AS ( + SELECT + accounts.a_custkey, + transactions.t_amount, + ROW_NUMBER() OVER (PARTITION BY transactions.t_destaccount ORDER BY DATETIME(transactions.t_ts, '+54321 seconds')) AS _w + FROM crbnk.accounts AS accounts + JOIN crbnk.transactions AS transactions + ON transactions.t_destaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END + JOIN crbnk.accounts AS accounts_2 + ON transactions.t_sourceaccount = CASE + WHEN accounts_2.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts_2.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts_2.a_key, + 1 + INSTR(accounts_2.a_key, '-'), + CAST(LENGTH(accounts_2.a_key) AS REAL) / 2 + ) AS INTEGER) + END + JOIN crbnk.branches AS branches + ON SUBSTRING( + branches.b_addr, + CASE + WHEN ( + LENGTH(branches.b_addr) + -4 + ) < 1 + THEN 1 + ELSE ( + LENGTH(branches.b_addr) + -4 + ) + END + ) = '94105' + AND accounts_2.a_branchkey = branches.b_key +), _s7 AS ( + SELECT + a_custkey, + SUM(( + 1025.67 - t_amount + )) AS sum_unmask_t_amount + FROM _t + WHERE + _w = 1 + GROUP BY + 1 +) +SELECT + 42 - customers.c_key AS key, + CONCAT_WS(' ', LOWER(customers.c_fname), LOWER(customers.c_lname)) AS name, + COALESCE(_s7.sum_unmask_t_amount, 0) AS first_recvs +FROM crbnk.customers AS customers +LEFT JOIN _s7 AS _s7 + ON _s7.a_custkey = ( + 42 - customers.c_key + ) +ORDER BY + 3 DESC, + 1 +LIMIT 3 diff --git a/tests/test_sql_refsols/cryptbank_analysis_02_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_analysis_02_rewrite_sqlite.sql new file mode 100644 index 000000000..322399c24 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_analysis_02_rewrite_sqlite.sql @@ -0,0 +1,65 @@ +WITH _t AS ( + SELECT + accounts.a_custkey, + transactions.t_amount, + ROW_NUMBER() OVER (PARTITION BY transactions.t_destaccount ORDER BY DATETIME(transactions.t_ts, '+54321 seconds')) AS _w + FROM crbnk.accounts AS accounts + JOIN crbnk.transactions AS transactions + ON transactions.t_destaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END + JOIN crbnk.accounts AS accounts_2 + ON transactions.t_sourceaccount = CASE + WHEN accounts_2.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts_2.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts_2.a_key, + 1 + INSTR(accounts_2.a_key, '-'), + CAST(LENGTH(accounts_2.a_key) AS REAL) / 2 + ) AS INTEGER) + END + JOIN crbnk.branches AS branches + ON SUBSTRING( + branches.b_addr, + CASE + WHEN ( + LENGTH(branches.b_addr) + -4 + ) < 1 + THEN 1 + ELSE ( + LENGTH(branches.b_addr) + -4 + ) + END + ) = '94105' + AND accounts_2.a_branchkey = branches.b_key +), _s7 AS ( + SELECT + a_custkey, + SUM(( + 1025.67 - t_amount + )) AS sum_unmask_t_amount + FROM _t + WHERE + _w = 1 + GROUP BY + 1 +) +SELECT + 42 - customers.c_key AS key, + CONCAT_WS(' ', LOWER(customers.c_fname), LOWER(customers.c_lname)) AS name, + COALESCE(_s7.sum_unmask_t_amount, 0) AS first_recvs +FROM crbnk.customers AS customers +LEFT JOIN _s7 AS _s7 + ON _s7.a_custkey = ( + 42 - customers.c_key + ) +ORDER BY + 3 DESC, + 1 +LIMIT 3 diff --git a/tests/test_sql_refsols/cryptbank_analysis_02_sqlite.sql b/tests/test_sql_refsols/cryptbank_analysis_02_sqlite.sql deleted file mode 100644 index 78f5dd9d3..000000000 --- a/tests/test_sql_refsols/cryptbank_analysis_02_sqlite.sql +++ /dev/null @@ -1,45 +0,0 @@ -WITH _t AS ( - SELECT - accounts.a_custkey, - transactions.t_amount, - ROW_NUMBER() OVER (PARTITION BY transactions.t_destaccount ORDER BY transactions.t_ts) AS _w - FROM crbnk.accounts AS accounts - JOIN crbnk.transactions AS transactions - ON accounts.a_key = transactions.t_destaccount - JOIN crbnk.accounts AS accounts_2 - ON accounts_2.a_key = transactions.t_sourceaccount - JOIN crbnk.branches AS branches - ON SUBSTRING( - branches.b_addr, - CASE - WHEN ( - LENGTH(branches.b_addr) + -4 - ) < 1 - THEN 1 - ELSE ( - LENGTH(branches.b_addr) + -4 - ) - END - ) = '94105' - AND accounts_2.a_branchkey = branches.b_key -), _s7 AS ( - SELECT - a_custkey, - SUM(t_amount) AS sum_t_amount - FROM _t - WHERE - _w = 1 - GROUP BY - 1 -) -SELECT - customers.c_key AS key, - CONCAT_WS(' ', customers.c_fname, customers.c_lname) AS name, - COALESCE(_s7.sum_t_amount, 0) AS first_recvs -FROM crbnk.customers AS customers -LEFT JOIN _s7 AS _s7 - ON _s7.a_custkey = customers.c_key -ORDER BY - 3 DESC, - 1 -LIMIT 3 diff --git a/tests/test_sql_refsols/cryptbank_analysis_03_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_analysis_03_raw_sqlite.sql new file mode 100644 index 000000000..bdd8c1372 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_analysis_03_raw_sqlite.sql @@ -0,0 +1,112 @@ +WITH _s0 AS ( + SELECT + a_custkey, + a_key + FROM crbnk.accounts +), _s1 AS ( + SELECT + t_amount, + t_destaccount, + t_sourceaccount, + t_ts + FROM crbnk.transactions +), _s2 AS ( + SELECT + a_branchkey, + a_key + FROM crbnk.accounts +), _t4 AS ( + SELECT + b_addr, + b_key + FROM crbnk.branches + WHERE + SUBSTRING( + b_addr, + CASE WHEN ( + LENGTH(b_addr) + -4 + ) < 1 THEN 1 ELSE ( + LENGTH(b_addr) + -4 + ) END + ) = '94105' +), _t AS ( + SELECT + _s0.a_custkey, + _s1.t_amount, + ROW_NUMBER() OVER (PARTITION BY _s1.t_sourceaccount ORDER BY DATETIME(_s1.t_ts, '+54321 seconds')) AS _w + FROM _s0 AS _s0 + JOIN _s1 AS _s1 + ON _s1.t_sourceaccount = CASE + WHEN _s0.a_key = 0 + THEN 0 + ELSE CASE WHEN _s0.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING(_s0.a_key, 1 + INSTR(_s0.a_key, '-'), CAST(LENGTH(_s0.a_key) AS REAL) / 2) AS INTEGER) + END + JOIN _s2 AS _s2 + ON _s1.t_destaccount = CASE + WHEN _s2.a_key = 0 + THEN 0 + ELSE CASE WHEN _s2.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING(_s2.a_key, 1 + INSTR(_s2.a_key, '-'), CAST(LENGTH(_s2.a_key) AS REAL) / 2) AS INTEGER) + END + JOIN _t4 AS _t4 + ON _s2.a_branchkey = _t4.b_key +), _s7 AS ( + SELECT + a_custkey, + SUM(( + 1025.67 - t_amount + )) AS sum_unmask_t_amount + FROM _t + WHERE + _w = 1 + GROUP BY + 1 +), _t_2 AS ( + SELECT + _s8.a_custkey, + _s9.t_amount, + ROW_NUMBER() OVER (PARTITION BY _s9.t_destaccount ORDER BY DATETIME(_s9.t_ts, '+54321 seconds')) AS _w + FROM _s0 AS _s8 + JOIN _s1 AS _s9 + ON _s9.t_destaccount = CASE + WHEN _s8.a_key = 0 + THEN 0 + ELSE CASE WHEN _s8.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING(_s8.a_key, 1 + INSTR(_s8.a_key, '-'), CAST(LENGTH(_s8.a_key) AS REAL) / 2) AS INTEGER) + END + JOIN _s2 AS _s10 + ON _s9.t_sourceaccount = CASE + WHEN _s10.a_key = 0 + THEN 0 + ELSE CASE WHEN _s10.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING(_s10.a_key, 1 + INSTR(_s10.a_key, '-'), CAST(LENGTH(_s10.a_key) AS REAL) / 2) AS INTEGER) + END + JOIN _t4 AS _t8 + ON _s10.a_branchkey = _t8.b_key +), _s15 AS ( + SELECT + a_custkey, + SUM(( + 1025.67 - t_amount + )) AS sum_unmask_t_amount + FROM _t_2 + WHERE + _w = 1 + GROUP BY + 1 +) +SELECT + 42 - customers.c_key AS key, + CONCAT_WS(' ', LOWER(customers.c_fname), LOWER(customers.c_lname)) AS name, + COALESCE(_s7.sum_unmask_t_amount, 0) AS first_sends, + COALESCE(_s15.sum_unmask_t_amount, 0) AS first_recvs +FROM crbnk.customers AS customers +LEFT JOIN _s7 AS _s7 + ON _s7.a_custkey = ( + 42 - customers.c_key + ) +LEFT JOIN _s15 AS _s15 + ON _s15.a_custkey = ( + 42 - customers.c_key + ) +ORDER BY + COALESCE(_s7.sum_unmask_t_amount, 0) + COALESCE(_s15.sum_unmask_t_amount, 0) DESC, + 1 +LIMIT 3 diff --git a/tests/test_sql_refsols/cryptbank_analysis_03_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_analysis_03_rewrite_sqlite.sql new file mode 100644 index 000000000..bdd8c1372 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_analysis_03_rewrite_sqlite.sql @@ -0,0 +1,112 @@ +WITH _s0 AS ( + SELECT + a_custkey, + a_key + FROM crbnk.accounts +), _s1 AS ( + SELECT + t_amount, + t_destaccount, + t_sourceaccount, + t_ts + FROM crbnk.transactions +), _s2 AS ( + SELECT + a_branchkey, + a_key + FROM crbnk.accounts +), _t4 AS ( + SELECT + b_addr, + b_key + FROM crbnk.branches + WHERE + SUBSTRING( + b_addr, + CASE WHEN ( + LENGTH(b_addr) + -4 + ) < 1 THEN 1 ELSE ( + LENGTH(b_addr) + -4 + ) END + ) = '94105' +), _t AS ( + SELECT + _s0.a_custkey, + _s1.t_amount, + ROW_NUMBER() OVER (PARTITION BY _s1.t_sourceaccount ORDER BY DATETIME(_s1.t_ts, '+54321 seconds')) AS _w + FROM _s0 AS _s0 + JOIN _s1 AS _s1 + ON _s1.t_sourceaccount = CASE + WHEN _s0.a_key = 0 + THEN 0 + ELSE CASE WHEN _s0.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING(_s0.a_key, 1 + INSTR(_s0.a_key, '-'), CAST(LENGTH(_s0.a_key) AS REAL) / 2) AS INTEGER) + END + JOIN _s2 AS _s2 + ON _s1.t_destaccount = CASE + WHEN _s2.a_key = 0 + THEN 0 + ELSE CASE WHEN _s2.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING(_s2.a_key, 1 + INSTR(_s2.a_key, '-'), CAST(LENGTH(_s2.a_key) AS REAL) / 2) AS INTEGER) + END + JOIN _t4 AS _t4 + ON _s2.a_branchkey = _t4.b_key +), _s7 AS ( + SELECT + a_custkey, + SUM(( + 1025.67 - t_amount + )) AS sum_unmask_t_amount + FROM _t + WHERE + _w = 1 + GROUP BY + 1 +), _t_2 AS ( + SELECT + _s8.a_custkey, + _s9.t_amount, + ROW_NUMBER() OVER (PARTITION BY _s9.t_destaccount ORDER BY DATETIME(_s9.t_ts, '+54321 seconds')) AS _w + FROM _s0 AS _s8 + JOIN _s1 AS _s9 + ON _s9.t_destaccount = CASE + WHEN _s8.a_key = 0 + THEN 0 + ELSE CASE WHEN _s8.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING(_s8.a_key, 1 + INSTR(_s8.a_key, '-'), CAST(LENGTH(_s8.a_key) AS REAL) / 2) AS INTEGER) + END + JOIN _s2 AS _s10 + ON _s9.t_sourceaccount = CASE + WHEN _s10.a_key = 0 + THEN 0 + ELSE CASE WHEN _s10.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING(_s10.a_key, 1 + INSTR(_s10.a_key, '-'), CAST(LENGTH(_s10.a_key) AS REAL) / 2) AS INTEGER) + END + JOIN _t4 AS _t8 + ON _s10.a_branchkey = _t8.b_key +), _s15 AS ( + SELECT + a_custkey, + SUM(( + 1025.67 - t_amount + )) AS sum_unmask_t_amount + FROM _t_2 + WHERE + _w = 1 + GROUP BY + 1 +) +SELECT + 42 - customers.c_key AS key, + CONCAT_WS(' ', LOWER(customers.c_fname), LOWER(customers.c_lname)) AS name, + COALESCE(_s7.sum_unmask_t_amount, 0) AS first_sends, + COALESCE(_s15.sum_unmask_t_amount, 0) AS first_recvs +FROM crbnk.customers AS customers +LEFT JOIN _s7 AS _s7 + ON _s7.a_custkey = ( + 42 - customers.c_key + ) +LEFT JOIN _s15 AS _s15 + ON _s15.a_custkey = ( + 42 - customers.c_key + ) +ORDER BY + COALESCE(_s7.sum_unmask_t_amount, 0) + COALESCE(_s15.sum_unmask_t_amount, 0) DESC, + 1 +LIMIT 3 diff --git a/tests/test_sql_refsols/cryptbank_analysis_03_sqlite.sql b/tests/test_sql_refsols/cryptbank_analysis_03_sqlite.sql deleted file mode 100644 index 38f2dfc2b..000000000 --- a/tests/test_sql_refsols/cryptbank_analysis_03_sqlite.sql +++ /dev/null @@ -1,88 +0,0 @@ -WITH _s0 AS ( - SELECT - a_custkey, - a_key - FROM crbnk.accounts -), _s1 AS ( - SELECT - t_amount, - t_destaccount, - t_sourceaccount, - t_ts - FROM crbnk.transactions -), _s2 AS ( - SELECT - a_branchkey, - a_key - FROM crbnk.accounts -), _t4 AS ( - SELECT - b_addr, - b_key - FROM crbnk.branches - WHERE - SUBSTRING( - b_addr, - CASE WHEN ( - LENGTH(b_addr) + -4 - ) < 1 THEN 1 ELSE ( - LENGTH(b_addr) + -4 - ) END - ) = '94105' -), _t AS ( - SELECT - _s0.a_custkey, - _s1.t_amount, - ROW_NUMBER() OVER (PARTITION BY _s1.t_sourceaccount ORDER BY _s1.t_ts) AS _w - FROM _s0 AS _s0 - JOIN _s1 AS _s1 - ON _s0.a_key = _s1.t_sourceaccount - JOIN _s2 AS _s2 - ON _s1.t_destaccount = _s2.a_key - JOIN _t4 AS _t4 - ON _s2.a_branchkey = _t4.b_key -), _s7 AS ( - SELECT - a_custkey, - SUM(t_amount) AS sum_t_amount - FROM _t - WHERE - _w = 1 - GROUP BY - 1 -), _t_2 AS ( - SELECT - _s8.a_custkey, - _s9.t_amount, - ROW_NUMBER() OVER (PARTITION BY _s9.t_destaccount ORDER BY _s9.t_ts) AS _w - FROM _s0 AS _s8 - JOIN _s1 AS _s9 - ON _s8.a_key = _s9.t_destaccount - JOIN _s2 AS _s10 - ON _s10.a_key = _s9.t_sourceaccount - JOIN _t4 AS _t8 - ON _s10.a_branchkey = _t8.b_key -), _s15 AS ( - SELECT - a_custkey, - SUM(t_amount) AS sum_t_amount - FROM _t_2 - WHERE - _w = 1 - GROUP BY - 1 -) -SELECT - customers.c_key AS key, - CONCAT_WS(' ', customers.c_fname, customers.c_lname) AS name, - COALESCE(_s7.sum_t_amount, 0) AS first_sends, - COALESCE(_s15.sum_t_amount, 0) AS first_recvs -FROM crbnk.customers AS customers -LEFT JOIN _s7 AS _s7 - ON _s7.a_custkey = customers.c_key -LEFT JOIN _s15 AS _s15 - ON _s15.a_custkey = customers.c_key -ORDER BY - COALESCE(_s7.sum_t_amount, 0) + COALESCE(_s15.sum_t_amount, 0) DESC, - 1 -LIMIT 3 diff --git a/tests/test_sql_refsols/cryptbank_analysis_04_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_analysis_04_raw_sqlite.sql new file mode 100644 index 000000000..b21c053ef --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_analysis_04_raw_sqlite.sql @@ -0,0 +1,43 @@ +WITH _s3 AS ( + SELECT + t_sourceaccount, + COUNT(*) AS n_rows + FROM crbnk.transactions + WHERE + ( + 1025.67 - t_amount + ) > 9000.0 + GROUP BY + 1 +) +SELECT + CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END AS key, + CONCAT_WS(' ', LOWER(customers.c_fname), LOWER(customers.c_lname)) AS cust_name, + _s3.n_rows AS n_trans +FROM crbnk.accounts AS accounts +JOIN crbnk.customers AS customers + ON CAST(STRFTIME('%Y', DATE(customers.c_birthday, '+472 days')) AS INTEGER) <= 1985 + AND CAST(STRFTIME('%Y', DATE(customers.c_birthday, '+472 days')) AS INTEGER) >= 1980 + AND accounts.a_custkey = ( + 42 - customers.c_key + ) +JOIN _s3 AS _s3 + ON _s3.t_sourceaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END +ORDER BY + 1 diff --git a/tests/test_sql_refsols/cryptbank_analysis_04_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_analysis_04_rewrite_sqlite.sql new file mode 100644 index 000000000..b21c053ef --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_analysis_04_rewrite_sqlite.sql @@ -0,0 +1,43 @@ +WITH _s3 AS ( + SELECT + t_sourceaccount, + COUNT(*) AS n_rows + FROM crbnk.transactions + WHERE + ( + 1025.67 - t_amount + ) > 9000.0 + GROUP BY + 1 +) +SELECT + CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END AS key, + CONCAT_WS(' ', LOWER(customers.c_fname), LOWER(customers.c_lname)) AS cust_name, + _s3.n_rows AS n_trans +FROM crbnk.accounts AS accounts +JOIN crbnk.customers AS customers + ON CAST(STRFTIME('%Y', DATE(customers.c_birthday, '+472 days')) AS INTEGER) <= 1985 + AND CAST(STRFTIME('%Y', DATE(customers.c_birthday, '+472 days')) AS INTEGER) >= 1980 + AND accounts.a_custkey = ( + 42 - customers.c_key + ) +JOIN _s3 AS _s3 + ON _s3.t_sourceaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END +ORDER BY + 1 diff --git a/tests/test_sql_refsols/cryptbank_analysis_04_sqlite.sql b/tests/test_sql_refsols/cryptbank_analysis_04_sqlite.sql deleted file mode 100644 index e62e5501c..000000000 --- a/tests/test_sql_refsols/cryptbank_analysis_04_sqlite.sql +++ /dev/null @@ -1,23 +0,0 @@ -WITH _s3 AS ( - SELECT - t_sourceaccount, - COUNT(*) AS n_rows - FROM crbnk.transactions - WHERE - t_amount > 9000.0 - GROUP BY - 1 -) -SELECT - accounts.a_key AS key, - CONCAT_WS(' ', customers.c_fname, customers.c_lname) AS cust_name, - _s3.n_rows AS n_trans -FROM crbnk.accounts AS accounts -JOIN crbnk.customers AS customers - ON CAST(STRFTIME('%Y', customers.c_birthday) AS INTEGER) <= 1985 - AND CAST(STRFTIME('%Y', customers.c_birthday) AS INTEGER) >= 1980 - AND accounts.a_custkey = customers.c_key -JOIN _s3 AS _s3 - ON _s3.t_sourceaccount = accounts.a_key -ORDER BY - 1 diff --git a/tests/test_sql_refsols/cryptbank_basic_scan_topk_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_basic_scan_topk_raw_sqlite.sql new file mode 100644 index 000000000..8e9d286d1 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_basic_scan_topk_raw_sqlite.sql @@ -0,0 +1,12 @@ +SELECT + 42 - c_key AS key, + LOWER(c_fname) AS first_name, + LOWER(c_lname) AS last_name, + REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') AS phone_number, + SUBSTRING(c_email, -1) || SUBSTRING(c_email, 1, LENGTH(c_email) - 1) AS email, + SUBSTRING(c_addr, -1) || SUBSTRING(c_addr, 1, LENGTH(c_addr) - 1) AS address, + DATE(c_birthday, '+472 days') AS birthday +FROM crbnk.customers +ORDER BY + 1 +LIMIT 3 diff --git a/tests/test_sql_refsols/cryptbank_basic_scan_topk_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_basic_scan_topk_rewrite_sqlite.sql new file mode 100644 index 000000000..8e9d286d1 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_basic_scan_topk_rewrite_sqlite.sql @@ -0,0 +1,12 @@ +SELECT + 42 - c_key AS key, + LOWER(c_fname) AS first_name, + LOWER(c_lname) AS last_name, + REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') AS phone_number, + SUBSTRING(c_email, -1) || SUBSTRING(c_email, 1, LENGTH(c_email) - 1) AS email, + SUBSTRING(c_addr, -1) || SUBSTRING(c_addr, 1, LENGTH(c_addr) - 1) AS address, + DATE(c_birthday, '+472 days') AS birthday +FROM crbnk.customers +ORDER BY + 1 +LIMIT 3 diff --git a/tests/test_sql_refsols/cryptbank_basic_scan_topk_sqlite.sql b/tests/test_sql_refsols/cryptbank_basic_scan_topk_sqlite.sql deleted file mode 100644 index d07d60215..000000000 --- a/tests/test_sql_refsols/cryptbank_basic_scan_topk_sqlite.sql +++ /dev/null @@ -1,12 +0,0 @@ -SELECT - c_key AS key, - c_fname AS first_name, - c_lname AS last_name, - c_phone AS phone_number, - c_email AS email, - c_addr AS address, - c_birthday AS birthday -FROM crbnk.customers -ORDER BY - 1 -LIMIT 3 diff --git a/tests/test_sql_refsols/cryptbank_filter_count_05_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_01_raw_sqlite.sql similarity index 66% rename from tests/test_sql_refsols/cryptbank_filter_count_05_sqlite.sql rename to tests/test_sql_refsols/cryptbank_filter_count_01_raw_sqlite.sql index b9aef389b..b369e11e8 100644 --- a/tests/test_sql_refsols/cryptbank_filter_count_05_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_filter_count_01_raw_sqlite.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM crbnk.customers WHERE - c_phone LIKE '555-8%' + LOWER(c_lname) = 'lee' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_01_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_01_rewrite_sqlite.sql similarity index 66% rename from tests/test_sql_refsols/cryptbank_filter_count_01_sqlite.sql rename to tests/test_sql_refsols/cryptbank_filter_count_01_rewrite_sqlite.sql index 3f045a5ad..b369e11e8 100644 --- a/tests/test_sql_refsols/cryptbank_filter_count_01_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_filter_count_01_rewrite_sqlite.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM crbnk.customers WHERE - c_lname = 'lee' + LOWER(c_lname) = 'lee' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_02_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_02_raw_sqlite.sql similarity index 65% rename from tests/test_sql_refsols/cryptbank_filter_count_02_sqlite.sql rename to tests/test_sql_refsols/cryptbank_filter_count_02_raw_sqlite.sql index ef5fab5a0..ea6fd0c87 100644 --- a/tests/test_sql_refsols/cryptbank_filter_count_02_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_filter_count_02_raw_sqlite.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM crbnk.customers WHERE - c_lname <> 'lee' + LOWER(c_lname) <> 'lee' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_19_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_02_rewrite_sqlite.sql similarity index 65% rename from tests/test_sql_refsols/cryptbank_filter_count_19_sqlite.sql rename to tests/test_sql_refsols/cryptbank_filter_count_02_rewrite_sqlite.sql index a731768e8..ea6fd0c87 100644 --- a/tests/test_sql_refsols/cryptbank_filter_count_19_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_filter_count_02_rewrite_sqlite.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM crbnk.customers WHERE - c_email LIKE '%mail%' + LOWER(c_lname) <> 'lee' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_04_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_03_raw_sqlite.sql similarity index 50% rename from tests/test_sql_refsols/cryptbank_filter_count_04_sqlite.sql rename to tests/test_sql_refsols/cryptbank_filter_count_03_raw_sqlite.sql index 8e1d8d085..72fc896f9 100644 --- a/tests/test_sql_refsols/cryptbank_filter_count_04_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_filter_count_03_raw_sqlite.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM crbnk.customers WHERE - NOT c_lname IN ('lee', 'smith', 'rodriguez') + LOWER(c_lname) IN ('lee', 'smith', 'rodriguez') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_03_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_03_rewrite_sqlite.sql similarity index 50% rename from tests/test_sql_refsols/cryptbank_filter_count_03_sqlite.sql rename to tests/test_sql_refsols/cryptbank_filter_count_03_rewrite_sqlite.sql index f3bccb50b..72fc896f9 100644 --- a/tests/test_sql_refsols/cryptbank_filter_count_03_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_filter_count_03_rewrite_sqlite.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM crbnk.customers WHERE - c_lname IN ('lee', 'smith', 'rodriguez') + LOWER(c_lname) IN ('lee', 'smith', 'rodriguez') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_04_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_04_raw_sqlite.sql new file mode 100644 index 000000000..55f030a02 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_04_raw_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + NOT LOWER(c_lname) IN ('lee', 'smith', 'rodriguez') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_04_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_04_rewrite_sqlite.sql new file mode 100644 index 000000000..55f030a02 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_04_rewrite_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + NOT LOWER(c_lname) IN ('lee', 'smith', 'rodriguez') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_05_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_05_raw_sqlite.sql new file mode 100644 index 000000000..8205aea4b --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_05_raw_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') LIKE '555-8%' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_05_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_05_rewrite_sqlite.sql new file mode 100644 index 000000000..8205aea4b --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_05_rewrite_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') LIKE '555-8%' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_06_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_06_raw_sqlite.sql new file mode 100644 index 000000000..6e69fc127 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_06_raw_sqlite.sql @@ -0,0 +1,7 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + ( + SUBSTRING(c_email, -1) || SUBSTRING(c_email, 1, LENGTH(c_email) - 1) + ) LIKE '%gmail.com' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_06_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_06_rewrite_sqlite.sql new file mode 100644 index 000000000..6e69fc127 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_06_rewrite_sqlite.sql @@ -0,0 +1,7 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + ( + SUBSTRING(c_email, -1) || SUBSTRING(c_email, 1, LENGTH(c_email) - 1) + ) LIKE '%gmail.com' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_07_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_07_raw_sqlite.sql new file mode 100644 index 000000000..4d7c59588 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_07_raw_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + CAST(STRFTIME('%Y', DATE(c_birthday, '+472 days')) AS INTEGER) = 1978 diff --git a/tests/test_sql_refsols/cryptbank_filter_count_07_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_07_rewrite_sqlite.sql new file mode 100644 index 000000000..4d7c59588 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_07_rewrite_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + CAST(STRFTIME('%Y', DATE(c_birthday, '+472 days')) AS INTEGER) = 1978 diff --git a/tests/test_sql_refsols/cryptbank_filter_count_07_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_07_sqlite.sql deleted file mode 100644 index d2791909a..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_07_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - CAST(STRFTIME('%Y', c_birthday) AS INTEGER) = 1978 diff --git a/tests/test_sql_refsols/cryptbank_filter_count_08_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_08_raw_sqlite.sql new file mode 100644 index 000000000..392da3ba3 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_08_raw_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') = DATE('1985-04-12') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_08_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_08_rewrite_sqlite.sql new file mode 100644 index 000000000..392da3ba3 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_08_rewrite_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') = DATE('1985-04-12') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_08_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_08_sqlite.sql deleted file mode 100644 index d5673d131..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_08_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - c_birthday = '1985-04-12' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_09_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_09_raw_sqlite.sql new file mode 100644 index 000000000..b04457dca --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_09_raw_sqlite.sql @@ -0,0 +1,9 @@ +SELECT + COUNT(*) AS n +FROM crbnk.transactions +WHERE + ( + 1025.67 - t_amount + ) <= 9000 AND ( + 1025.67 - t_amount + ) >= 8000 diff --git a/tests/test_sql_refsols/cryptbank_filter_count_09_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_09_rewrite_sqlite.sql new file mode 100644 index 000000000..b04457dca --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_09_rewrite_sqlite.sql @@ -0,0 +1,9 @@ +SELECT + COUNT(*) AS n +FROM crbnk.transactions +WHERE + ( + 1025.67 - t_amount + ) <= 9000 AND ( + 1025.67 - t_amount + ) >= 8000 diff --git a/tests/test_sql_refsols/cryptbank_filter_count_09_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_09_sqlite.sql deleted file mode 100644 index 3f6e7288d..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_09_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.transactions -WHERE - t_amount <= 9000 AND t_amount >= 8000 diff --git a/tests/test_sql_refsols/cryptbank_filter_count_10_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_10_raw_sqlite.sql new file mode 100644 index 000000000..10749191c --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_10_raw_sqlite.sql @@ -0,0 +1,6 @@ +SELECT + COUNT(*) AS n +FROM crbnk.transactions +WHERE + DATETIME(t_ts, '+54321 seconds') <= '2021-05-20 12:00:00' + AND DATETIME(t_ts, '+54321 seconds') >= '2021-05-10 12:00:00' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_10_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_10_rewrite_sqlite.sql new file mode 100644 index 000000000..10749191c --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_10_rewrite_sqlite.sql @@ -0,0 +1,6 @@ +SELECT + COUNT(*) AS n +FROM crbnk.transactions +WHERE + DATETIME(t_ts, '+54321 seconds') <= '2021-05-20 12:00:00' + AND DATETIME(t_ts, '+54321 seconds') >= '2021-05-10 12:00:00' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_10_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_10_sqlite.sql deleted file mode 100644 index 91912038b..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_10_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.transactions -WHERE - t_ts <= '2021-05-20 12:00:00' AND t_ts >= '2021-05-10 12:00:00' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_11_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_11_raw_sqlite.sql new file mode 100644 index 000000000..6db0cea04 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_11_raw_sqlite.sql @@ -0,0 +1,18 @@ +SELECT + COUNT(*) AS n +FROM crbnk.transactions AS transactions +JOIN crbnk.accounts AS accounts + ON transactions.t_sourceaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END +JOIN crbnk.customers AS customers + ON LOWER(customers.c_fname) = 'alice' + AND accounts.a_custkey = ( + 42 - customers.c_key + ) diff --git a/tests/test_sql_refsols/cryptbank_filter_count_11_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_11_rewrite_sqlite.sql new file mode 100644 index 000000000..6db0cea04 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_11_rewrite_sqlite.sql @@ -0,0 +1,18 @@ +SELECT + COUNT(*) AS n +FROM crbnk.transactions AS transactions +JOIN crbnk.accounts AS accounts + ON transactions.t_sourceaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END +JOIN crbnk.customers AS customers + ON LOWER(customers.c_fname) = 'alice' + AND accounts.a_custkey = ( + 42 - customers.c_key + ) diff --git a/tests/test_sql_refsols/cryptbank_filter_count_11_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_11_sqlite.sql deleted file mode 100644 index 0eb95cc09..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_11_sqlite.sql +++ /dev/null @@ -1,7 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.transactions AS transactions -JOIN crbnk.accounts AS accounts - ON accounts.a_key = transactions.t_sourceaccount -JOIN crbnk.customers AS customers - ON accounts.a_custkey = customers.c_key AND customers.c_fname = 'alice' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_12_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_12_raw_sqlite.sql new file mode 100644 index 000000000..a6e535d81 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_12_raw_sqlite.sql @@ -0,0 +1,14 @@ +SELECT + COUNT(*) AS n +FROM crbnk.transactions AS transactions +JOIN crbnk.accounts AS accounts + ON CAST(STRFTIME('%Y', DATETIME(accounts.a_open_ts, '+123456789 seconds')) AS INTEGER) = CAST(STRFTIME('%Y', DATETIME(transactions.t_ts, '+54321 seconds')) AS INTEGER) + AND transactions.t_sourceaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END diff --git a/tests/test_sql_refsols/cryptbank_filter_count_12_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_12_rewrite_sqlite.sql new file mode 100644 index 000000000..a6e535d81 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_12_rewrite_sqlite.sql @@ -0,0 +1,14 @@ +SELECT + COUNT(*) AS n +FROM crbnk.transactions AS transactions +JOIN crbnk.accounts AS accounts + ON CAST(STRFTIME('%Y', DATETIME(accounts.a_open_ts, '+123456789 seconds')) AS INTEGER) = CAST(STRFTIME('%Y', DATETIME(transactions.t_ts, '+54321 seconds')) AS INTEGER) + AND transactions.t_sourceaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END diff --git a/tests/test_sql_refsols/cryptbank_filter_count_12_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_12_sqlite.sql deleted file mode 100644 index 834c05164..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_12_sqlite.sql +++ /dev/null @@ -1,6 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.transactions AS transactions -JOIN crbnk.accounts AS accounts - ON CAST(STRFTIME('%Y', accounts.a_open_ts) AS INTEGER) = CAST(STRFTIME('%Y', transactions.t_ts) AS INTEGER) - AND accounts.a_key = transactions.t_sourceaccount diff --git a/tests/test_sql_refsols/cryptbank_filter_count_13_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_13_raw_sqlite.sql new file mode 100644 index 000000000..c0a52a724 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_13_raw_sqlite.sql @@ -0,0 +1,14 @@ +SELECT + COUNT(*) AS n +FROM crbnk.transactions AS transactions +JOIN crbnk.accounts AS accounts + ON DATETIME(DATETIME(accounts.a_open_ts, '+123456789 seconds'), '2 year') > DATETIME(transactions.t_ts, '+54321 seconds') + AND transactions.t_destaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END diff --git a/tests/test_sql_refsols/cryptbank_filter_count_13_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_13_rewrite_sqlite.sql new file mode 100644 index 000000000..c0a52a724 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_13_rewrite_sqlite.sql @@ -0,0 +1,14 @@ +SELECT + COUNT(*) AS n +FROM crbnk.transactions AS transactions +JOIN crbnk.accounts AS accounts + ON DATETIME(DATETIME(accounts.a_open_ts, '+123456789 seconds'), '2 year') > DATETIME(transactions.t_ts, '+54321 seconds') + AND transactions.t_destaccount = CASE + WHEN accounts.a_key = 0 + THEN 0 + ELSE CASE WHEN accounts.a_key > 0 THEN 1 ELSE -1 END * CAST(SUBSTRING( + accounts.a_key, + 1 + INSTR(accounts.a_key, '-'), + CAST(LENGTH(accounts.a_key) AS REAL) / 2 + ) AS INTEGER) + END diff --git a/tests/test_sql_refsols/cryptbank_filter_count_13_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_13_sqlite.sql deleted file mode 100644 index d505a52ea..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_13_sqlite.sql +++ /dev/null @@ -1,6 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.transactions AS transactions -JOIN crbnk.accounts AS accounts - ON accounts.a_key = transactions.t_destaccount - AND transactions.t_ts < DATETIME(accounts.a_open_ts, '2 year') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_14_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_14_raw_sqlite.sql new file mode 100644 index 000000000..d70b6decd --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_14_raw_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + LOWER(c_fname) LIKE '%e' OR LOWER(c_lname) LIKE '%e' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_14_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_14_rewrite_sqlite.sql new file mode 100644 index 000000000..d70b6decd --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_14_rewrite_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + LOWER(c_fname) LIKE '%e' OR LOWER(c_lname) LIKE '%e' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_14_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_14_sqlite.sql deleted file mode 100644 index 2680b210d..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_14_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - c_fname LIKE '%e' OR c_lname LIKE '%e' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_15_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_15_raw_sqlite.sql similarity index 58% rename from tests/test_sql_refsols/cryptbank_filter_count_15_sqlite.sql rename to tests/test_sql_refsols/cryptbank_filter_count_15_raw_sqlite.sql index 27f30ca27..3e6a6153f 100644 --- a/tests/test_sql_refsols/cryptbank_filter_count_15_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_filter_count_15_raw_sqlite.sql @@ -3,7 +3,9 @@ WITH _u_0 AS ( a_custkey AS _u_1 FROM crbnk.accounts WHERE - a_type = 'retirement' + ( + SUBSTRING(a_type, -1) || SUBSTRING(a_type, 1, LENGTH(a_type) - 1) + ) = 'retirement' GROUP BY 1 ) @@ -11,6 +13,8 @@ SELECT COUNT(*) AS n FROM crbnk.customers AS customers LEFT JOIN _u_0 AS _u_0 - ON _u_0._u_1 = customers.c_key + ON _u_0._u_1 = ( + 42 - customers.c_key + ) WHERE NOT _u_0._u_1 IS NULL diff --git a/tests/test_sql_refsols/cryptbank_filter_count_16_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_15_rewrite_sqlite.sql similarity index 58% rename from tests/test_sql_refsols/cryptbank_filter_count_16_sqlite.sql rename to tests/test_sql_refsols/cryptbank_filter_count_15_rewrite_sqlite.sql index 4536ff233..3e6a6153f 100644 --- a/tests/test_sql_refsols/cryptbank_filter_count_16_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_filter_count_15_rewrite_sqlite.sql @@ -3,7 +3,9 @@ WITH _u_0 AS ( a_custkey AS _u_1 FROM crbnk.accounts WHERE - a_type <> 'checking' AND a_type <> 'savings' + ( + SUBSTRING(a_type, -1) || SUBSTRING(a_type, 1, LENGTH(a_type) - 1) + ) = 'retirement' GROUP BY 1 ) @@ -11,6 +13,8 @@ SELECT COUNT(*) AS n FROM crbnk.customers AS customers LEFT JOIN _u_0 AS _u_0 - ON _u_0._u_1 = customers.c_key + ON _u_0._u_1 = ( + 42 - customers.c_key + ) WHERE NOT _u_0._u_1 IS NULL diff --git a/tests/test_sql_refsols/cryptbank_filter_count_16_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_16_raw_sqlite.sql new file mode 100644 index 000000000..a6924f0b2 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_16_raw_sqlite.sql @@ -0,0 +1,23 @@ +WITH _u_0 AS ( + SELECT + a_custkey AS _u_1 + FROM crbnk.accounts + WHERE + ( + SUBSTRING(a_type, -1) || SUBSTRING(a_type, 1, LENGTH(a_type) - 1) + ) <> 'checking' + AND ( + SUBSTRING(a_type, -1) || SUBSTRING(a_type, 1, LENGTH(a_type) - 1) + ) <> 'savings' + GROUP BY + 1 +) +SELECT + COUNT(*) AS n +FROM crbnk.customers AS customers +LEFT JOIN _u_0 AS _u_0 + ON _u_0._u_1 = ( + 42 - customers.c_key + ) +WHERE + NOT _u_0._u_1 IS NULL diff --git a/tests/test_sql_refsols/cryptbank_filter_count_16_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_16_rewrite_sqlite.sql new file mode 100644 index 000000000..a6924f0b2 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_16_rewrite_sqlite.sql @@ -0,0 +1,23 @@ +WITH _u_0 AS ( + SELECT + a_custkey AS _u_1 + FROM crbnk.accounts + WHERE + ( + SUBSTRING(a_type, -1) || SUBSTRING(a_type, 1, LENGTH(a_type) - 1) + ) <> 'checking' + AND ( + SUBSTRING(a_type, -1) || SUBSTRING(a_type, 1, LENGTH(a_type) - 1) + ) <> 'savings' + GROUP BY + 1 +) +SELECT + COUNT(*) AS n +FROM crbnk.customers AS customers +LEFT JOIN _u_0 AS _u_0 + ON _u_0._u_1 = ( + 42 - customers.c_key + ) +WHERE + NOT _u_0._u_1 IS NULL diff --git a/tests/test_sql_refsols/cryptbank_filter_count_06_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_17_raw_sqlite.sql similarity index 55% rename from tests/test_sql_refsols/cryptbank_filter_count_06_sqlite.sql rename to tests/test_sql_refsols/cryptbank_filter_count_17_raw_sqlite.sql index 77defbdba..4384b15de 100644 --- a/tests/test_sql_refsols/cryptbank_filter_count_06_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_filter_count_17_raw_sqlite.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM crbnk.customers WHERE - c_email LIKE '%gmail.com' + SUBSTRING(LOWER(c_fname), 2, 1) = 'a' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_17_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_17_rewrite_sqlite.sql new file mode 100644 index 000000000..4384b15de --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_17_rewrite_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + SUBSTRING(LOWER(c_fname), 2, 1) = 'a' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_17_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_17_sqlite.sql deleted file mode 100644 index ec22bd570..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_17_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - SUBSTRING(c_fname, 2, 1) = 'a' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_18_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_18_raw_sqlite.sql new file mode 100644 index 000000000..598be0fcf --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_18_raw_sqlite.sql @@ -0,0 +1,7 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + ( + SUBSTRING(c_email, -1) || SUBSTRING(c_email, 1, LENGTH(c_email) - 1) + ) LIKE '%.%@%mail%' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_18_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_18_rewrite_sqlite.sql new file mode 100644 index 000000000..598be0fcf --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_18_rewrite_sqlite.sql @@ -0,0 +1,7 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + ( + SUBSTRING(c_email, -1) || SUBSTRING(c_email, 1, LENGTH(c_email) - 1) + ) LIKE '%.%@%mail%' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_18_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_18_sqlite.sql deleted file mode 100644 index f103c15a9..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_18_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - c_email LIKE '%.%@%mail%' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_19_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_19_raw_sqlite.sql new file mode 100644 index 000000000..565b89e92 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_19_raw_sqlite.sql @@ -0,0 +1,7 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + ( + SUBSTRING(c_email, -1) || SUBSTRING(c_email, 1, LENGTH(c_email) - 1) + ) LIKE '%mail%' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_19_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_19_rewrite_sqlite.sql new file mode 100644 index 000000000..565b89e92 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_19_rewrite_sqlite.sql @@ -0,0 +1,7 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + ( + SUBSTRING(c_email, -1) || SUBSTRING(c_email, 1, LENGTH(c_email) - 1) + ) LIKE '%mail%' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_20_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_20_raw_sqlite.sql new file mode 100644 index 000000000..5bf9a250d --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_20_raw_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') > DATE('1991-11-15') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_20_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_20_rewrite_sqlite.sql new file mode 100644 index 000000000..5bf9a250d --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_20_rewrite_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') > DATE('1991-11-15') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_20_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_20_sqlite.sql deleted file mode 100644 index d227806f3..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_20_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - c_birthday > '1991-11-15' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_21_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_21_raw_sqlite.sql new file mode 100644 index 000000000..d20b706ad --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_21_raw_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') >= DATE('1991-11-15') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_21_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_21_rewrite_sqlite.sql new file mode 100644 index 000000000..d20b706ad --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_21_rewrite_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') >= DATE('1991-11-15') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_21_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_21_sqlite.sql deleted file mode 100644 index 8cbcc53cd..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_21_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - c_birthday >= '1991-11-15' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_22_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_22_raw_sqlite.sql new file mode 100644 index 000000000..b370979ce --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_22_raw_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') < DATE('1991-11-15') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_22_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_22_rewrite_sqlite.sql new file mode 100644 index 000000000..b370979ce --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_22_rewrite_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') < DATE('1991-11-15') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_22_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_22_sqlite.sql deleted file mode 100644 index b85139def..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_22_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - c_birthday < '1991-11-15' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_23_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_23_raw_sqlite.sql new file mode 100644 index 000000000..05f9bc494 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_23_raw_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') <= DATE('1991-11-15') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_23_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_23_rewrite_sqlite.sql new file mode 100644 index 000000000..05f9bc494 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_23_rewrite_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') <= DATE('1991-11-15') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_23_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_23_sqlite.sql deleted file mode 100644 index a775f1b68..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_23_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - c_birthday <= '1991-11-15' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_24_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_24_raw_sqlite.sql new file mode 100644 index 000000000..94ad1441f --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_24_raw_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') = DATE('1991-11-15') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_24_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_24_rewrite_sqlite.sql new file mode 100644 index 000000000..94ad1441f --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_24_rewrite_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') = DATE('1991-11-15') diff --git a/tests/test_sql_refsols/cryptbank_filter_count_24_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_24_sqlite.sql deleted file mode 100644 index 33f914911..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_24_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - c_birthday = '1991-11-15' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_25_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_25_raw_sqlite.sql new file mode 100644 index 000000000..9f698eb20 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_25_raw_sqlite.sql @@ -0,0 +1,6 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') <> DATE('1991-11-15') + OR DATE(c_birthday, '+472 days') IS NULL diff --git a/tests/test_sql_refsols/cryptbank_filter_count_25_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_25_rewrite_sqlite.sql new file mode 100644 index 000000000..9f698eb20 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_25_rewrite_sqlite.sql @@ -0,0 +1,6 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + DATE(c_birthday, '+472 days') <> DATE('1991-11-15') + OR DATE(c_birthday, '+472 days') IS NULL diff --git a/tests/test_sql_refsols/cryptbank_filter_count_25_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_25_sqlite.sql deleted file mode 100644 index 1cd2e7967..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_25_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - c_birthday <> '1991-11-15' OR c_birthday IS NULL diff --git a/tests/test_sql_refsols/cryptbank_filter_count_26_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_26_raw_sqlite.sql new file mode 100644 index 000000000..910277464 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_26_raw_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') = '555-123-456' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_26_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_26_rewrite_sqlite.sql new file mode 100644 index 000000000..910277464 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_26_rewrite_sqlite.sql @@ -0,0 +1,5 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') = '555-123-456' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_26_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_26_sqlite.sql deleted file mode 100644 index 23630281e..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_26_sqlite.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - c_phone = '555-123-456' diff --git a/tests/test_sql_refsols/cryptbank_filter_count_27_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_27_raw_sqlite.sql new file mode 100644 index 000000000..61d66382d --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_27_raw_sqlite.sql @@ -0,0 +1,39 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + ( + DATE(c_birthday, '+472 days') IS NULL + OR LOWER(c_fname) LIKE '%a' + OR LOWER(c_fname) LIKE '%e' + OR LOWER(c_fname) LIKE '%s' + ) + AND ( + DATE(c_birthday, '+472 days') IS NULL OR LOWER(c_lname) <> 'lopez' + ) + AND ( + DATE(c_birthday, '+472 days') IS NULL + OR NOT ( + SUBSTRING(c_addr, -1) || SUBSTRING(c_addr, 1, LENGTH(c_addr) - 1) + ) IS NULL + ) + AND ( + LOWER(c_fname) LIKE '%a' + OR LOWER(c_fname) LIKE '%e' + OR LOWER(c_fname) LIKE '%s' + OR REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') LIKE '%5' + ) + AND ( + LOWER(c_lname) <> 'lopez' + OR REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') LIKE '%5' + ) + AND ( + NOT ( + SUBSTRING(c_addr, -1) || SUBSTRING(c_addr, 1, LENGTH(c_addr) - 1) + ) IS NULL + OR REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') LIKE '%5' + ) + AND ( + NOT DATE(c_birthday, '+472 days') IS NULL + OR REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') LIKE '%5' + ) diff --git a/tests/test_sql_refsols/cryptbank_filter_count_27_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_27_rewrite_sqlite.sql new file mode 100644 index 000000000..61d66382d --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_27_rewrite_sqlite.sql @@ -0,0 +1,39 @@ +SELECT + COUNT(*) AS n +FROM crbnk.customers +WHERE + ( + DATE(c_birthday, '+472 days') IS NULL + OR LOWER(c_fname) LIKE '%a' + OR LOWER(c_fname) LIKE '%e' + OR LOWER(c_fname) LIKE '%s' + ) + AND ( + DATE(c_birthday, '+472 days') IS NULL OR LOWER(c_lname) <> 'lopez' + ) + AND ( + DATE(c_birthday, '+472 days') IS NULL + OR NOT ( + SUBSTRING(c_addr, -1) || SUBSTRING(c_addr, 1, LENGTH(c_addr) - 1) + ) IS NULL + ) + AND ( + LOWER(c_fname) LIKE '%a' + OR LOWER(c_fname) LIKE '%e' + OR LOWER(c_fname) LIKE '%s' + OR REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') LIKE '%5' + ) + AND ( + LOWER(c_lname) <> 'lopez' + OR REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') LIKE '%5' + ) + AND ( + NOT ( + SUBSTRING(c_addr, -1) || SUBSTRING(c_addr, 1, LENGTH(c_addr) - 1) + ) IS NULL + OR REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') LIKE '%5' + ) + AND ( + NOT DATE(c_birthday, '+472 days') IS NULL + OR REPLACE(REPLACE(REPLACE(c_phone, '9', '*'), '0', '9'), '*', '0') LIKE '%5' + ) diff --git a/tests/test_sql_refsols/cryptbank_filter_count_27_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_27_sqlite.sql deleted file mode 100644 index 76b22c02b..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_27_sqlite.sql +++ /dev/null @@ -1,25 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.customers -WHERE - ( - NOT c_addr IS NULL OR c_birthday IS NULL - ) - AND ( - NOT c_addr IS NULL OR c_phone LIKE '%5' - ) - AND ( - NOT c_birthday IS NULL OR c_phone LIKE '%5' - ) - AND ( - c_birthday IS NULL OR c_fname LIKE '%a' OR c_fname LIKE '%e' OR c_fname LIKE '%s' - ) - AND ( - c_birthday IS NULL OR c_lname <> 'lopez' - ) - AND ( - c_fname LIKE '%a' OR c_fname LIKE '%e' OR c_fname LIKE '%s' OR c_phone LIKE '%5' - ) - AND ( - c_lname <> 'lopez' OR c_phone LIKE '%5' - ) diff --git a/tests/test_sql_refsols/cryptbank_filter_count_28_raw_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_28_raw_sqlite.sql new file mode 100644 index 000000000..2b59d7a7d --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_28_raw_sqlite.sql @@ -0,0 +1,26 @@ +SELECT + COUNT(*) AS n +FROM crbnk.accounts AS accounts +JOIN crbnk.customers AS customers + ON ( + ( + SUBSTRING(customers.c_email, -1) || SUBSTRING(customers.c_email, 1, LENGTH(customers.c_email) - 1) + ) LIKE '%gmail%' + OR ( + SUBSTRING(customers.c_email, -1) || SUBSTRING(customers.c_email, 1, LENGTH(customers.c_email) - 1) + ) LIKE '%outlook%' + ) + AND accounts.a_custkey = ( + 42 - customers.c_key + ) +WHERE + ( + ( + SUBSTRING(accounts.a_type, -1) || SUBSTRING(accounts.a_type, 1, LENGTH(accounts.a_type) - 1) + ) = 'retirement' + OR ( + SUBSTRING(accounts.a_type, -1) || SUBSTRING(accounts.a_type, 1, LENGTH(accounts.a_type) - 1) + ) = 'savings' + ) + AND CAST(STRFTIME('%Y', DATETIME(accounts.a_open_ts, '+123456789 seconds')) AS INTEGER) < 2020 + AND SQRT(accounts.a_balance) >= 5000 diff --git a/tests/test_sql_refsols/cryptbank_filter_count_28_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_28_rewrite_sqlite.sql new file mode 100644 index 000000000..2b59d7a7d --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_filter_count_28_rewrite_sqlite.sql @@ -0,0 +1,26 @@ +SELECT + COUNT(*) AS n +FROM crbnk.accounts AS accounts +JOIN crbnk.customers AS customers + ON ( + ( + SUBSTRING(customers.c_email, -1) || SUBSTRING(customers.c_email, 1, LENGTH(customers.c_email) - 1) + ) LIKE '%gmail%' + OR ( + SUBSTRING(customers.c_email, -1) || SUBSTRING(customers.c_email, 1, LENGTH(customers.c_email) - 1) + ) LIKE '%outlook%' + ) + AND accounts.a_custkey = ( + 42 - customers.c_key + ) +WHERE + ( + ( + SUBSTRING(accounts.a_type, -1) || SUBSTRING(accounts.a_type, 1, LENGTH(accounts.a_type) - 1) + ) = 'retirement' + OR ( + SUBSTRING(accounts.a_type, -1) || SUBSTRING(accounts.a_type, 1, LENGTH(accounts.a_type) - 1) + ) = 'savings' + ) + AND CAST(STRFTIME('%Y', DATETIME(accounts.a_open_ts, '+123456789 seconds')) AS INTEGER) < 2020 + AND SQRT(accounts.a_balance) >= 5000 diff --git a/tests/test_sql_refsols/cryptbank_filter_count_28_sqlite.sql b/tests/test_sql_refsols/cryptbank_filter_count_28_sqlite.sql deleted file mode 100644 index 2c1118ec9..000000000 --- a/tests/test_sql_refsols/cryptbank_filter_count_28_sqlite.sql +++ /dev/null @@ -1,14 +0,0 @@ -SELECT - COUNT(*) AS n -FROM crbnk.accounts AS accounts -JOIN crbnk.customers AS customers - ON accounts.a_custkey = customers.c_key - AND ( - customers.c_email LIKE '%gmail%' OR customers.c_email LIKE '%outlook%' - ) -WHERE - CAST(STRFTIME('%Y', accounts.a_open_ts) AS INTEGER) < 2020 - AND accounts.a_balance >= 5000 - AND ( - accounts.a_type = 'retirement' OR accounts.a_type = 'savings' - ) diff --git a/tests/test_sql_refsols/cryptbank_general_join_01_sqlite.sql b/tests/test_sql_refsols/cryptbank_general_join_01_raw_sqlite.sql similarity index 55% rename from tests/test_sql_refsols/cryptbank_general_join_01_sqlite.sql rename to tests/test_sql_refsols/cryptbank_general_join_01_raw_sqlite.sql index 393da7c16..eef2a3632 100644 --- a/tests/test_sql_refsols/cryptbank_general_join_01_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_general_join_01_raw_sqlite.sql @@ -10,70 +10,76 @@ WITH _s0 AS ( FROM crbnk.customers ), _s7 AS ( SELECT + ( + 42 - ( + _s3.c_key + ) + ) AS unmask_c_key, _s2.b_key, - _s3.c_key, COUNT(*) AS n_rows FROM _s0 AS _s2 JOIN _s1 AS _s3 ON SUBSTRING( - _s2.b_addr, + SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1), CASE WHEN ( - LENGTH(_s2.b_addr) + -7 + LENGTH(SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1)) + -7 ) < 1 THEN 1 ELSE ( - LENGTH(_s2.b_addr) + -7 + LENGTH(SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1)) + -7 ) END, CASE WHEN ( - LENGTH(_s2.b_addr) + -5 + LENGTH(SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1)) + -5 ) < 1 THEN 0 ELSE ( - LENGTH(_s2.b_addr) + -5 + LENGTH(SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1)) + -5 ) - CASE WHEN ( - LENGTH(_s2.b_addr) + -7 + LENGTH(SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1)) + -7 ) < 1 THEN 1 ELSE ( - LENGTH(_s2.b_addr) + -7 + LENGTH(SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1)) + -7 ) END END ) = SUBSTRING( - _s3.c_addr, + _s2.b_addr, CASE WHEN ( - LENGTH(_s3.c_addr) + -7 + LENGTH(_s2.b_addr) + -7 ) < 1 THEN 1 ELSE ( - LENGTH(_s3.c_addr) + -7 + LENGTH(_s2.b_addr) + -7 ) END, CASE WHEN ( - LENGTH(_s3.c_addr) + -5 + LENGTH(_s2.b_addr) + -5 ) < 1 THEN 0 ELSE ( - LENGTH(_s3.c_addr) + -5 + LENGTH(_s2.b_addr) + -5 ) - CASE WHEN ( - LENGTH(_s3.c_addr) + -7 + LENGTH(_s2.b_addr) + -7 ) < 1 THEN 1 ELSE ( - LENGTH(_s3.c_addr) + -7 + LENGTH(_s2.b_addr) + -7 ) END END ) JOIN crbnk.accounts AS accounts - ON _s2.b_key = accounts.a_branchkey AND _s3.c_key = accounts.a_custkey + ON _s2.b_key = accounts.a_branchkey AND accounts.a_custkey = ( + 42 - _s3.c_key + ) GROUP BY 1, 2 @@ -85,63 +91,65 @@ SELECT FROM _s0 AS _s0 JOIN _s1 AS _s1 ON SUBSTRING( - _s0.b_addr, + SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1), CASE WHEN ( - LENGTH(_s0.b_addr) + -7 + LENGTH(SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1)) + -7 ) < 1 THEN 1 ELSE ( - LENGTH(_s0.b_addr) + -7 + LENGTH(SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1)) + -7 ) END, CASE WHEN ( - LENGTH(_s0.b_addr) + -5 + LENGTH(SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1)) + -5 ) < 1 THEN 0 ELSE ( - LENGTH(_s0.b_addr) + -5 + LENGTH(SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1)) + -5 ) - CASE WHEN ( - LENGTH(_s0.b_addr) + -7 + LENGTH(SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1)) + -7 ) < 1 THEN 1 ELSE ( - LENGTH(_s0.b_addr) + -7 + LENGTH(SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1)) + -7 ) END END ) = SUBSTRING( - _s1.c_addr, + _s0.b_addr, CASE WHEN ( - LENGTH(_s1.c_addr) + -7 + LENGTH(_s0.b_addr) + -7 ) < 1 THEN 1 ELSE ( - LENGTH(_s1.c_addr) + -7 + LENGTH(_s0.b_addr) + -7 ) END, CASE WHEN ( - LENGTH(_s1.c_addr) + -5 + LENGTH(_s0.b_addr) + -5 ) < 1 THEN 0 ELSE ( - LENGTH(_s1.c_addr) + -5 + LENGTH(_s0.b_addr) + -5 ) - CASE WHEN ( - LENGTH(_s1.c_addr) + -7 + LENGTH(_s0.b_addr) + -7 ) < 1 THEN 1 ELSE ( - LENGTH(_s1.c_addr) + -7 + LENGTH(_s0.b_addr) + -7 ) END END ) LEFT JOIN _s7 AS _s7 - ON _s0.b_key = _s7.b_key AND _s1.c_key = _s7.c_key + ON _s0.b_key = _s7.b_key AND _s7.unmask_c_key = ( + 42 - _s1.c_key + ) GROUP BY 1 diff --git a/tests/test_sql_refsols/cryptbank_general_join_01_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_general_join_01_rewrite_sqlite.sql new file mode 100644 index 000000000..eef2a3632 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_general_join_01_rewrite_sqlite.sql @@ -0,0 +1,155 @@ +WITH _s0 AS ( + SELECT + b_addr, + b_key + FROM crbnk.branches +), _s1 AS ( + SELECT + c_addr, + c_key + FROM crbnk.customers +), _s7 AS ( + SELECT + ( + 42 - ( + _s3.c_key + ) + ) AS unmask_c_key, + _s2.b_key, + COUNT(*) AS n_rows + FROM _s0 AS _s2 + JOIN _s1 AS _s3 + ON SUBSTRING( + SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1), + CASE + WHEN ( + LENGTH(SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1)) + -7 + ) < 1 + THEN 1 + ELSE ( + LENGTH(SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1)) + -7 + ) + END, + CASE + WHEN ( + LENGTH(SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1)) + -5 + ) < 1 + THEN 0 + ELSE ( + LENGTH(SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1)) + -5 + ) - CASE + WHEN ( + LENGTH(SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1)) + -7 + ) < 1 + THEN 1 + ELSE ( + LENGTH(SUBSTRING(_s3.c_addr, -1) || SUBSTRING(_s3.c_addr, 1, LENGTH(_s3.c_addr) - 1)) + -7 + ) + END + END + ) = SUBSTRING( + _s2.b_addr, + CASE + WHEN ( + LENGTH(_s2.b_addr) + -7 + ) < 1 + THEN 1 + ELSE ( + LENGTH(_s2.b_addr) + -7 + ) + END, + CASE + WHEN ( + LENGTH(_s2.b_addr) + -5 + ) < 1 + THEN 0 + ELSE ( + LENGTH(_s2.b_addr) + -5 + ) - CASE + WHEN ( + LENGTH(_s2.b_addr) + -7 + ) < 1 + THEN 1 + ELSE ( + LENGTH(_s2.b_addr) + -7 + ) + END + END + ) + JOIN crbnk.accounts AS accounts + ON _s2.b_key = accounts.a_branchkey AND accounts.a_custkey = ( + 42 - _s3.c_key + ) + GROUP BY + 1, + 2 +) +SELECT + _s0.b_key AS branch_key, + COUNT(*) AS n_local_cust, + COALESCE(SUM(_s7.n_rows), 0) AS n_local_cust_local_acct +FROM _s0 AS _s0 +JOIN _s1 AS _s1 + ON SUBSTRING( + SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1), + CASE + WHEN ( + LENGTH(SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1)) + -7 + ) < 1 + THEN 1 + ELSE ( + LENGTH(SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1)) + -7 + ) + END, + CASE + WHEN ( + LENGTH(SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1)) + -5 + ) < 1 + THEN 0 + ELSE ( + LENGTH(SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1)) + -5 + ) - CASE + WHEN ( + LENGTH(SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1)) + -7 + ) < 1 + THEN 1 + ELSE ( + LENGTH(SUBSTRING(_s1.c_addr, -1) || SUBSTRING(_s1.c_addr, 1, LENGTH(_s1.c_addr) - 1)) + -7 + ) + END + END + ) = SUBSTRING( + _s0.b_addr, + CASE + WHEN ( + LENGTH(_s0.b_addr) + -7 + ) < 1 + THEN 1 + ELSE ( + LENGTH(_s0.b_addr) + -7 + ) + END, + CASE + WHEN ( + LENGTH(_s0.b_addr) + -5 + ) < 1 + THEN 0 + ELSE ( + LENGTH(_s0.b_addr) + -5 + ) - CASE + WHEN ( + LENGTH(_s0.b_addr) + -7 + ) < 1 + THEN 1 + ELSE ( + LENGTH(_s0.b_addr) + -7 + ) + END + END + ) +LEFT JOIN _s7 AS _s7 + ON _s0.b_key = _s7.b_key AND _s7.unmask_c_key = ( + 42 - _s1.c_key + ) +GROUP BY + 1 diff --git a/tests/test_sql_refsols/cryptbank_general_join_02_sqlite.sql b/tests/test_sql_refsols/cryptbank_general_join_02_raw_sqlite.sql similarity index 53% rename from tests/test_sql_refsols/cryptbank_general_join_02_sqlite.sql rename to tests/test_sql_refsols/cryptbank_general_join_02_raw_sqlite.sql index 6fe34f063..07c9c4cdd 100644 --- a/tests/test_sql_refsols/cryptbank_general_join_02_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_general_join_02_raw_sqlite.sql @@ -1,62 +1,78 @@ WITH _u_0 AS ( SELECT - customers.c_key AS _u_1, + ( + 42 - ( + customers.c_key + ) + ) AS _u_1, branches.b_key AS _u_2 FROM crbnk.customers AS customers JOIN crbnk.branches AS branches ON SUBSTRING( - branches.b_addr, + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1), CASE WHEN ( - LENGTH(branches.b_addr) + -7 + LENGTH( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1) + ) + -7 ) < 1 THEN 1 ELSE ( - LENGTH(branches.b_addr) + -7 + LENGTH( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1) + ) + -7 ) END, CASE WHEN ( - LENGTH(branches.b_addr) + -5 + LENGTH( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1) + ) + -5 ) < 1 THEN 0 ELSE ( - LENGTH(branches.b_addr) + -5 + LENGTH( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1) + ) + -5 ) - CASE WHEN ( - LENGTH(branches.b_addr) + -7 + LENGTH( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1) + ) + -7 ) < 1 THEN 1 ELSE ( - LENGTH(branches.b_addr) + -7 + LENGTH( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1) + ) + -7 ) END END ) = SUBSTRING( - customers.c_addr, + branches.b_addr, CASE WHEN ( - LENGTH(customers.c_addr) + -7 + LENGTH(branches.b_addr) + -7 ) < 1 THEN 1 ELSE ( - LENGTH(customers.c_addr) + -7 + LENGTH(branches.b_addr) + -7 ) END, CASE WHEN ( - LENGTH(customers.c_addr) + -5 + LENGTH(branches.b_addr) + -5 ) < 1 THEN 0 ELSE ( - LENGTH(customers.c_addr) + -5 + LENGTH(branches.b_addr) + -5 ) - CASE WHEN ( - LENGTH(customers.c_addr) + -7 + LENGTH(branches.b_addr) + -7 ) < 1 THEN 1 ELSE ( - LENGTH(customers.c_addr) + -7 + LENGTH(branches.b_addr) + -7 ) END END diff --git a/tests/test_sql_refsols/cryptbank_general_join_02_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_general_join_02_rewrite_sqlite.sql new file mode 100644 index 000000000..07c9c4cdd --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_general_join_02_rewrite_sqlite.sql @@ -0,0 +1,90 @@ +WITH _u_0 AS ( + SELECT + ( + 42 - ( + customers.c_key + ) + ) AS _u_1, + branches.b_key AS _u_2 + FROM crbnk.customers AS customers + JOIN crbnk.branches AS branches + ON SUBSTRING( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1), + CASE + WHEN ( + LENGTH( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1) + ) + -7 + ) < 1 + THEN 1 + ELSE ( + LENGTH( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1) + ) + -7 + ) + END, + CASE + WHEN ( + LENGTH( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1) + ) + -5 + ) < 1 + THEN 0 + ELSE ( + LENGTH( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1) + ) + -5 + ) - CASE + WHEN ( + LENGTH( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1) + ) + -7 + ) < 1 + THEN 1 + ELSE ( + LENGTH( + SUBSTRING(customers.c_addr, -1) || SUBSTRING(customers.c_addr, 1, LENGTH(customers.c_addr) - 1) + ) + -7 + ) + END + END + ) = SUBSTRING( + branches.b_addr, + CASE + WHEN ( + LENGTH(branches.b_addr) + -7 + ) < 1 + THEN 1 + ELSE ( + LENGTH(branches.b_addr) + -7 + ) + END, + CASE + WHEN ( + LENGTH(branches.b_addr) + -5 + ) < 1 + THEN 0 + ELSE ( + LENGTH(branches.b_addr) + -5 + ) - CASE + WHEN ( + LENGTH(branches.b_addr) + -7 + ) < 1 + THEN 1 + ELSE ( + LENGTH(branches.b_addr) + -7 + ) + END + END + ) + GROUP BY + 1, + 2 +) +SELECT + COUNT(*) AS n +FROM crbnk.accounts AS accounts +LEFT JOIN _u_0 AS _u_0 + ON _u_0._u_1 = accounts.a_custkey AND _u_0._u_2 = accounts.a_branchkey +WHERE + NOT _u_0._u_1 IS NULL diff --git a/tests/test_sql_refsols/cryptbank_partially_encrypted_scan_topk_sqlite.sql b/tests/test_sql_refsols/cryptbank_partially_encrypted_scan_topk_raw_sqlite.sql similarity index 59% rename from tests/test_sql_refsols/cryptbank_partially_encrypted_scan_topk_sqlite.sql rename to tests/test_sql_refsols/cryptbank_partially_encrypted_scan_topk_raw_sqlite.sql index 2a36197fb..9b984fdf6 100644 --- a/tests/test_sql_refsols/cryptbank_partially_encrypted_scan_topk_sqlite.sql +++ b/tests/test_sql_refsols/cryptbank_partially_encrypted_scan_topk_raw_sqlite.sql @@ -1,6 +1,6 @@ SELECT t_key AS key, - t_ts AS time_stamp + DATETIME(t_ts, '+54321 seconds') AS time_stamp FROM crbnk.transactions ORDER BY 2 DESC diff --git a/tests/test_sql_refsols/cryptbank_partially_encrypted_scan_topk_rewrite_sqlite.sql b/tests/test_sql_refsols/cryptbank_partially_encrypted_scan_topk_rewrite_sqlite.sql new file mode 100644 index 000000000..9b984fdf6 --- /dev/null +++ b/tests/test_sql_refsols/cryptbank_partially_encrypted_scan_topk_rewrite_sqlite.sql @@ -0,0 +1,7 @@ +SELECT + t_key AS key, + DATETIME(t_ts, '+54321 seconds') AS time_stamp +FROM crbnk.transactions +ORDER BY + 2 DESC +LIMIT 5 diff --git a/tests/test_sql_refsols/fsi_accounts_agg_pct_total_raw_snowflake.sql b/tests/test_sql_refsols/fsi_accounts_agg_pct_total_raw_snowflake.sql index e475c959e..3a70f2fe3 100644 --- a/tests/test_sql_refsols/fsi_accounts_agg_pct_total_raw_snowflake.sql +++ b/tests/test_sql_refsols/fsi_accounts_agg_pct_total_raw_snowflake.sql @@ -7,7 +7,7 @@ WITH _s1 AS ( 1 ) SELECT - accounts.accounttype AS acct_type, + PTY_UNPROTECT(accounts.accounttype, 'deAccount') AS acct_type, ROUND(COALESCE(_s1.sum_amount, 0) / SUM(COALESCE(_s1.sum_amount, 0)) OVER (), 2) AS pct_total_txn FROM bodo.fsi.accounts AS accounts JOIN _s1 AS _s1 diff --git a/tests/test_sql_refsols/fsi_accounts_agg_pct_total_rewrite_snowflake.sql b/tests/test_sql_refsols/fsi_accounts_agg_pct_total_rewrite_snowflake.sql index e475c959e..3a70f2fe3 100644 --- a/tests/test_sql_refsols/fsi_accounts_agg_pct_total_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/fsi_accounts_agg_pct_total_rewrite_snowflake.sql @@ -7,7 +7,7 @@ WITH _s1 AS ( 1 ) SELECT - accounts.accounttype AS acct_type, + PTY_UNPROTECT(accounts.accounttype, 'deAccount') AS acct_type, ROUND(COALESCE(_s1.sum_amount, 0) / SUM(COALESCE(_s1.sum_amount, 0)) OVER (), 2) AS pct_total_txn FROM bodo.fsi.accounts AS accounts JOIN _s1 AS _s1 diff --git a/tests/test_sql_refsols/fsi_accounts_customers_compound_a_raw_snowflake.sql b/tests/test_sql_refsols/fsi_accounts_customers_compound_a_raw_snowflake.sql index dbed069bb..b59fe5aa3 100644 --- a/tests/test_sql_refsols/fsi_accounts_customers_compound_a_raw_snowflake.sql +++ b/tests/test_sql_refsols/fsi_accounts_customers_compound_a_raw_snowflake.sql @@ -2,7 +2,7 @@ SELECT COUNT(*) AS n FROM bodo.fsi.accounts AS accounts JOIN bodo.fsi.protected_customers AS protected_customers - ON accounts.customerid = protected_customers.customerid - AND protected_customers.state = 'California' + ON PTY_UNPROTECT(protected_customers.customerid, 'deAccount') = PTY_UNPROTECT_ACCOUNT(accounts.customerid) + AND PTY_UNPROTECT(protected_customers.state, 'deAddress') = 'California' WHERE - accounts.balance < 20000 AND accounts.currency <> 'GBP' + PTY_UNPROTECT_ACCOUNT(accounts.currency) <> 'GBP' AND accounts.balance < 20000 diff --git a/tests/test_sql_refsols/fsi_accounts_customers_compound_a_rewrite_snowflake.sql b/tests/test_sql_refsols/fsi_accounts_customers_compound_a_rewrite_snowflake.sql index dbed069bb..b59fe5aa3 100644 --- a/tests/test_sql_refsols/fsi_accounts_customers_compound_a_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/fsi_accounts_customers_compound_a_rewrite_snowflake.sql @@ -2,7 +2,7 @@ SELECT COUNT(*) AS n FROM bodo.fsi.accounts AS accounts JOIN bodo.fsi.protected_customers AS protected_customers - ON accounts.customerid = protected_customers.customerid - AND protected_customers.state = 'California' + ON PTY_UNPROTECT(protected_customers.customerid, 'deAccount') = PTY_UNPROTECT_ACCOUNT(accounts.customerid) + AND PTY_UNPROTECT(protected_customers.state, 'deAddress') = 'California' WHERE - accounts.balance < 20000 AND accounts.currency <> 'GBP' + PTY_UNPROTECT_ACCOUNT(accounts.currency) <> 'GBP' AND accounts.balance < 20000 diff --git a/tests/test_sql_refsols/fsi_accounts_customers_compound_b_raw_snowflake.sql b/tests/test_sql_refsols/fsi_accounts_customers_compound_b_raw_snowflake.sql index 534dfd270..a64f3585a 100644 --- a/tests/test_sql_refsols/fsi_accounts_customers_compound_b_raw_snowflake.sql +++ b/tests/test_sql_refsols/fsi_accounts_customers_compound_b_raw_snowflake.sql @@ -2,9 +2,9 @@ SELECT COUNT(*) AS n FROM bodo.fsi.accounts AS accounts JOIN bodo.fsi.protected_customers AS protected_customers - ON NOT protected_customers.firstname IN ('Jennifer', 'Julio', 'Johnson', 'Jameson', 'Michael', 'Robert') - AND accounts.customerid = protected_customers.customerid - AND protected_customers.state IN ('Georgia', 'Alabama', 'Mississippi', 'Arkansas', 'Louisiana', 'Florida', 'South Carolina', 'North Carolina', 'Texas', 'Tennessee', 'Missouri') + ON NOT PTY_UNPROTECT(protected_customers.firstname, 'deName') IN ('Jennifer', 'Julio', 'Johnson', 'Jameson', 'Michael', 'Robert') + AND PTY_UNPROTECT(protected_customers.customerid, 'deAccount') = PTY_UNPROTECT_ACCOUNT(accounts.customerid) + AND PTY_UNPROTECT(protected_customers.state, 'deAddress') IN ('Georgia', 'Alabama', 'Mississippi', 'Arkansas', 'Louisiana', 'Florida', 'South Carolina', 'North Carolina', 'Texas', 'Tennessee', 'Missouri') WHERE - YEAR(CAST(accounts.createddate AS TIMESTAMP)) <= 2022 - AND accounts.currency IN ('USD', 'GPB', 'EUR', 'JPY', 'AUD') + PTY_UNPROTECT_ACCOUNT(accounts.currency) IN ('USD', 'GPB', 'EUR', 'JPY', 'AUD') + AND YEAR(CAST(PTY_UNPROTECT_DOB(accounts.createddate) AS TIMESTAMP)) <= 2022 diff --git a/tests/test_sql_refsols/fsi_accounts_customers_compound_b_rewrite_snowflake.sql b/tests/test_sql_refsols/fsi_accounts_customers_compound_b_rewrite_snowflake.sql index 534dfd270..a64f3585a 100644 --- a/tests/test_sql_refsols/fsi_accounts_customers_compound_b_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/fsi_accounts_customers_compound_b_rewrite_snowflake.sql @@ -2,9 +2,9 @@ SELECT COUNT(*) AS n FROM bodo.fsi.accounts AS accounts JOIN bodo.fsi.protected_customers AS protected_customers - ON NOT protected_customers.firstname IN ('Jennifer', 'Julio', 'Johnson', 'Jameson', 'Michael', 'Robert') - AND accounts.customerid = protected_customers.customerid - AND protected_customers.state IN ('Georgia', 'Alabama', 'Mississippi', 'Arkansas', 'Louisiana', 'Florida', 'South Carolina', 'North Carolina', 'Texas', 'Tennessee', 'Missouri') + ON NOT PTY_UNPROTECT(protected_customers.firstname, 'deName') IN ('Jennifer', 'Julio', 'Johnson', 'Jameson', 'Michael', 'Robert') + AND PTY_UNPROTECT(protected_customers.customerid, 'deAccount') = PTY_UNPROTECT_ACCOUNT(accounts.customerid) + AND PTY_UNPROTECT(protected_customers.state, 'deAddress') IN ('Georgia', 'Alabama', 'Mississippi', 'Arkansas', 'Louisiana', 'Florida', 'South Carolina', 'North Carolina', 'Texas', 'Tennessee', 'Missouri') WHERE - YEAR(CAST(accounts.createddate AS TIMESTAMP)) <= 2022 - AND accounts.currency IN ('USD', 'GPB', 'EUR', 'JPY', 'AUD') + PTY_UNPROTECT_ACCOUNT(accounts.currency) IN ('USD', 'GPB', 'EUR', 'JPY', 'AUD') + AND YEAR(CAST(PTY_UNPROTECT_DOB(accounts.createddate) AS TIMESTAMP)) <= 2022 diff --git a/tests/test_sql_refsols/fsi_accounts_customers_compound_c_raw_snowflake.sql b/tests/test_sql_refsols/fsi_accounts_customers_compound_c_raw_snowflake.sql index f575485dc..8c5b82203 100644 --- a/tests/test_sql_refsols/fsi_accounts_customers_compound_c_raw_snowflake.sql +++ b/tests/test_sql_refsols/fsi_accounts_customers_compound_c_raw_snowflake.sql @@ -3,16 +3,20 @@ SELECT FROM bodo.fsi.accounts WHERE ( - createddate <= '2020-03-13' OR createddate >= '2022-12-25' + PTY_UNPROTECT_DOB(createddate) <= '2020-03-13' + OR PTY_UNPROTECT_DOB(createddate) >= '2022-12-25' ) AND ( - createddate <= '2023-01-15' OR createddate >= '2024-08-04' + PTY_UNPROTECT_DOB(createddate) <= '2023-01-15' + OR PTY_UNPROTECT_DOB(createddate) >= '2024-08-04' ) AND ( - createddate <= '2024-11-08' OR createddate >= '2022-12-25' + PTY_UNPROTECT_DOB(createddate) <= '2024-11-08' + OR PTY_UNPROTECT_DOB(createddate) >= '2022-12-25' ) AND ( - createddate <= '2024-11-08' OR createddate >= '2025-06-07' + PTY_UNPROTECT_DOB(createddate) <= '2024-11-08' + OR PTY_UNPROTECT_DOB(createddate) >= '2025-06-07' ) - AND createddate <= '2026-03-07' - AND createddate >= '2020-01-31' + AND PTY_UNPROTECT_DOB(createddate) <= '2026-03-07' + AND PTY_UNPROTECT_DOB(createddate) >= '2020-01-31' diff --git a/tests/test_sql_refsols/fsi_accounts_customers_compound_c_rewrite_snowflake.sql b/tests/test_sql_refsols/fsi_accounts_customers_compound_c_rewrite_snowflake.sql index f575485dc..8c5b82203 100644 --- a/tests/test_sql_refsols/fsi_accounts_customers_compound_c_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/fsi_accounts_customers_compound_c_rewrite_snowflake.sql @@ -3,16 +3,20 @@ SELECT FROM bodo.fsi.accounts WHERE ( - createddate <= '2020-03-13' OR createddate >= '2022-12-25' + PTY_UNPROTECT_DOB(createddate) <= '2020-03-13' + OR PTY_UNPROTECT_DOB(createddate) >= '2022-12-25' ) AND ( - createddate <= '2023-01-15' OR createddate >= '2024-08-04' + PTY_UNPROTECT_DOB(createddate) <= '2023-01-15' + OR PTY_UNPROTECT_DOB(createddate) >= '2024-08-04' ) AND ( - createddate <= '2024-11-08' OR createddate >= '2022-12-25' + PTY_UNPROTECT_DOB(createddate) <= '2024-11-08' + OR PTY_UNPROTECT_DOB(createddate) >= '2022-12-25' ) AND ( - createddate <= '2024-11-08' OR createddate >= '2025-06-07' + PTY_UNPROTECT_DOB(createddate) <= '2024-11-08' + OR PTY_UNPROTECT_DOB(createddate) >= '2025-06-07' ) - AND createddate <= '2026-03-07' - AND createddate >= '2020-01-31' + AND PTY_UNPROTECT_DOB(createddate) <= '2026-03-07' + AND PTY_UNPROTECT_DOB(createddate) >= '2020-01-31' diff --git a/tests/test_sql_refsols/fsi_accounts_partition_agg_raw_snowflake.sql b/tests/test_sql_refsols/fsi_accounts_partition_agg_raw_snowflake.sql index 9e0e3db75..76d49ccdd 100644 --- a/tests/test_sql_refsols/fsi_accounts_partition_agg_raw_snowflake.sql +++ b/tests/test_sql_refsols/fsi_accounts_partition_agg_raw_snowflake.sql @@ -1,5 +1,5 @@ SELECT - accounttype AS account_type, + PTY_UNPROTECT(accounttype, 'deAccount') AS account_type, COUNT(*) AS n, ROUND(AVG(balance), 2) AS avg_bal FROM bodo.fsi.accounts diff --git a/tests/test_sql_refsols/fsi_accounts_partition_agg_rewrite_snowflake.sql b/tests/test_sql_refsols/fsi_accounts_partition_agg_rewrite_snowflake.sql index 9e0e3db75..76d49ccdd 100644 --- a/tests/test_sql_refsols/fsi_accounts_partition_agg_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/fsi_accounts_partition_agg_rewrite_snowflake.sql @@ -1,5 +1,5 @@ SELECT - accounttype AS account_type, + PTY_UNPROTECT(accounttype, 'deAccount') AS account_type, COUNT(*) AS n, ROUND(AVG(balance), 2) AS avg_bal FROM bodo.fsi.accounts diff --git a/tests/test_sql_refsols/fsi_best_account_customers_per_state_raw_snowflake.sql b/tests/test_sql_refsols/fsi_best_account_customers_per_state_raw_snowflake.sql index add7d682d..7581b68a5 100644 --- a/tests/test_sql_refsols/fsi_best_account_customers_per_state_raw_snowflake.sql +++ b/tests/test_sql_refsols/fsi_best_account_customers_per_state_raw_snowflake.sql @@ -1,29 +1,33 @@ -WITH _s0 AS ( +WITH _t3 AS ( SELECT DISTINCT - state + PTY_UNPROTECT(state, 'deAddress') AS unmask_state FROM bodo.fsi.protected_customers +), _s0 AS ( + SELECT + unmask_state + FROM _t3 ORDER BY 1 NULLS FIRST LIMIT 5 -), _t0 AS ( +), _t1 AS ( SELECT accounts.balance, protected_customers.firstname, protected_customers.lastname, - _s0.state + _s0.unmask_state FROM _s0 AS _s0 JOIN bodo.fsi.protected_customers AS protected_customers - ON _s0.state = protected_customers.state + ON _s0.unmask_state = PTY_UNPROTECT(protected_customers.state, 'deAddress') JOIN bodo.fsi.accounts AS accounts - ON accounts.customerid = protected_customers.customerid + ON PTY_UNPROTECT(protected_customers.customerid, 'deAccount') = PTY_UNPROTECT_ACCOUNT(accounts.customerid) QUALIFY - ROW_NUMBER() OVER (PARTITION BY state ORDER BY accounts.balance DESC) = 1 + ROW_NUMBER() OVER (PARTITION BY unmask_state ORDER BY accounts.balance DESC) = 1 ) SELECT - state, + unmask_state AS state, balance, - firstname AS first_name, - lastname AS last_name -FROM _t0 + PTY_UNPROTECT(firstname, 'deName') AS first_name, + PTY_UNPROTECT(lastname, 'deName') AS last_name +FROM _t1 ORDER BY 1 NULLS FIRST diff --git a/tests/test_sql_refsols/fsi_best_account_customers_per_state_rewrite_snowflake.sql b/tests/test_sql_refsols/fsi_best_account_customers_per_state_rewrite_snowflake.sql index add7d682d..7581b68a5 100644 --- a/tests/test_sql_refsols/fsi_best_account_customers_per_state_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/fsi_best_account_customers_per_state_rewrite_snowflake.sql @@ -1,29 +1,33 @@ -WITH _s0 AS ( +WITH _t3 AS ( SELECT DISTINCT - state + PTY_UNPROTECT(state, 'deAddress') AS unmask_state FROM bodo.fsi.protected_customers +), _s0 AS ( + SELECT + unmask_state + FROM _t3 ORDER BY 1 NULLS FIRST LIMIT 5 -), _t0 AS ( +), _t1 AS ( SELECT accounts.balance, protected_customers.firstname, protected_customers.lastname, - _s0.state + _s0.unmask_state FROM _s0 AS _s0 JOIN bodo.fsi.protected_customers AS protected_customers - ON _s0.state = protected_customers.state + ON _s0.unmask_state = PTY_UNPROTECT(protected_customers.state, 'deAddress') JOIN bodo.fsi.accounts AS accounts - ON accounts.customerid = protected_customers.customerid + ON PTY_UNPROTECT(protected_customers.customerid, 'deAccount') = PTY_UNPROTECT_ACCOUNT(accounts.customerid) QUALIFY - ROW_NUMBER() OVER (PARTITION BY state ORDER BY accounts.balance DESC) = 1 + ROW_NUMBER() OVER (PARTITION BY unmask_state ORDER BY accounts.balance DESC) = 1 ) SELECT - state, + unmask_state AS state, balance, - firstname AS first_name, - lastname AS last_name -FROM _t0 + PTY_UNPROTECT(firstname, 'deName') AS first_name, + PTY_UNPROTECT(lastname, 'deName') AS last_name +FROM _t1 ORDER BY 1 NULLS FIRST diff --git a/tests/test_sql_refsols/fsi_customers_accounts_join_raw_snowflake.sql b/tests/test_sql_refsols/fsi_customers_accounts_join_raw_snowflake.sql index c4b317112..c5b7f419d 100644 --- a/tests/test_sql_refsols/fsi_customers_accounts_join_raw_snowflake.sql +++ b/tests/test_sql_refsols/fsi_customers_accounts_join_raw_snowflake.sql @@ -2,5 +2,5 @@ SELECT COUNT(*) AS num_customers_checking_accounts FROM bodo.fsi.protected_customers AS protected_customers JOIN bodo.fsi.accounts AS accounts - ON accounts.accounttype <> 'checking' - AND accounts.customerid = protected_customers.customerid + ON PTY_UNPROTECT(accounts.accounttype, 'deAccount') <> 'checking' + AND PTY_UNPROTECT(protected_customers.customerid, 'deAccount') = PTY_UNPROTECT_ACCOUNT(accounts.customerid) diff --git a/tests/test_sql_refsols/fsi_customers_accounts_join_rewrite_snowflake.sql b/tests/test_sql_refsols/fsi_customers_accounts_join_rewrite_snowflake.sql index c4b317112..c5b7f419d 100644 --- a/tests/test_sql_refsols/fsi_customers_accounts_join_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/fsi_customers_accounts_join_rewrite_snowflake.sql @@ -2,5 +2,5 @@ SELECT COUNT(*) AS num_customers_checking_accounts FROM bodo.fsi.protected_customers AS protected_customers JOIN bodo.fsi.accounts AS accounts - ON accounts.accounttype <> 'checking' - AND accounts.customerid = protected_customers.customerid + ON PTY_UNPROTECT(accounts.accounttype, 'deAccount') <> 'checking' + AND PTY_UNPROTECT(protected_customers.customerid, 'deAccount') = PTY_UNPROTECT_ACCOUNT(accounts.customerid) diff --git a/tests/test_sql_refsols/fsi_customers_filter_isin_raw_snowflake.sql b/tests/test_sql_refsols/fsi_customers_filter_isin_raw_snowflake.sql index ef9bad2f1..8da745231 100644 --- a/tests/test_sql_refsols/fsi_customers_filter_isin_raw_snowflake.sql +++ b/tests/test_sql_refsols/fsi_customers_filter_isin_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.fsi.protected_customers WHERE - lastname IN ('Barnes', 'Hernandez', 'Moore') + PTY_UNPROTECT(lastname, 'deName') IN ('Barnes', 'Hernandez', 'Moore') diff --git a/tests/test_sql_refsols/fsi_customers_filter_isin_rewrite_snowflake.sql b/tests/test_sql_refsols/fsi_customers_filter_isin_rewrite_snowflake.sql index ef9bad2f1..8da745231 100644 --- a/tests/test_sql_refsols/fsi_customers_filter_isin_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/fsi_customers_filter_isin_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.fsi.protected_customers WHERE - lastname IN ('Barnes', 'Hernandez', 'Moore') + PTY_UNPROTECT(lastname, 'deName') IN ('Barnes', 'Hernandez', 'Moore') diff --git a/tests/test_sql_refsols/fsi_customers_filter_not_isin_raw_snowflake.sql b/tests/test_sql_refsols/fsi_customers_filter_not_isin_raw_snowflake.sql index 6205792ae..3eadc83bc 100644 --- a/tests/test_sql_refsols/fsi_customers_filter_not_isin_raw_snowflake.sql +++ b/tests/test_sql_refsols/fsi_customers_filter_not_isin_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.fsi.protected_customers WHERE - NOT lastname IN ('Barnes', 'Hernandez', 'Moore') + NOT PTY_UNPROTECT(lastname, 'deName') IN ('Barnes', 'Hernandez', 'Moore') diff --git a/tests/test_sql_refsols/fsi_customers_filter_not_isin_rewrite_snowflake.sql b/tests/test_sql_refsols/fsi_customers_filter_not_isin_rewrite_snowflake.sql index 6205792ae..3eadc83bc 100644 --- a/tests/test_sql_refsols/fsi_customers_filter_not_isin_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/fsi_customers_filter_not_isin_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.fsi.protected_customers WHERE - NOT lastname IN ('Barnes', 'Hernandez', 'Moore') + NOT PTY_UNPROTECT(lastname, 'deName') IN ('Barnes', 'Hernandez', 'Moore') diff --git a/tests/test_sql_refsols/fsi_scan_topk_raw_snowflake.sql b/tests/test_sql_refsols/fsi_scan_topk_raw_snowflake.sql index e4efa464b..6e999e18b 100644 --- a/tests/test_sql_refsols/fsi_scan_topk_raw_snowflake.sql +++ b/tests/test_sql_refsols/fsi_scan_topk_raw_snowflake.sql @@ -1,9 +1,9 @@ SELECT - firstname AS first_name, - lastname AS last_name, - city, + PTY_UNPROTECT(firstname, 'deName') AS first_name, + PTY_UNPROTECT(lastname, 'deName') AS last_name, + PTY_UNPROTECT_ADDRESS(city) AS city, zipcode, - dob AS date_of_birth + PTY_UNPROTECT(dob, 'deDOB') AS date_of_birth FROM bodo.fsi.protected_customers ORDER BY 2 NULLS FIRST diff --git a/tests/test_sql_refsols/fsi_scan_topk_rewrite_snowflake.sql b/tests/test_sql_refsols/fsi_scan_topk_rewrite_snowflake.sql index e4efa464b..6e999e18b 100644 --- a/tests/test_sql_refsols/fsi_scan_topk_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/fsi_scan_topk_rewrite_snowflake.sql @@ -1,9 +1,9 @@ SELECT - firstname AS first_name, - lastname AS last_name, - city, + PTY_UNPROTECT(firstname, 'deName') AS first_name, + PTY_UNPROTECT(lastname, 'deName') AS last_name, + PTY_UNPROTECT_ADDRESS(city) AS city, zipcode, - dob AS date_of_birth + PTY_UNPROTECT(dob, 'deDOB') AS date_of_birth FROM bodo.fsi.protected_customers ORDER BY 2 NULLS FIRST diff --git a/tests/test_sql_refsols/health_claim_scan_topk_raw_snowflake.sql b/tests/test_sql_refsols/health_claim_scan_topk_raw_snowflake.sql index 8611fc3d2..9320886d0 100644 --- a/tests/test_sql_refsols/health_claim_scan_topk_raw_snowflake.sql +++ b/tests/test_sql_refsols/health_claim_scan_topk_raw_snowflake.sql @@ -1,13 +1,13 @@ SELECT claim_id AS key, - patient_id AS patient_key, - claim_date, - provider_name, + PTY_UNPROTECT(patient_id, 'deAccount') AS patient_key, + PTY_UNPROTECT_DOB(claim_date) AS claim_date, + PTY_UNPROTECT(provider_name, 'deName') AS provider_name, diagnosis_code, procedure_code, claim_amount, approved_amount, - claim_status + PTY_UNPROTECT(claim_status, 'deAccount') AS claim_status FROM bodo.health.claims ORDER BY 7 DESC NULLS LAST diff --git a/tests/test_sql_refsols/health_claim_scan_topk_rewrite_snowflake.sql b/tests/test_sql_refsols/health_claim_scan_topk_rewrite_snowflake.sql index 8611fc3d2..9320886d0 100644 --- a/tests/test_sql_refsols/health_claim_scan_topk_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/health_claim_scan_topk_rewrite_snowflake.sql @@ -1,13 +1,13 @@ SELECT claim_id AS key, - patient_id AS patient_key, - claim_date, - provider_name, + PTY_UNPROTECT(patient_id, 'deAccount') AS patient_key, + PTY_UNPROTECT_DOB(claim_date) AS claim_date, + PTY_UNPROTECT(provider_name, 'deName') AS provider_name, diagnosis_code, procedure_code, claim_amount, approved_amount, - claim_status + PTY_UNPROTECT(claim_status, 'deAccount') AS claim_status FROM bodo.health.claims ORDER BY 7 DESC NULLS LAST diff --git a/tests/test_sql_refsols/health_claims_filter_day_raw_snowflake.sql b/tests/test_sql_refsols/health_claims_filter_day_raw_snowflake.sql index c3086caf8..0d2ef7a75 100644 --- a/tests/test_sql_refsols/health_claims_filter_day_raw_snowflake.sql +++ b/tests/test_sql_refsols/health_claims_filter_day_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.health.claims WHERE - DAY(CAST(claim_date AS TIMESTAMP)) = 31 + DAY(CAST(PTY_UNPROTECT_DOB(claim_date) AS TIMESTAMP)) = 31 diff --git a/tests/test_sql_refsols/health_claims_filter_day_rewrite_snowflake.sql b/tests/test_sql_refsols/health_claims_filter_day_rewrite_snowflake.sql index c3086caf8..0d2ef7a75 100644 --- a/tests/test_sql_refsols/health_claims_filter_day_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/health_claims_filter_day_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.health.claims WHERE - DAY(CAST(claim_date AS TIMESTAMP)) = 31 + DAY(CAST(PTY_UNPROTECT_DOB(claim_date) AS TIMESTAMP)) = 31 diff --git a/tests/test_sql_refsols/health_claims_filter_month_raw_snowflake.sql b/tests/test_sql_refsols/health_claims_filter_month_raw_snowflake.sql index 38945e4a1..316db94c3 100644 --- a/tests/test_sql_refsols/health_claims_filter_month_raw_snowflake.sql +++ b/tests/test_sql_refsols/health_claims_filter_month_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.health.claims WHERE - MONTH(CAST(claim_date AS TIMESTAMP)) = 12 + MONTH(CAST(PTY_UNPROTECT_DOB(claim_date) AS TIMESTAMP)) = 12 diff --git a/tests/test_sql_refsols/health_claims_filter_month_rewrite_snowflake.sql b/tests/test_sql_refsols/health_claims_filter_month_rewrite_snowflake.sql index 38945e4a1..316db94c3 100644 --- a/tests/test_sql_refsols/health_claims_filter_month_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/health_claims_filter_month_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.health.claims WHERE - MONTH(CAST(claim_date AS TIMESTAMP)) = 12 + MONTH(CAST(PTY_UNPROTECT_DOB(claim_date) AS TIMESTAMP)) = 12 diff --git a/tests/test_sql_refsols/health_claims_filter_year_raw_snowflake.sql b/tests/test_sql_refsols/health_claims_filter_year_raw_snowflake.sql index 336d7f5fb..87a1af3e0 100644 --- a/tests/test_sql_refsols/health_claims_filter_year_raw_snowflake.sql +++ b/tests/test_sql_refsols/health_claims_filter_year_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.health.claims WHERE - YEAR(CAST(claim_date AS TIMESTAMP)) > 2020 + YEAR(CAST(PTY_UNPROTECT_DOB(claim_date) AS TIMESTAMP)) > 2020 diff --git a/tests/test_sql_refsols/health_claims_filter_year_rewrite_snowflake.sql b/tests/test_sql_refsols/health_claims_filter_year_rewrite_snowflake.sql index 336d7f5fb..87a1af3e0 100644 --- a/tests/test_sql_refsols/health_claims_filter_year_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/health_claims_filter_year_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.health.claims WHERE - YEAR(CAST(claim_date AS TIMESTAMP)) > 2020 + YEAR(CAST(PTY_UNPROTECT_DOB(claim_date) AS TIMESTAMP)) > 2020 diff --git a/tests/test_sql_refsols/health_first_patient_by_coverage_type_raw_snowflake.sql b/tests/test_sql_refsols/health_first_patient_by_coverage_type_raw_snowflake.sql index fdf4c05a8..315a54897 100644 --- a/tests/test_sql_refsols/health_first_patient_by_coverage_type_raw_snowflake.sql +++ b/tests/test_sql_refsols/health_first_patient_by_coverage_type_raw_snowflake.sql @@ -8,13 +8,13 @@ WITH _t3 AS ( JOIN bodo.health.protected_patients AS protected_patients ON insurance_plans.insurance_plan_id = protected_patients.insurance_plan_id QUALIFY - ROW_NUMBER() OVER (PARTITION BY coverage_type ORDER BY protected_patients.date_of_birth, protected_patients.patient_id) = 1 + ROW_NUMBER() OVER (PARTITION BY coverage_type ORDER BY PTY_UNPROTECT(protected_patients.date_of_birth, 'deDOB'), PTY_UNPROTECT_ACCOUNT(protected_patients.patient_id)) = 1 ), _s3 AS ( SELECT insurance_plan_id, - ANY_VALUE(date_of_birth) AS anything_date_of_birth, - ANY_VALUE(first_name) AS anything_first_name, - ANY_VALUE(last_name) AS anything_last_name, + ANY_VALUE(PTY_UNPROTECT(date_of_birth, 'deDOB')) AS anything_unmask_date_of_birth, + ANY_VALUE(PTY_UNPROTECT_NAME(first_name)) AS anything_unmask_first_name, + ANY_VALUE(PTY_UNPROTECT(last_name, 'deName')) AS anything_unmask_last_name, COUNT(*) AS n_rows FROM _t3 GROUP BY @@ -22,9 +22,9 @@ WITH _t3 AS ( ), _t0 AS ( SELECT insurance_plans.coverage_type, - MAX(_s3.anything_date_of_birth) AS max_anything_date_of_birth, - MAX(_s3.anything_first_name) AS max_anything_first_name, - MAX(_s3.anything_last_name) AS max_anything_last_name, + MAX(_s3.anything_unmask_date_of_birth) AS max_anything_unmask_date_of_birth, + MAX(_s3.anything_unmask_first_name) AS max_anything_unmask_first_name, + MAX(_s3.anything_unmask_last_name) AS max_anything_unmask_last_name, SUM(_s3.n_rows) AS sum_n_rows FROM bodo.health.insurance_plans AS insurance_plans LEFT JOIN _s3 AS _s3 @@ -34,9 +34,9 @@ WITH _t3 AS ( ) SELECT coverage_type, - max_anything_first_name AS first_name, - max_anything_last_name AS last_name, - max_anything_date_of_birth AS date_of_birth + max_anything_unmask_first_name AS first_name, + max_anything_unmask_last_name AS last_name, + max_anything_unmask_date_of_birth AS date_of_birth FROM _t0 WHERE sum_n_rows > 0 diff --git a/tests/test_sql_refsols/health_first_patient_by_coverage_type_rewrite_snowflake.sql b/tests/test_sql_refsols/health_first_patient_by_coverage_type_rewrite_snowflake.sql index fdf4c05a8..315a54897 100644 --- a/tests/test_sql_refsols/health_first_patient_by_coverage_type_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/health_first_patient_by_coverage_type_rewrite_snowflake.sql @@ -8,13 +8,13 @@ WITH _t3 AS ( JOIN bodo.health.protected_patients AS protected_patients ON insurance_plans.insurance_plan_id = protected_patients.insurance_plan_id QUALIFY - ROW_NUMBER() OVER (PARTITION BY coverage_type ORDER BY protected_patients.date_of_birth, protected_patients.patient_id) = 1 + ROW_NUMBER() OVER (PARTITION BY coverage_type ORDER BY PTY_UNPROTECT(protected_patients.date_of_birth, 'deDOB'), PTY_UNPROTECT_ACCOUNT(protected_patients.patient_id)) = 1 ), _s3 AS ( SELECT insurance_plan_id, - ANY_VALUE(date_of_birth) AS anything_date_of_birth, - ANY_VALUE(first_name) AS anything_first_name, - ANY_VALUE(last_name) AS anything_last_name, + ANY_VALUE(PTY_UNPROTECT(date_of_birth, 'deDOB')) AS anything_unmask_date_of_birth, + ANY_VALUE(PTY_UNPROTECT_NAME(first_name)) AS anything_unmask_first_name, + ANY_VALUE(PTY_UNPROTECT(last_name, 'deName')) AS anything_unmask_last_name, COUNT(*) AS n_rows FROM _t3 GROUP BY @@ -22,9 +22,9 @@ WITH _t3 AS ( ), _t0 AS ( SELECT insurance_plans.coverage_type, - MAX(_s3.anything_date_of_birth) AS max_anything_date_of_birth, - MAX(_s3.anything_first_name) AS max_anything_first_name, - MAX(_s3.anything_last_name) AS max_anything_last_name, + MAX(_s3.anything_unmask_date_of_birth) AS max_anything_unmask_date_of_birth, + MAX(_s3.anything_unmask_first_name) AS max_anything_unmask_first_name, + MAX(_s3.anything_unmask_last_name) AS max_anything_unmask_last_name, SUM(_s3.n_rows) AS sum_n_rows FROM bodo.health.insurance_plans AS insurance_plans LEFT JOIN _s3 AS _s3 @@ -34,9 +34,9 @@ WITH _t3 AS ( ) SELECT coverage_type, - max_anything_first_name AS first_name, - max_anything_last_name AS last_name, - max_anything_date_of_birth AS date_of_birth + max_anything_unmask_first_name AS first_name, + max_anything_unmask_last_name AS last_name, + max_anything_unmask_date_of_birth AS date_of_birth FROM _t0 WHERE sum_n_rows > 0 diff --git a/tests/test_sql_refsols/health_patients_filter_absent_raw_snowflake.sql b/tests/test_sql_refsols/health_patients_filter_absent_raw_snowflake.sql index 2fd95a073..8b18c8e44 100644 --- a/tests/test_sql_refsols/health_patients_filter_absent_raw_snowflake.sql +++ b/tests/test_sql_refsols/health_patients_filter_absent_raw_snowflake.sql @@ -2,4 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.health.protected_patients WHERE - date_of_birth > '2003-06-29' OR date_of_birth IS NULL + PTY_UNPROTECT(date_of_birth, 'deDOB') > '2003-06-29' + OR PTY_UNPROTECT(date_of_birth, 'deDOB') IS NULL diff --git a/tests/test_sql_refsols/health_patients_filter_absent_rewrite_snowflake.sql b/tests/test_sql_refsols/health_patients_filter_absent_rewrite_snowflake.sql index 2fd95a073..8b18c8e44 100644 --- a/tests/test_sql_refsols/health_patients_filter_absent_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/health_patients_filter_absent_rewrite_snowflake.sql @@ -2,4 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.health.protected_patients WHERE - date_of_birth > '2003-06-29' OR date_of_birth IS NULL + PTY_UNPROTECT(date_of_birth, 'deDOB') > '2003-06-29' + OR PTY_UNPROTECT(date_of_birth, 'deDOB') IS NULL diff --git a/tests/test_sql_refsols/health_patients_filter_endswith_raw_snowflake.sql b/tests/test_sql_refsols/health_patients_filter_endswith_raw_snowflake.sql index 8ee55dde5..87d164bf5 100644 --- a/tests/test_sql_refsols/health_patients_filter_endswith_raw_snowflake.sql +++ b/tests/test_sql_refsols/health_patients_filter_endswith_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.health.protected_patients WHERE - ENDSWITH(email, 'gmail.com') + ENDSWITH(PTY_UNPROTECT(email, 'deEmail'), 'gmail.com') diff --git a/tests/test_sql_refsols/health_patients_filter_endswith_rewrite_snowflake.sql b/tests/test_sql_refsols/health_patients_filter_endswith_rewrite_snowflake.sql index 8ee55dde5..87d164bf5 100644 --- a/tests/test_sql_refsols/health_patients_filter_endswith_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/health_patients_filter_endswith_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.health.protected_patients WHERE - ENDSWITH(email, 'gmail.com') + ENDSWITH(PTY_UNPROTECT(email, 'deEmail'), 'gmail.com') diff --git a/tests/test_sql_refsols/health_patients_filter_startswith_raw_snowflake.sql b/tests/test_sql_refsols/health_patients_filter_startswith_raw_snowflake.sql index f08949676..85290c65f 100644 --- a/tests/test_sql_refsols/health_patients_filter_startswith_raw_snowflake.sql +++ b/tests/test_sql_refsols/health_patients_filter_startswith_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.health.protected_patients WHERE - STARTSWITH(phone_number, '001') + STARTSWITH(PTY_UNPROTECT(phone_number, 'dePhone'), '001') diff --git a/tests/test_sql_refsols/health_patients_filter_startswith_rewrite_snowflake.sql b/tests/test_sql_refsols/health_patients_filter_startswith_rewrite_snowflake.sql index f08949676..85290c65f 100644 --- a/tests/test_sql_refsols/health_patients_filter_startswith_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/health_patients_filter_startswith_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.health.protected_patients WHERE - STARTSWITH(phone_number, '001') + STARTSWITH(PTY_UNPROTECT(phone_number, 'dePhone'), '001') diff --git a/tests/test_sql_refsols/retail_members_agg_best_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_agg_best_raw_snowflake.sql index a6163077d..7a681e54a 100644 --- a/tests/test_sql_refsols/retail_members_agg_best_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_agg_best_raw_snowflake.sql @@ -8,12 +8,12 @@ WITH _t1 AS ( JOIN bodo.retail.protected_loyalty_members AS protected_loyalty_members ON protected_loyalty_members.customer_id = transactions.customer_id QUALIFY - ROW_NUMBER() OVER (PARTITION BY store_location ORDER BY transactions.total_amount DESC) = 1 + ROW_NUMBER() OVER (PARTITION BY PTY_UNPROTECT_ADDRESS(store_location) ORDER BY transactions.total_amount DESC) = 1 ) SELECT - store_location, + PTY_UNPROTECT_ADDRESS(store_location) AS store_location, total_amount, - CONCAT_WS(' ', first_name, last_name) AS name + CONCAT_WS(' ', PTY_UNPROTECT(first_name, 'deName'), PTY_UNPROTECT_NAME(last_name)) AS name FROM _t1 ORDER BY 2 DESC NULLS LAST diff --git a/tests/test_sql_refsols/retail_members_agg_best_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_agg_best_rewrite_snowflake.sql index a6163077d..7a681e54a 100644 --- a/tests/test_sql_refsols/retail_members_agg_best_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_agg_best_rewrite_snowflake.sql @@ -8,12 +8,12 @@ WITH _t1 AS ( JOIN bodo.retail.protected_loyalty_members AS protected_loyalty_members ON protected_loyalty_members.customer_id = transactions.customer_id QUALIFY - ROW_NUMBER() OVER (PARTITION BY store_location ORDER BY transactions.total_amount DESC) = 1 + ROW_NUMBER() OVER (PARTITION BY PTY_UNPROTECT_ADDRESS(store_location) ORDER BY transactions.total_amount DESC) = 1 ) SELECT - store_location, + PTY_UNPROTECT_ADDRESS(store_location) AS store_location, total_amount, - CONCAT_WS(' ', first_name, last_name) AS name + CONCAT_WS(' ', PTY_UNPROTECT(first_name, 'deName'), PTY_UNPROTECT_NAME(last_name)) AS name FROM _t1 ORDER BY 2 DESC NULLS LAST diff --git a/tests/test_sql_refsols/retail_members_agg_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_agg_raw_snowflake.sql index 332998880..d121c3b37 100644 --- a/tests/test_sql_refsols/retail_members_agg_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_agg_raw_snowflake.sql @@ -1,7 +1,7 @@ WITH _s1 AS ( SELECT customer_id, - MIN(transaction_date) AS min_transaction_date + MIN(PTY_UNPROTECT_TS(transaction_date)) AS min_unmask_transaction_date FROM bodo.retail.transactions GROUP BY 1 @@ -12,7 +12,7 @@ SELECT DATEDIFF( SECOND, CAST(protected_loyalty_members.join_date AS DATETIME), - CAST(_s1.min_transaction_date AS DATETIME) + CAST(_s1.min_unmask_transaction_date AS DATETIME) ) ), 2 diff --git a/tests/test_sql_refsols/retail_members_agg_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_agg_rewrite_snowflake.sql index 332998880..d121c3b37 100644 --- a/tests/test_sql_refsols/retail_members_agg_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_agg_rewrite_snowflake.sql @@ -1,7 +1,7 @@ WITH _s1 AS ( SELECT customer_id, - MIN(transaction_date) AS min_transaction_date + MIN(PTY_UNPROTECT_TS(transaction_date)) AS min_unmask_transaction_date FROM bodo.retail.transactions GROUP BY 1 @@ -12,7 +12,7 @@ SELECT DATEDIFF( SECOND, CAST(protected_loyalty_members.join_date AS DATETIME), - CAST(_s1.min_transaction_date AS DATETIME) + CAST(_s1.min_unmask_transaction_date AS DATETIME) ) ), 2 diff --git a/tests/test_sql_refsols/retail_members_compound_a_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_a_raw_snowflake.sql index a5e178755..d3db075bf 100644 --- a/tests/test_sql_refsols/retail_members_compound_a_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_a_raw_snowflake.sql @@ -2,5 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth >= CAST('2002-01-01' AS DATE) - AND last_name IN ('Johnson', 'Robinson') + PTY_UNPROTECT(date_of_birth, 'deDOB') >= CAST('2002-01-01' AS DATE) + AND PTY_UNPROTECT_NAME(last_name) IN ('Johnson', 'Robinson') diff --git a/tests/test_sql_refsols/retail_members_compound_a_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_a_rewrite_snowflake.sql index a5e178755..d3db075bf 100644 --- a/tests/test_sql_refsols/retail_members_compound_a_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_a_rewrite_snowflake.sql @@ -2,5 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth >= CAST('2002-01-01' AS DATE) - AND last_name IN ('Johnson', 'Robinson') + PTY_UNPROTECT(date_of_birth, 'deDOB') >= CAST('2002-01-01' AS DATE) + AND PTY_UNPROTECT_NAME(last_name) IN ('Johnson', 'Robinson') diff --git a/tests/test_sql_refsols/retail_members_compound_b_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_b_raw_snowflake.sql index 03e67d906..87a7380a7 100644 --- a/tests/test_sql_refsols/retail_members_compound_b_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_b_raw_snowflake.sql @@ -2,4 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth = CAST('1979-03-07' AS DATE) AND last_name <> 'Smith' + PTY_UNPROTECT(date_of_birth, 'deDOB') = CAST('1979-03-07' AS DATE) + AND PTY_UNPROTECT_NAME(last_name) <> 'Smith' diff --git a/tests/test_sql_refsols/retail_members_compound_b_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_b_rewrite_snowflake.sql index 03e67d906..87a7380a7 100644 --- a/tests/test_sql_refsols/retail_members_compound_b_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_b_rewrite_snowflake.sql @@ -2,4 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth = CAST('1979-03-07' AS DATE) AND last_name <> 'Smith' + PTY_UNPROTECT(date_of_birth, 'deDOB') = CAST('1979-03-07' AS DATE) + AND PTY_UNPROTECT_NAME(last_name) <> 'Smith' diff --git a/tests/test_sql_refsols/retail_members_compound_c_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_c_raw_snowflake.sql index e0ff6ac18..4c9110f8c 100644 --- a/tests/test_sql_refsols/retail_members_compound_c_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_c_raw_snowflake.sql @@ -2,4 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth > CAST('1995-12-22' AS DATE) AND last_name < 'Cross' + PTY_UNPROTECT(date_of_birth, 'deDOB') > CAST('1995-12-22' AS DATE) + AND PTY_UNPROTECT_NAME(last_name) < 'Cross' diff --git a/tests/test_sql_refsols/retail_members_compound_c_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_c_rewrite_snowflake.sql index e0ff6ac18..4c9110f8c 100644 --- a/tests/test_sql_refsols/retail_members_compound_c_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_c_rewrite_snowflake.sql @@ -2,4 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth > CAST('1995-12-22' AS DATE) AND last_name < 'Cross' + PTY_UNPROTECT(date_of_birth, 'deDOB') > CAST('1995-12-22' AS DATE) + AND PTY_UNPROTECT_NAME(last_name) < 'Cross' diff --git a/tests/test_sql_refsols/retail_members_compound_d_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_d_raw_snowflake.sql index 2c7580120..6bf40fdf4 100644 --- a/tests/test_sql_refsols/retail_members_compound_d_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_d_raw_snowflake.sql @@ -2,4 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth >= CAST('2000-01-01' AS DATE) AND last_name <= 'Zuniga' + PTY_UNPROTECT(date_of_birth, 'deDOB') >= CAST('2000-01-01' AS DATE) + AND PTY_UNPROTECT_NAME(last_name) <= 'Zuniga' diff --git a/tests/test_sql_refsols/retail_members_compound_d_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_d_rewrite_snowflake.sql index 2c7580120..6bf40fdf4 100644 --- a/tests/test_sql_refsols/retail_members_compound_d_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_d_rewrite_snowflake.sql @@ -2,4 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth >= CAST('2000-01-01' AS DATE) AND last_name <= 'Zuniga' + PTY_UNPROTECT(date_of_birth, 'deDOB') >= CAST('2000-01-01' AS DATE) + AND PTY_UNPROTECT_NAME(last_name) <= 'Zuniga' diff --git a/tests/test_sql_refsols/retail_members_compound_e_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_e_raw_snowflake.sql index 4d461f959..99b1a295a 100644 --- a/tests/test_sql_refsols/retail_members_compound_e_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_e_raw_snowflake.sql @@ -2,5 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth < CAST('1983-01-30' AS DATE) - AND date_of_birth >= CAST('1983-01-10' AS DATE) + PTY_UNPROTECT(date_of_birth, 'deDOB') < CAST('1983-01-30' AS DATE) + AND PTY_UNPROTECT(date_of_birth, 'deDOB') >= CAST('1983-01-10' AS DATE) diff --git a/tests/test_sql_refsols/retail_members_compound_e_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_e_rewrite_snowflake.sql index 4d461f959..99b1a295a 100644 --- a/tests/test_sql_refsols/retail_members_compound_e_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_e_rewrite_snowflake.sql @@ -2,5 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth < CAST('1983-01-30' AS DATE) - AND date_of_birth >= CAST('1983-01-10' AS DATE) + PTY_UNPROTECT(date_of_birth, 'deDOB') < CAST('1983-01-30' AS DATE) + AND PTY_UNPROTECT(date_of_birth, 'deDOB') >= CAST('1983-01-10' AS DATE) diff --git a/tests/test_sql_refsols/retail_members_compound_f_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_f_raw_snowflake.sql index eeaa4f70a..0c84a8637 100644 --- a/tests/test_sql_refsols/retail_members_compound_f_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_f_raw_snowflake.sql @@ -2,5 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth <= CAST('1976-07-28' AS DATE) - AND date_of_birth > CAST('1976-07-01' AS DATE) + PTY_UNPROTECT(date_of_birth, 'deDOB') <= CAST('1976-07-28' AS DATE) + AND PTY_UNPROTECT(date_of_birth, 'deDOB') > CAST('1976-07-01' AS DATE) diff --git a/tests/test_sql_refsols/retail_members_compound_f_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_f_rewrite_snowflake.sql index eeaa4f70a..0c84a8637 100644 --- a/tests/test_sql_refsols/retail_members_compound_f_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_f_rewrite_snowflake.sql @@ -2,5 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth <= CAST('1976-07-28' AS DATE) - AND date_of_birth > CAST('1976-07-01' AS DATE) + PTY_UNPROTECT(date_of_birth, 'deDOB') <= CAST('1976-07-28' AS DATE) + AND PTY_UNPROTECT(date_of_birth, 'deDOB') > CAST('1976-07-01' AS DATE) diff --git a/tests/test_sql_refsols/retail_members_compound_g_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_g_raw_snowflake.sql index d7360628f..3da3ff9aa 100644 --- a/tests/test_sql_refsols/retail_members_compound_g_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_g_raw_snowflake.sql @@ -2,7 +2,7 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - DAY(CAST(date_of_birth AS TIMESTAMP)) <= 13 - AND DAY(CAST(date_of_birth AS TIMESTAMP)) > 3 - AND MONTH(CAST(date_of_birth AS TIMESTAMP)) IN (1, 2, 5, 10, 12) - AND YEAR(CAST(date_of_birth AS TIMESTAMP)) IN (1960, 1970, 1980, 1990, 2000) + DAY(CAST(PTY_UNPROTECT(date_of_birth, 'deDOB') AS TIMESTAMP)) <= 13 + AND DAY(CAST(PTY_UNPROTECT(date_of_birth, 'deDOB') AS TIMESTAMP)) > 3 + AND MONTH(CAST(PTY_UNPROTECT(date_of_birth, 'deDOB') AS TIMESTAMP)) IN (1, 2, 5, 10, 12) + AND YEAR(CAST(PTY_UNPROTECT(date_of_birth, 'deDOB') AS TIMESTAMP)) IN (1960, 1970, 1980, 1990, 2000) diff --git a/tests/test_sql_refsols/retail_members_compound_g_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_g_rewrite_snowflake.sql index d7360628f..3da3ff9aa 100644 --- a/tests/test_sql_refsols/retail_members_compound_g_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_g_rewrite_snowflake.sql @@ -2,7 +2,7 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - DAY(CAST(date_of_birth AS TIMESTAMP)) <= 13 - AND DAY(CAST(date_of_birth AS TIMESTAMP)) > 3 - AND MONTH(CAST(date_of_birth AS TIMESTAMP)) IN (1, 2, 5, 10, 12) - AND YEAR(CAST(date_of_birth AS TIMESTAMP)) IN (1960, 1970, 1980, 1990, 2000) + DAY(CAST(PTY_UNPROTECT(date_of_birth, 'deDOB') AS TIMESTAMP)) <= 13 + AND DAY(CAST(PTY_UNPROTECT(date_of_birth, 'deDOB') AS TIMESTAMP)) > 3 + AND MONTH(CAST(PTY_UNPROTECT(date_of_birth, 'deDOB') AS TIMESTAMP)) IN (1, 2, 5, 10, 12) + AND YEAR(CAST(PTY_UNPROTECT(date_of_birth, 'deDOB') AS TIMESTAMP)) IN (1960, 1970, 1980, 1990, 2000) diff --git a/tests/test_sql_refsols/retail_members_compound_h_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_h_raw_snowflake.sql index 826446ad1..9663cadc8 100644 --- a/tests/test_sql_refsols/retail_members_compound_h_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_h_raw_snowflake.sql @@ -2,4 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth < CAST('2007-01-01' AS DATE) AND last_name >= 'Cross' + PTY_UNPROTECT(date_of_birth, 'deDOB') < CAST('2007-01-01' AS DATE) + AND PTY_UNPROTECT_NAME(last_name) >= 'Cross' diff --git a/tests/test_sql_refsols/retail_members_compound_h_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_h_rewrite_snowflake.sql index 826446ad1..9663cadc8 100644 --- a/tests/test_sql_refsols/retail_members_compound_h_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_h_rewrite_snowflake.sql @@ -2,4 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - date_of_birth < CAST('2007-01-01' AS DATE) AND last_name >= 'Cross' + PTY_UNPROTECT(date_of_birth, 'deDOB') < CAST('2007-01-01' AS DATE) + AND PTY_UNPROTECT_NAME(last_name) >= 'Cross' diff --git a/tests/test_sql_refsols/retail_members_compound_i_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_i_raw_snowflake.sql index 63a3e27ca..47b4b4e7b 100644 --- a/tests/test_sql_refsols/retail_members_compound_i_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_i_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - SUBSTRING(UPPER(last_name), 2, 2) IN ('UA', 'CO', 'AY', 'AL') + SUBSTRING(UPPER(PTY_UNPROTECT_NAME(last_name)), 2, 2) IN ('UA', 'CO', 'AY', 'AL') diff --git a/tests/test_sql_refsols/retail_members_compound_i_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_i_rewrite_snowflake.sql index 63a3e27ca..47b4b4e7b 100644 --- a/tests/test_sql_refsols/retail_members_compound_i_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_i_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - SUBSTRING(UPPER(last_name), 2, 2) IN ('UA', 'CO', 'AY', 'AL') + SUBSTRING(UPPER(PTY_UNPROTECT_NAME(last_name)), 2, 2) IN ('UA', 'CO', 'AY', 'AL') diff --git a/tests/test_sql_refsols/retail_members_compound_j_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_j_raw_snowflake.sql index 710344d49..7e1177fd7 100644 --- a/tests/test_sql_refsols/retail_members_compound_j_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_j_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - CONTAINS(LOWER(last_name), 'hu') + CONTAINS(LOWER(PTY_UNPROTECT_NAME(last_name)), 'hu') diff --git a/tests/test_sql_refsols/retail_members_compound_j_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_compound_j_rewrite_snowflake.sql index 710344d49..7e1177fd7 100644 --- a/tests/test_sql_refsols/retail_members_compound_j_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_compound_j_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - CONTAINS(LOWER(last_name), 'hu') + CONTAINS(LOWER(PTY_UNPROTECT_NAME(last_name)), 'hu') diff --git a/tests/test_sql_refsols/retail_members_filter_email_contains_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_filter_email_contains_raw_snowflake.sql index 632a1f520..882110cf1 100644 --- a/tests/test_sql_refsols/retail_members_filter_email_contains_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_filter_email_contains_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - NOT CONTAINS(email, 'mail') + NOT CONTAINS(PTY_UNPROTECT_EMAIL(email), 'mail') diff --git a/tests/test_sql_refsols/retail_members_filter_email_contains_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_filter_email_contains_rewrite_snowflake.sql index 632a1f520..882110cf1 100644 --- a/tests/test_sql_refsols/retail_members_filter_email_contains_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_filter_email_contains_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - NOT CONTAINS(email, 'mail') + NOT CONTAINS(PTY_UNPROTECT_EMAIL(email), 'mail') diff --git a/tests/test_sql_refsols/retail_members_filter_email_like_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_filter_email_like_raw_snowflake.sql index 6017aa920..892145803 100644 --- a/tests/test_sql_refsols/retail_members_filter_email_like_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_filter_email_like_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - email LIKE '%.%@%mail%' + PTY_UNPROTECT_EMAIL(email) LIKE '%.%@%mail%' diff --git a/tests/test_sql_refsols/retail_members_filter_email_like_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_filter_email_like_rewrite_snowflake.sql index 6017aa920..892145803 100644 --- a/tests/test_sql_refsols/retail_members_filter_email_like_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_filter_email_like_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - email LIKE '%.%@%mail%' + PTY_UNPROTECT_EMAIL(email) LIKE '%.%@%mail%' diff --git a/tests/test_sql_refsols/retail_members_filter_name_endswith_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_filter_name_endswith_raw_snowflake.sql index 41d1da4e4..898dc0225 100644 --- a/tests/test_sql_refsols/retail_members_filter_name_endswith_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_filter_name_endswith_raw_snowflake.sql @@ -2,4 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - ENDSWITH(first_name, 'e') OR ENDSWITH(last_name, 'e') + ENDSWITH(PTY_UNPROTECT(first_name, 'deName'), 'e') + OR ENDSWITH(PTY_UNPROTECT_NAME(last_name), 'e') diff --git a/tests/test_sql_refsols/retail_members_filter_name_endswith_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_filter_name_endswith_rewrite_snowflake.sql index 41d1da4e4..898dc0225 100644 --- a/tests/test_sql_refsols/retail_members_filter_name_endswith_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_filter_name_endswith_rewrite_snowflake.sql @@ -2,4 +2,5 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - ENDSWITH(first_name, 'e') OR ENDSWITH(last_name, 'e') + ENDSWITH(PTY_UNPROTECT(first_name, 'deName'), 'e') + OR ENDSWITH(PTY_UNPROTECT_NAME(last_name), 'e') diff --git a/tests/test_sql_refsols/retail_members_filter_slice_raw_snowflake.sql b/tests/test_sql_refsols/retail_members_filter_slice_raw_snowflake.sql index 7acf9bc24..afab24790 100644 --- a/tests/test_sql_refsols/retail_members_filter_slice_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_filter_slice_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - SUBSTRING(first_name, 2, 1) = 'a' + SUBSTRING(PTY_UNPROTECT(first_name, 'deName'), 2, 1) = 'a' diff --git a/tests/test_sql_refsols/retail_members_filter_slice_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_members_filter_slice_rewrite_snowflake.sql index 7acf9bc24..afab24790 100644 --- a/tests/test_sql_refsols/retail_members_filter_slice_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_members_filter_slice_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.protected_loyalty_members WHERE - SUBSTRING(first_name, 2, 1) = 'a' + SUBSTRING(PTY_UNPROTECT(first_name, 'deName'), 2, 1) = 'a' diff --git a/tests/test_sql_refsols/retail_transactions_filter_raw_snowflake.sql b/tests/test_sql_refsols/retail_transactions_filter_raw_snowflake.sql index 468e74912..c00c12c43 100644 --- a/tests/test_sql_refsols/retail_transactions_filter_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_transactions_filter_raw_snowflake.sql @@ -2,5 +2,5 @@ SELECT ROUND(AVG(total_amount), 2) AS n FROM bodo.retail.transactions WHERE - MONTH(CAST(transaction_date AS TIMESTAMP)) = 7 - AND YEAR(CAST(transaction_date AS TIMESTAMP)) = 2025 + MONTH(CAST(PTY_UNPROTECT_TS(transaction_date) AS TIMESTAMP)) = 7 + AND YEAR(CAST(PTY_UNPROTECT_TS(transaction_date) AS TIMESTAMP)) = 2025 diff --git a/tests/test_sql_refsols/retail_transactions_filter_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_transactions_filter_rewrite_snowflake.sql index 468e74912..c00c12c43 100644 --- a/tests/test_sql_refsols/retail_transactions_filter_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_transactions_filter_rewrite_snowflake.sql @@ -2,5 +2,5 @@ SELECT ROUND(AVG(total_amount), 2) AS n FROM bodo.retail.transactions WHERE - MONTH(CAST(transaction_date AS TIMESTAMP)) = 7 - AND YEAR(CAST(transaction_date AS TIMESTAMP)) = 2025 + MONTH(CAST(PTY_UNPROTECT_TS(transaction_date) AS TIMESTAMP)) = 7 + AND YEAR(CAST(PTY_UNPROTECT_TS(transaction_date) AS TIMESTAMP)) = 2025 diff --git a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_a_raw_snowflake.sql b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_a_raw_snowflake.sql index e59cd7ec8..826832c55 100644 --- a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_a_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_a_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.transactions WHERE - payment_method = 'Cash' + PTY_UNPROTECT_ACCOUNT(payment_method) = 'Cash' diff --git a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_a_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_a_rewrite_snowflake.sql index e59cd7ec8..826832c55 100644 --- a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_a_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_a_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.transactions WHERE - payment_method = 'Cash' + PTY_UNPROTECT_ACCOUNT(payment_method) = 'Cash' diff --git a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_b_raw_snowflake.sql b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_b_raw_snowflake.sql index 486ebb6ac..64ac0c6b7 100644 --- a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_b_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_b_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.transactions WHERE - payment_method <> 'Credit Card' + PTY_UNPROTECT_ACCOUNT(payment_method) <> 'Credit Card' diff --git a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_b_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_b_rewrite_snowflake.sql index 486ebb6ac..64ac0c6b7 100644 --- a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_b_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_b_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.transactions WHERE - payment_method <> 'Credit Card' + PTY_UNPROTECT_ACCOUNT(payment_method) <> 'Credit Card' diff --git a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_c_raw_snowflake.sql b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_c_raw_snowflake.sql index a0218bd3d..2cf6554da 100644 --- a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_c_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_c_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.transactions WHERE - payment_method IN ('Cash', 'Gift Card') + PTY_UNPROTECT_ACCOUNT(payment_method) IN ('Cash', 'Gift Card') diff --git a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_c_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_c_rewrite_snowflake.sql index a0218bd3d..2cf6554da 100644 --- a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_c_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_c_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.transactions WHERE - payment_method IN ('Cash', 'Gift Card') + PTY_UNPROTECT_ACCOUNT(payment_method) IN ('Cash', 'Gift Card') diff --git a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_d_raw_snowflake.sql b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_d_raw_snowflake.sql index 7b31c5dab..6d863d06d 100644 --- a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_d_raw_snowflake.sql +++ b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_d_raw_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.transactions WHERE - NOT payment_method IN ('Mobile Payment', 'Gift Card') + NOT PTY_UNPROTECT_ACCOUNT(payment_method) IN ('Mobile Payment', 'Gift Card') diff --git a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_d_rewrite_snowflake.sql b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_d_rewrite_snowflake.sql index 7b31c5dab..6d863d06d 100644 --- a/tests/test_sql_refsols/retail_transactions_payment_method_cmp_d_rewrite_snowflake.sql +++ b/tests/test_sql_refsols/retail_transactions_payment_method_cmp_d_rewrite_snowflake.sql @@ -2,4 +2,4 @@ SELECT COUNT(*) AS n FROM bodo.retail.transactions WHERE - NOT payment_method IN ('Mobile Payment', 'Gift Card') + NOT PTY_UNPROTECT_ACCOUNT(payment_method) IN ('Mobile Payment', 'Gift Card')