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

[spark] Fix alter table column type change nullability #3965

Merged
merged 1 commit into from
Aug 15, 2024

Conversation

ulysses-you
Copy link
Contributor

Purpose

Spark catalog TableChange.UpdateColumnType should only change the data type, but paimon always changes the nullable to true. This pr keeps the original field nullability.

To fix the issue:

CREATE TABLE t (a INT, b BIGINT NOT NULL) USING paimon;
ALTER TABLE t CHANGE COLUMN b TYPE string;

SHOW CREATE TABLE t; => b STRING NOT NULL

Tests

add test

API and Format

no

Documentation

@ulysses-you
Copy link
Contributor Author

All Spark tests passed, the failed test seems irrelevant:

2024-08-15T03:51:37.1011203Z [ERROR] Tests run: 37, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 797.345 s <<< FAILURE! - in org.apache.paimon.hive.Hive23CatalogITCase
2024-08-15T03:51:37.1078168Z [ERROR] org.apache.paimon.hive.Hive23CatalogITCase.testDropPartitionFromBranchLocationInProperties  Time elapsed: 45.84 s  <<< ERROR!
2024-08-15T03:51:37.1080812Z org.apache.flink.table.api.TableException: Could not execute ALTER TABLE my_hive.test_db.t DROP PARTITION (pt=2)

cc @JingsongLi thank you

@JingsongLi
Copy link
Contributor

All Spark tests passed, the failed test seems irrelevant:

2024-08-15T03:51:37.1011203Z [ERROR] Tests run: 37, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 797.345 s <<< FAILURE! - in org.apache.paimon.hive.Hive23CatalogITCase
2024-08-15T03:51:37.1078168Z [ERROR] org.apache.paimon.hive.Hive23CatalogITCase.testDropPartitionFromBranchLocationInProperties  Time elapsed: 45.84 s  <<< ERROR!
2024-08-15T03:51:37.1080812Z org.apache.flink.table.api.TableException: Could not execute ALTER TABLE my_hive.test_db.t DROP PARTITION (pt=2)

cc @JingsongLi thank you

@ulysses-you
Your repo is passed. https://github.com/ulysses-you/paimon/tree/nullable

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

+1

@JingsongLi JingsongLi merged commit e9c46c9 into apache:master Aug 15, 2024
9 of 10 checks passed
@ulysses-you
Copy link
Contributor Author

Your repo is passed. https://github.com/ulysses-you/paimon/tree/nullable

oh, interesting, it is the double check!

@ulysses-you ulysses-you deleted the nullable branch August 15, 2024 04:09
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.

2 participants