Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement in-memory and database mixed decimal column comparisons #10614

Merged
merged 48 commits into from
Jul 25, 2024

Conversation

GregoryTravis
Copy link
Contributor

@GregoryTravis GregoryTravis commented Jul 19, 2024

Also implement more comprehensive mixed comparison tests.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.

@GregoryTravis
Copy link
Contributor Author

This still has only failing test but mostly it is ready for review.

@GregoryTravis GregoryTravis changed the title Implement in-memory mixed decimal column comparisons Implement in-memory and database mixed decimal column comparisons Jul 22, 2024
@GregoryTravis GregoryTravis added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Jul 23, 2024
Comment on lines 673 to 698
group_builder.specify "(Column_Operations_Spec) should allow to compare numbers (including mixed types)" <|
x_values = [1.25, 4.5, 5.0]
y_values = [2.0, 3.0, 5.0]

converters = [.truncate, x->x, dec]
converters.map x_converter-> converters.map y_converter->
x_values_converted = x_values.map x_converter
y_values_converted = y_values.map y_converter
with_mixed_columns_if_supported [['x', x_values_converted + [Nothing]], ['y', y_values_converted + [Nothing]]] t->
x = t.at "x"
y = t.at "y"

Test.with_clue " comparison: "+x.value_type.to_text+', '+y.value_type.to_text+" " <|
(x < y).to_vector . should_equal [True, False, False, Nothing]
(x <= y).to_vector . should_equal [True, False, True, Nothing]
(x > y).to_vector . should_equal (x <= y).not.to_vector
(x >= y).to_vector . should_equal (x < y).not.to_vector

converters.map converter->
const_float = 3.0
constant = converter const_float
Test.with_clue " constant: "+(Meta.get_simple_type_name constant) <|
(x == constant).to_vector . should_equal [False, False, False, Nothing]
(x != constant).to_vector . should_equal [True, True, True, Nothing]
(y == constant).to_vector . should_equal [False, True, False, Nothing]
(y != constant).to_vector . should_equal [True, False, True, Nothing]
Copy link
Member

@radeusgd radeusgd Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of nesting. What is the runtime of this test for in-memory/Postgres?

I think it should be disabled for Snowflake as I imagine it will be super slow there.

Could you make it pending if run_advanced_edge_case_tests is false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Member

@radeusgd radeusgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but now that we know how much slower tests like Snowflake are, please let's ensure that such thorough tests are hidden behind run_advanced_edge_case_tests flag. Apart from in-memory, they are testing the underlying DB implementation that we do not control anyway.

@GregoryTravis GregoryTravis added CI: Ready to merge This PR is eligible for automatic merge CI: Clean build required CI runners will be cleaned before and after this PR is built. and removed CI: Clean build required CI runners will be cleaned before and after this PR is built. labels Jul 24, 2024
@mergify mergify bot merged commit f31c084 into develop Jul 25, 2024
36 checks passed
@mergify mergify bot deleted the wip/gmt/10163-d-col-comp branch July 25, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants