Skip to content

Align input logical plan schema with target table schema for CTAs/INSERT #1105

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

Merged
merged 2 commits into from
Jun 16, 2025

Conversation

osipovartem
Copy link
Contributor

Closes #1088

This PR adds a helper function to align input logical plan schemas to the target table schema when executing CTAsor INSERT operations. It automatically inserts projection and casts where necessary to ensure schema compatibility, avoiding runtime type mismatches (e.g. TIMESTAMP(NANOSECOND) → TIMESTAMP(MICROSECOND)).

Copy link
Contributor

SQL Logic Tests Results ❌

Coverage by SLT File

  • try_cast: 2/4 (50.0%)
  • create-table: 23/40 (57.5%)
  • cast: 0/5 (0.0%)
  • try_to_timestamp: 0/1 (0.0%)
  • to_timestamp: 0/10 (0.0%)

Overall: 25/60 (41.7%)

Copy link
Contributor

SQL Logic Tests Results ❌

Coverage by SLT File

  • insert: 22/25 (88.0%)
  • timestampadd: 4/5 (80.0%)
  • cast: 0/5 (0.0%)
  • try_cast: 2/4 (50.0%)
  • to_timestamp: 0/10 (0.0%)
  • timestampdiff: 0/3 (0.0%)

Overall: 28/52 (53.8%)

Copy link
Contributor

@rampage644 rampage644 left a comment

Choose a reason for hiding this comment

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

Is it going to conflict with #1107?

@osipovartem osipovartem merged commit 10355fe into main Jun 16, 2025
6 checks passed
@osipovartem osipovartem deleted the issues/1088_fix_timestamp_cast branch June 16, 2025 16:52
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.

CTAS fails when one column being cast to TIMESTAMP type
2 participants