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: cast NULLs in VALUES clause (df->values) to avoid coercion issues #2856

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

georgesittas
Copy link
Contributor

Fixes #2684

Gave it a whirl. Not sure if this is too intrusive to fix the linked issue - happy to discuss and refactor if needed.

cc @z3z1ma

@georgesittas georgesittas requested a review from a team July 3, 2024 15:47
@@ -897,6 +897,14 @@ def select_from_values_for_batch_range(
]

values_exp = exp.values(expressions, alias=alias, columns=columns_to_types)
if values:
Copy link
Contributor

Choose a reason for hiding this comment

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

if we cast values, directly, do we need to also cast the select?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

are you referring to the projections? because we already cast them earlier in this function

Copy link
Contributor

Choose a reason for hiding this comment

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

yea but now it's a double cast, cast in the values, and cast in the projection, should we just do one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah gotcha.. I guess we can try? I was being conservative because I'm not sure what the implications are in case we remove those casts, maybe we'll fail to infer the type of a projection down the line somewhere? On the other hand, we seem to have the columns_to_types mapping already, so perhaps it's fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

no big deal

@georgesittas georgesittas merged commit f3cb2fa into main Jul 4, 2024
15 checks passed
@georgesittas georgesittas deleted the jo/cast_null_values_in_values_expr branch July 4, 2024 06:19
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.

Bigquery unit tests with partial inputs fail on uncoercable types
2 participants