Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@DinosL
Copy link
Contributor

@DinosL DinosL commented Sep 16, 2025

fixes https://github.com/duckdblabs/duckdb-internal/issues/5876
fixes #18967

Together with @Tmonster we managed to come up with a fix. We identified two separate issue.

  • an inconsistency when running the same query with and without a conjuction. The problem there was that even though we were making changes in the child expression, the variable changes_made was never updated. As a result, the expression rewriter was not aware of the changes and was not re-reruning before going to the next rule.
  • Even when the cast is not invertible, the code would drop the cast and just compare the LHS and RHS if the RHS could be casted (and invertible) to the target type.

To solve this we identified two solutions. One option is to change the functionality and when the cast is not invertible always run the cast or try_cast, but that is more work for the engine. The other option is to keep the old functionality, and just fix the inconsistency

@duckdb-draftbot duckdb-draftbot marked this pull request as draft September 16, 2025 09:22
@Mytherin Mytherin requested a review from Tmonster September 16, 2025 09:31
@Mytherin Mytherin marked this pull request as ready for review September 18, 2025 05:35
Copy link
Contributor

@Tmonster Tmonster left a comment

Choose a reason for hiding this comment

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

Thanks! Just some comments on the test file.

# group: [optimizer]

statement ok
pragma disable_optimizer;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this? And can we add the statement pragma enable_verification?

INSERT INTO t0(c0, c1) VALUES (890608529, false);

statement ok
pragma enable_optimizer;
Copy link
Contributor

Choose a reason for hiding this comment

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

This can also be removed

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
Contributor

Choose a reason for hiding this comment

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

seems like you added an empty file here. Can you take this out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for that. I should have double-checked the commit.

@duckdb-draftbot duckdb-draftbot marked this pull request as draft September 18, 2025 13:41
@Mytherin Mytherin marked this pull request as ready for review September 18, 2025 13:41
Copy link
Contributor

@Tmonster Tmonster left a comment

Choose a reason for hiding this comment

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

Thanks!

@Mytherin Mytherin merged commit eaa28d6 into duckdb:v1.4-andium Sep 19, 2025
96 checks passed
@Mytherin
Copy link
Collaborator

Thanks!

krlmlr added a commit to duckdb/duckdb-r that referenced this pull request Sep 29, 2025
Always execute cast and try_cast if they are not invertible (duckdb/duckdb#19010)
add a bunch of expected error messages to old macro tests and fix iss… (duckdb/duckdb#19042)
[unittest] Fixes so that '{BASE_TEST_NAME}' can be used within --on-new-connection (duckdb/duckdb#19056)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants