Skip to content

Conversation

@yaooqinn
Copy link
Member

This backports #34697 to 3.1

What changes were proposed in this pull request?

We will store table schema in table properties for the read-side to restore. In Spark 3.1, we add char/varchar support natively. In some commands like create table, alter table with these types, the char(x) or varchar(x) will be stored directly to those properties. If a user uses Spark 2 to read such a table it will fail to parse the schema.

FYI, https://github.com/apache/spark/blob/branch-2.4/sql/catalyst/src/main/scala/org/apache/spark/sql/types/DataType.scala#L136

A table can be a newly created one by Spark 3.1 and later or an existing one modified by Spark 3.1 and on.

Why are the changes needed?

backward compatibility

Does this PR introduce any user-facing change?

That's not necessarily user-facing as a bugfix and only related to internal table properties.

How was this patch tested?

manully

@github-actions github-actions bot added the SQL label Nov 29, 2021
@SparkQA
Copy link

SparkQA commented Nov 29, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50178/

@SparkQA
Copy link

SparkQA commented Nov 29, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50178/

@SparkQA
Copy link

SparkQA commented Nov 29, 2021

Test build #145708 has finished for PR 34736 at commit efe00f7.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM.

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-37452][SQL][BACKPORT][3.1] Char and Varchar break backward compatibility between v3.1 and v2 [SPARK-37452][SQL][3.1] Char and Varchar break backward compatibility between v3.1 and v2 Nov 30, 2021
dongjoon-hyun pushed a commit that referenced this pull request Nov 30, 2021
… between v3.1 and v2

This backports #34697 to 3.1

### What changes were proposed in this pull request?

We will store table schema in table properties for the read-side to restore. In Spark 3.1, we add char/varchar support natively. In some commands like `create table`, `alter table` with these types,  the `char(x)` or `varchar(x)` will be stored directly to those properties. If a user uses Spark 2 to read such a table it will fail to parse the schema.

FYI, https://github.com/apache/spark/blob/branch-2.4/sql/catalyst/src/main/scala/org/apache/spark/sql/types/DataType.scala#L136

A table can be a newly created one by Spark 3.1 and later or an existing one modified by Spark 3.1 and on.

### Why are the changes needed?

backward compatibility

### Does this PR introduce _any_ user-facing change?

That's not necessarily user-facing as a bugfix and only related to internal table properties.

### How was this patch tested?

manully

Closes #34736 from yaooqinn/PR_TOOL_PICK_PR_34697_BRANCH-3.1.

Authored-by: Kent Yao <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
fishcus pushed a commit to fishcus/spark that referenced this pull request Jan 12, 2022
… between v3.1 and v2

This backports apache#34697 to 3.1

### What changes were proposed in this pull request?

We will store table schema in table properties for the read-side to restore. In Spark 3.1, we add char/varchar support natively. In some commands like `create table`, `alter table` with these types,  the `char(x)` or `varchar(x)` will be stored directly to those properties. If a user uses Spark 2 to read such a table it will fail to parse the schema.

FYI, https://github.com/apache/spark/blob/branch-2.4/sql/catalyst/src/main/scala/org/apache/spark/sql/types/DataType.scala#L136

A table can be a newly created one by Spark 3.1 and later or an existing one modified by Spark 3.1 and on.

### Why are the changes needed?

backward compatibility

### Does this PR introduce _any_ user-facing change?

That's not necessarily user-facing as a bugfix and only related to internal table properties.

### How was this patch tested?

manully

Closes apache#34736 from yaooqinn/PR_TOOL_PICK_PR_34697_BRANCH-3.1.

Authored-by: Kent Yao <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
@yaooqinn yaooqinn deleted the PR_TOOL_PICK_PR_34697_BRANCH-3.1 branch October 25, 2024 05:22
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.

4 participants