Skip to content

Conversation

@zhuqi-lucas
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

Relax the datatype check to pass when we support cast, and the final map batch schema will automatically insert the the right schema datatype field.

What changes are included in this PR?

Relax the datatype check to pass when we support cast, and the final map batch schema will automatically insert the the right schema datatype field.

Are these changes tested?

Yes

Are there any user-facing changes?

Support the consistent API which is same with sql insert into.

@github-actions github-actions bot added core Core DataFusion crate common Related to common crate labels Mar 8, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @zhuqi-lucas -- this makes sense to me

.zip(other.fields().iter())
.try_for_each(|(f1, f2)| {
if f1.name() != f2.name() || !DFSchema::datatype_is_logically_equal(f1.data_type(), f2.data_type()) {
if f1.name() != f2.name() || (!DFSchema::datatype_is_logically_equal(f1.data_type(), f2.data_type()) && !can_cast_types(f2.data_type(), f1.data_type())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@alamb alamb merged commit afd597a into apache:main Mar 10, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate core Core DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support datatype cast for insert api same as insert into sql

2 participants