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

disable coercison for unmatched struct type #14409

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Lordworms
Copy link
Contributor

@Lordworms Lordworms commented Feb 2, 2025

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added logical-expr Logical plan and expressions optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt) labels Feb 2, 2025
@Lordworms Lordworms force-pushed the issue_14396 branch 6 times, most recently from 3d0788e to e94ce44 Compare February 3, 2025 17:46
@alamb
Copy link
Contributor

alamb commented Feb 3, 2025

Thank you @Lordworms -- I hope to review this tomorrow

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Hi @Lordworms -- thank you very much for this PR and for working on the issue

While reviewing this PR I noticed a few other tests that I think we should add (are you willing to do so?)

  1. Adding a test for coalesece(column1, column2) and `coalesce(column2, column3) which is similar to union and case
  2. Adding a test for comparison column1 = column and column2 = column3 which is also similar

Then in terms of code, As this PR demonstrates, there are at least three places that do versions of this struct comparision that need to be changed as they have different versions of code that does about the same thing by coercing structs.

I think @jayzhan211's suggestion on https://github.com/apache/datafusion/pull/14384/files#r1937492704

Yes, I think type union resolution is the correct on for CASE

Means that we should be aiming towards consolidating / using the same rules.

Maybe you could move the checks into struct_coercion and then update any other coercion that needed to coerce structs to use that one?

datafusion/optimizer/src/analyzer/type_coercion.rs Outdated Show resolved Hide resolved
@Lordworms
Copy link
Contributor Author

struct_coercion

Sure, I can do that

Hi @Lordworms -- thank you very much for this PR and for working on the issue

While reviewing this PR I noticed a few other tests that I think we should add (are you willing to do so?)

  1. Adding a test for coalesece(column1, column2) and `coalesce(column2, column3) which is similar to union and case
  2. Adding a test for comparison column1 = column and column2 = column3 which is also similar

Then in terms of code, As this PR demonstrates, there are at least three places that do versions of this struct comparision that need to be changed as they have different versions of code that does about the same thing by coercing structs.

I think @jayzhan211's suggestion on https://github.com/apache/datafusion/pull/14384/files#r1937492704

Yes, I think type union resolution is the correct on for CASE

Means that we should be aiming towards consolidating / using the same rules.

Maybe you could move the checks into struct_coercion and then update any other coercion that needed to coerce structs to use that one?

Ok, I'll add that

@github-actions github-actions bot removed logical-expr Logical plan and expressions optimizer Optimizer rules labels Feb 5, 2025
@Lordworms Lordworms force-pushed the issue_14396 branch 2 times, most recently from 1881347 to 3a2c298 Compare February 5, 2025 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent and incorrect struct field coercion
2 participants