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

Flatten case when branch result type in PlanTyper #1368

Merged
merged 2 commits into from
Feb 10, 2024

Conversation

alancai98
Copy link
Member

@alancai98 alancai98 commented Feb 10, 2024

Description

Typing of a CASE WHEN branch does not flatten the type in certain circumstances. Noticed this when I called SELECT <table>.<struct>.* FROM <table> and the an argument of the TUPLEUNION was an AnyOfType containing a single STRUCT.

Other Information

License Information

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@alancai98 alancai98 requested review from yliuuuu and removed request for yliuuuu February 10, 2024 00:27
@alancai98 alancai98 self-assigned this Feb 10, 2024
Copy link

Conformance comparison report

Base (5e9cd19) 2018de3 +/-
% Passing 92.54% 92.54% 0.00%
✅ Passing 5384 5384 0
❌ Failing 434 434 0
🔶 Ignored 0 0 0
Total Tests 5818 5818 0

Number passing in both: 5384

Number failing in both: 434

Number passing in Base (5e9cd19) but now fail: 0

Number failing in Base (5e9cd19) but now pass: 0

@@ -796,7 +796,7 @@ internal class PlanTyper(
}

// Replace the result's type
val type = AnyOfType(ref.type.allTypes.filterIsInstance<StructType>().toSet())
val type = AnyOfType(ref.type.allTypes.filterIsInstance<StructType>().toSet()).flatten()
Copy link
Member Author

Choose a reason for hiding this comment

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

In the other branch (L767-785), there is a .flatten() call on L782, but there is no .flatten() call within this branch.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5e9cd19) 80.76% compared to head (36325ea) 72.15%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1368      +/-   ##
============================================
- Coverage     80.76%   72.15%   -8.61%     
- Complexity     2064     2095      +31     
============================================
  Files           191      221      +30     
  Lines         13987    15984    +1997     
  Branches       2651     2896     +245     
============================================
+ Hits          11297    11534     +237     
- Misses         1903     3641    +1738     
- Partials        787      809      +22     
Flag Coverage Δ
CLI 11.86% <ø> (?)
EXAMPLES 80.28% <ø> (ø)
LANG 80.78% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alancai98 alancai98 merged commit e894fad into main Feb 10, 2024
10 checks passed
@alancai98 alancai98 deleted the add-additional-flatten branch February 10, 2024 01:18
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