Skip to content

Commit

Permalink
Add new sort dialect flags
Browse files Browse the repository at this point in the history
  • Loading branch information
AdRiley committed Dec 20, 2024
1 parent 02e9756 commit 340aa15
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ type Redshift_Dialect
Dialect_Flag.Supports_Sort_Digits_As_Numbers -> False
Dialect_Flag.Supports_Case_Insensitive_Ordering -> False
Dialect_Flag.Order_By_Unicode_Normalization_By_Default -> True
Dialect_Flag.Order_By_Unicode_Normalization_When_Case_Insensitive -> True
Dialect_Flag.Case_Insensitive_Ordering_By_Default -> True
Dialect_Flag.Allows_Mixed_Type_Comparisons -> False
Dialect_Flag.Supports_Unicode_Normalization -> False
Dialect_Flag.NaN_Non_Comparable -> True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,14 @@ type Dialect_Flag
Specifies if the backend supports case insensitive ordering.
Supports_Case_Insensitive_Ordering
## PRIVATE
Specifies if the backend supports unicode normalization in its default ordering.
Specifies if the backend uses case insensitive sort in its default ordering.
Case_Insensitive_Ordering_By_Default
## PRIVATE
Specifies if the backend uses unicode normalization in its default ordering.
Order_By_Unicode_Normalization_By_Default
## PRIVATE
Specifies if the backend uses unicode normalization when doing case insentive ordering.
Order_By_Unicode_Normalization_When_Case_Insensitive
## PRIVATE
Specifies if mixed operations comparing
mixed types are allowed by a given backend. Some backends will allow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ type Postgres_Dialect
Dialect_Flag.Supports_Sort_Digits_As_Numbers -> False
Dialect_Flag.Supports_Case_Insensitive_Ordering -> True
Dialect_Flag.Order_By_Unicode_Normalization_By_Default -> True
Dialect_Flag.Order_By_Unicode_Normalization_When_Case_Insensitive -> True
Dialect_Flag.Case_Insensitive_Ordering_By_Default -> True
Dialect_Flag.Allows_Mixed_Type_Comparisons -> False
Dialect_Flag.Supports_Unicode_Normalization -> False
Dialect_Flag.NaN_Non_Comparable -> False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ type SQLite_Dialect
Dialect_Flag.Supports_Sort_Digits_As_Numbers -> False
Dialect_Flag.Supports_Case_Insensitive_Ordering -> True
Dialect_Flag.Order_By_Unicode_Normalization_By_Default -> False
Dialect_Flag.Order_By_Unicode_Normalization_When_Case_Insensitive -> False
Dialect_Flag.Case_Insensitive_Ordering_By_Default -> False
Dialect_Flag.Allows_Mixed_Type_Comparisons -> True
Dialect_Flag.Supports_Unicode_Normalization -> False
Dialect_Flag.NaN_Non_Comparable -> True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ type SQLServer_Dialect
Dialect_Flag.Supports_Sort_Digits_As_Numbers -> False
Dialect_Flag.Supports_Case_Insensitive_Ordering -> True
Dialect_Flag.Order_By_Unicode_Normalization_By_Default -> True
Dialect_Flag.Order_By_Unicode_Normalization_When_Case_Insensitive -> True
Dialect_Flag.Case_Insensitive_Ordering_By_Default -> True
Dialect_Flag.Allows_Mixed_Type_Comparisons -> False
Dialect_Flag.Supports_Unicode_Normalization -> False
Dialect_Flag.NaN_Non_Comparable -> True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ type Snowflake_Dialect
Dialect_Flag.Supports_Sort_Digits_As_Numbers -> False
Dialect_Flag.Supports_Case_Insensitive_Ordering -> True
Dialect_Flag.Order_By_Unicode_Normalization_By_Default -> False
Dialect_Flag.Order_By_Unicode_Normalization_When_Case_Insensitive -> True
Dialect_Flag.Case_Insensitive_Ordering_By_Default -> False
Dialect_Flag.Allows_Mixed_Type_Comparisons -> False
Dialect_Flag.Supports_Unicode_Normalization -> False
Dialect_Flag.NaN_Non_Comparable -> False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ add_order_specs suite_builder setup =

if setup.flagged ..Supports_Case_Insensitive_Ordering then group_builder.specify "should support case insensitive ordering" <|
t1 = data.table.sort [..Name "eta"] text_ordering=(..Case_Insensitive)
expected = ["Aleph", "alpha", "bądź", "Beta"]
expected = case setup.flagged ..Order_By_Unicode_Normalization_When_Case_Insensitive of
False -> ["Aleph", "alpha", "Beta", "bądź"]
True -> ["Aleph", "alpha", "bądź", "Beta"]
t1.at "eta" . to_vector . should_equal expected

t2 = data.table.sort [..Name "eta"] text_ordering=(..Case_Sensitive)
Expand All @@ -296,7 +298,7 @@ add_order_specs suite_builder setup =
t3.at "psi" . to_vector . should_equal [Nothing, "c01", "c10", "C2"]

t4 = data.table.sort [..Name "psi"]
case setup.flagged ..Order_By_Unicode_Normalization_By_Default of
case setup.flagged ..Case_Insensitive_Ordering_By_Default of
True -> t4.at "psi" . to_vector . should_equal [Nothing, "c01", "c10", "C2"]
False -> t4.at "psi" . to_vector . should_equal [Nothing, "C2", "c01", "c10"]

Expand Down
1 change: 1 addition & 0 deletions test/Table_Tests/src/In_Memory/Common_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ in_memory_setup =
True
flagged_fn flag:Dialect_Flag =
case flag of
Dialect_Flag.Case_Insensitive_Ordering_By_Default -> False
Dialect_Flag.Removes_Trailing_Whitespace_Casting_From_Char_To_Varchar -> False
_ -> True

Expand Down

0 comments on commit 340aa15

Please sign in to comment.