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-37643][SQL] when charVarcharAsString is true, char datatype predicate query incorrect #34900

Closed
wants to merge 2 commits into from
Closed

Conversation

fhygh
Copy link
Contributor

@fhygh fhygh commented Dec 14, 2021

What changes were proposed in this pull request?

after add ApplyCharTypePadding rule, when partition data type is char, if partition value length is less then defined, partition expr filter will be right-padding, then will query incorrect result

Why are the changes needed?

fix query incorrect issue when filter is partition type and partition type is char.

Does this PR introduce any user-facing change?

before this fix, if we using char partition type, then we should be careful to set charVarcharAsString to true.

How was this patch tested?

add new UT.

@github-actions github-actions bot added the SQL label Dec 14, 2021
@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@fhygh
Copy link
Contributor Author

fhygh commented Dec 27, 2021

anyone help to review and merge?thank you.

@github-actions
Copy link

github-actions bot commented Apr 7, 2022

We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!

@github-actions github-actions bot added the Stale label Apr 7, 2022
@fhygh
Copy link
Contributor Author

fhygh commented Apr 7, 2022

We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!

@fhygh fhygh closed this Apr 7, 2022
@fhygh fhygh reopened this Apr 7, 2022
@wzhfy
Copy link
Contributor

wzhfy commented Apr 7, 2022

also cc @yaooqinn @cloud-fan

@wzhfy wzhfy removed the Stale label Apr 7, 2022
@fhygh fhygh changed the title [SPARK-37643][SQL] when charVarcharAsString is true, char datatype partition table query incorrect [SPARK-37643][SQL] when charVarcharAsString is true, char datatype predicate query incorrect Apr 7, 2022
sql(s"CREATE TABLE t(a STRING, c CHAR(5)) USING $format partitioned by (c)")
sql("INSERT INTO t VALUES ('abc', 'abc')")
checkAnswer(sql("SELECT c FROM t WHERE c='abc'"), Row("abc"))
checkAnswer(sql("SELECT c FROM t WHERE c in ('abc')"), Row("abc"))
Copy link
Contributor

Choose a reason for hiding this comment

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

let's test both data and partition predicates.

@@ -4082,18 +4082,21 @@ object ApplyCharTypePadding extends Rule[LogicalPlan] {

Copy link
Contributor

Choose a reason for hiding this comment

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

shall we simply skip this rule if the conf is true? e.g. in the apply method, we return the input plan if SQLConf.get.charVarcharAsString is true.

Copy link
Member

Choose a reason for hiding this comment

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

+1

@cloud-fan
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants