Skip to content

Commit

Permalink
postgres consistency: narrow entry regarding table functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nrainer-materialize committed Oct 16, 2024
1 parent 8909a3f commit 4580513
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
OperationRelevance,
)

TAG_TABLE_FUNCTION_WITH_NON_NUMERIC_SORT_ORDER = (
"table_function_with_non_numeric_sort_order"
)

TABLE_OPERATION_TYPES: list[DbOperationOrFunction] = []

TABLE_OPERATION_TYPES.append(
Expand Down Expand Up @@ -129,6 +133,7 @@
NumericReturnTypeSpec(only_integer=True),
is_table_function=True,
comment="Returns indices of the specified array dimension",
tags={TAG_TABLE_FUNCTION_WITH_NON_NUMERIC_SORT_ORDER},
),
)

Expand All @@ -141,7 +146,7 @@
],
StringReturnTypeSpec(),
is_table_function=True,
tags={TAG_REGEX},
tags={TAG_REGEX, TAG_TABLE_FUNCTION_WITH_NON_NUMERIC_SORT_ORDER},
),
)

Expand All @@ -153,7 +158,7 @@
is_table_function=True,
# It is not possible to specify the order so that inconsistencies are inevitable.
is_pg_compatible=False,
tags={TAG_REGEX},
tags={TAG_REGEX, TAG_TABLE_FUNCTION_WITH_NON_NUMERIC_SORT_ORDER},
),
)

Expand All @@ -165,6 +170,7 @@
],
CollectionEntryReturnTypeSpec(param_index_to_take_type=0),
is_table_function=True,
tags={TAG_TABLE_FUNCTION_WITH_NON_NUMERIC_SORT_ORDER},
),
)

Expand All @@ -176,6 +182,7 @@
],
CollectionEntryReturnTypeSpec(param_index_to_take_type=0),
is_table_function=True,
tags={TAG_TABLE_FUNCTION_WITH_NON_NUMERIC_SORT_ORDER},
),
)

Expand All @@ -187,5 +194,6 @@
],
RecordReturnTypeSpec(),
is_table_function=True,
tags={TAG_TABLE_FUNCTION_WITH_NON_NUMERIC_SORT_ORDER},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
from materialize.output_consistency.input_data.operations.string_operations_provider import (
TAG_REGEX,
)
from materialize.output_consistency.input_data.operations.table_operations_provider import (
TAG_TABLE_FUNCTION_WITH_NON_NUMERIC_SORT_ORDER,
)
from materialize.output_consistency.input_data.return_specs.number_return_spec import (
NumericReturnTypeSpec,
)
Expand Down Expand Up @@ -1092,7 +1095,9 @@ def matches_nullif(expression: Expression) -> bool:
# use here matches_any_expression instead of matches_specific_select_or_filter_expression on purpose because
# the concerned expression may affect other columns as well
if query_template.matches_any_expression(
is_table_function,
partial(
is_operation_tagged, tag=TAG_TABLE_FUNCTION_WITH_NON_NUMERIC_SORT_ORDER
),
True,
) and (query_template.has_offset() or query_template.has_limit()):
# When table functions are used, a row-order insensitive comparison will be conducted in the result
Expand Down

0 comments on commit 4580513

Please sign in to comment.