Skip to content

Commit

Permalink
Merge pull request #30028 from nrainer-materialize/postgres-consisten…
Browse files Browse the repository at this point in the history
…cy/adjust-ignore

postgres consistency: adjust ignore
  • Loading branch information
nrainer-materialize authored Oct 16, 2024
2 parents c7868cd + 4580513 commit 0fbabb5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 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 @@ -72,6 +72,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 @@ -1099,14 +1102,19 @@ def matches_nullif(expression: Expression) -> bool:
"database-issues#8293: ALL and ANY with NULL or empty array"
)

if query_template.matches_specific_select_or_filter_expression(
col_index,
is_table_function,
# 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(
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
# comparator. However, this is not sufficient when a LIMIT or OFFSET clause is present.
return YesIgnore("Different sort order")
return YesIgnore(
"Different sort order (partially a consequence of database-issues#6620 and database-issues#7812)"
)

if query_template.matches_specific_select_or_filter_expression(
col_index,
Expand Down

0 comments on commit 0fbabb5

Please sign in to comment.