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

Fix inference for UNION #1994

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

Fix inference for UNION #1994

wants to merge 2 commits into from

Conversation

mamcx
Copy link
Contributor

@mamcx mamcx commented Nov 13, 2024

Description of Changes

When trying to infer the type for UNION like queries we get:

 Unexpected type: (expected) (u32: U32f32: F32str: String) != (u32: U32f32: F32str: String) (inferred)

Because the check is only 'nominal' (aka: test both table_id are the same), this patch also makes a structural check.

Expected complexity level and risk

1

Testing

Describe any testing you've done, and any testing you'd like your reviewers to do,
so that you're confident that all the changes work as expected!

  • Write a test you've completed here.
  • Write a test you want a reviewer to do here, so they can check it off when they're satisfied.

@mamcx mamcx added bugfix Fixes something that was expected to work differently release-1.0 labels Nov 13, 2024
@mamcx mamcx self-assigned this Nov 13, 2024
pub fn compile_sql_stmt<'a>(sql: &'a str, tx: &impl SchemaView) -> TypingResult<StatementCtx<'a>> {
let statement = parse_and_type_sql(sql, tx)?;
pub fn compile_sql_stmt<'a>(ctx: &mut TyCtx, sql: &'a str, tx: &impl SchemaView) -> TypingResult<StatementCtx<'a>> {
let statement = parse_and_type_sql(ctx, sql, tx)?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes both compile_xxx functions share the same signature, is useful for later PRs...

@cloutiertyler
Copy link
Contributor

bots please

(doing this for unrelated reasons to this PR)

Copy link

github-actions bot commented Nov 15, 2024

Bot test failed. Please check the workflow run for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes something that was expected to work differently release-1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants