Skip to content

Conversation

@LuciferYang
Copy link
Contributor

@LuciferYang LuciferYang commented Nov 18, 2022

What changes were proposed in this pull request?

This pr aims to move require() out from the constructors of string expressions, include ConcatWs and FormatString.
The args number checking logic moved into checkInputDataTypes().

Why are the changes needed?

Migration onto error classes unifies Spark SQL error messages.

Does this PR introduce any user-facing change?

Yes. The PR changes user-facing error messages.

How was this patch tested?

Pass GitHub Actions

@LuciferYang LuciferYang marked this pull request as draft November 18, 2022 05:51
@github-actions github-actions bot added the SQL label Nov 18, 2022
@LuciferYang LuciferYang changed the title [SPARK-41173][SQL] Move require() out from the constructors of string expressions [WIP][SPARK-41173][SQL] Move require() out from the constructors of string expressions Nov 18, 2022
@LuciferYang LuciferYang marked this pull request as ready for review November 18, 2022 06:50
@LuciferYang LuciferYang changed the title [WIP][SPARK-41173][SQL] Move require() out from the constructors of string expressions [SPARK-41173][SQL] Move require() out from the constructors of string expressions Nov 18, 2022
-- !query output
org.apache.spark.sql.AnalysisException
requirement failed: format_string() should take at least 1 argument; line 1 pos 7
0; line 1 pos 7
Copy link
Member

Choose a reason for hiding this comment

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

hmm, why is that? We should see similar error as for select concat_ws().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


require(children.nonEmpty, s"$prettyName() should take at least 1 argument")
if (!SQLConf.get.getConf(SQLConf.ALLOW_ZERO_INDEX_IN_FORMAT_STRING)) {
if (children.nonEmpty && !SQLConf.get.getConf(SQLConf.ALLOW_ZERO_INDEX_IN_FORMAT_STRING)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

My mistake, need to add nonEmpty condition

@MaxGekk
Copy link
Member

MaxGekk commented Nov 18, 2022

+1, LGTM. Merging to master.
Thank you, @LuciferYang.

@MaxGekk MaxGekk closed this in b96ddce Nov 18, 2022
SandishKumarHN pushed a commit to SandishKumarHN/spark that referenced this pull request Dec 12, 2022
…ng expressions

### What changes were proposed in this pull request?
This pr aims to move `require()` out from the constructors of string expressions, include  `ConcatWs` and `FormatString`.
The args number checking logic moved into `checkInputDataTypes()`.

### Why are the changes needed?
Migration onto error classes unifies Spark SQL error messages.

### Does this PR introduce _any_ user-facing change?
Yes. The PR changes user-facing error messages.

### How was this patch tested?
Pass GitHub Actions

Closes apache#38705 from LuciferYang/SPARK-41173.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 15, 2022
…ng expressions

### What changes were proposed in this pull request?
This pr aims to move `require()` out from the constructors of string expressions, include  `ConcatWs` and `FormatString`.
The args number checking logic moved into `checkInputDataTypes()`.

### Why are the changes needed?
Migration onto error classes unifies Spark SQL error messages.

### Does this PR introduce _any_ user-facing change?
Yes. The PR changes user-facing error messages.

### How was this patch tested?
Pass GitHub Actions

Closes apache#38705 from LuciferYang/SPARK-41173.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 18, 2022
…ng expressions

### What changes were proposed in this pull request?
This pr aims to move `require()` out from the constructors of string expressions, include  `ConcatWs` and `FormatString`.
The args number checking logic moved into `checkInputDataTypes()`.

### Why are the changes needed?
Migration onto error classes unifies Spark SQL error messages.

### Does this PR introduce _any_ user-facing change?
Yes. The PR changes user-facing error messages.

### How was this patch tested?
Pass GitHub Actions

Closes apache#38705 from LuciferYang/SPARK-41173.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
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.

2 participants