Skip to content

[SPARK-30472][SQL] ANSI SQL: Throw exception on format invalid and overflow when casting String to IntegerType. - #27152

Closed
turboFei wants to merge 5 commits into
apache:masterfrom
turboFei:SPARK-30374-string-toInt
Closed

[SPARK-30472][SQL] ANSI SQL: Throw exception on format invalid and overflow when casting String to IntegerType.#27152
turboFei wants to merge 5 commits into
apache:masterfrom
turboFei:SPARK-30374-string-toInt

Conversation

@turboFei

@turboFeiturboFei commented Jan 9, 2020

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

In this PR, when spark.sql.ansi.enabled is true.
When casting stringType to Int.
If the string format is invalid or its value overflow the range of Int, we would throw exception to keep consistent with ANSI.

Why are the changes needed?

To keep consistent with ANSI, when spark.sql.ansi.enable is true.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Added Unit Test.

@turboFeiturboFei changed the title [SPARK-30374] Cast String to Integer Type, throw exception on format invalid and overflow.[SPARK-30374][SQL] Cast String to Integer Type, throw exception on format invalid and overflow.Jan 9, 2020
@AmplabJenkins

Copy link
Copy Markdown

Can one of the admins verify this patch?

@turboFeiturboFei changed the title [SPARK-30374][SQL] Cast String to Integer Type, throw exception on format invalid and overflow.[WIP][SPARK-30374][SQL] Cast String to Integer Type, throw exception on format invalid and overflow.Jan 9, 2020
@turboFeiturboFei changed the title [WIP][SPARK-30374][SQL] Cast String to Integer Type, throw exception on format invalid and overflow.[SPARK-30472][SQL] ANSI SQL: Throw exception on format invalid and overflow when casting String to IntegerType.Jan 9, 2020
@turboFei

Copy link
Copy Markdown
MemberAuthor

@iRakson

Copy link
Copy Markdown
Contributor

I guess this problem is solved in this -> #26933

@turboFei

Copy link
Copy Markdown
MemberAuthor

thanks. closed @iRakson

Sign up for freeto 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

@turboFei@AmplabJenkins@iRakson@dongjoon-hyun