Skip to content

Preserve declared CTAS field metadata - #183

Merged
osipovartem merged 1 commit into
df55-physical-udf-instancefrom
fix/ctas-declared-field-metadata-20261112
Nov 12, 2026
Merged

osipovartem merged 1 commit into
df55-physical-udf-instancefrom
fix/ctas-declared-field-metadata-20261112

Conversation

@osipovartem

Copy link
Copy Markdown
Collaborator

Summary

Preserve metadata supplied by a custom type planner for explicit CTAS target columns. The current cast(column, target_type).alias(target_name) projection drops declared metadata. In Rustice this loses VARCHAR(n) constraints and can make an invalid CREATE OR REPLACE ... AS SELECT replace the original table.

Apply declared metadata to the existing outer alias, only when it is nonempty. Declared keys override inherited keys using the existing alias merge policy; unrelated source keys are retained. Strict casts, qualified input references, nullability and the unannotated/inferred CTAS paths stay unchanged. No new execution operator, per-row conversion or runtime validator is introduced.

Validation

  • Rust 1.99.0, offline locked CI-profile datafusion-sql sql_integration: 664 passed, 0 failed.
  • New planner cases cover declared metadata, conflicting source keys, quoted target names, qualified wildcard/join columns, strict casts, nullability and unannotated/inferred controls.
  • rustfmt --check and git diff --check pass.
  • Independent read-only agent review: approved; no blocking correctness, regression, performance or API findings.

The initial new unannotated control incorrectly expected Utf8 instead of the existing Utf8View default. The corrected control now passes; no existing expectations were changed.

This qualifies SQL planning, not full Rustice runtime behavior. Rustice native/wire CTAS acceptance and dependency adoption are a separate follow-up. Clearing inherited keys absent from the declared target remains outside this change.

@github-actions github-actions Bot added the sql label Nov 12, 2026
@osipovartem
osipovartem merged commit e662360 into df55-physical-udf-instance Nov 12, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant