Skip to content

Conversation

@MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Feb 8, 2022

What changes were proposed in this pull request?

In the PR, I propose to remove the error class ROW_FROM_CSV_PARSER_NOT_EXPECTED and don't use the error class UNSUPPORTED_FEATURE in an up-cast exception which is an internal one.

Why are the changes needed?

The error classes are supposed to be used in user-facing errors/exceptions only. It doesn't make sense to introduce/use them in internal errors.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

By running existing test suites.

""".stripMargin.trim + " of the field in the target object")
}

test("UNSUPPORTED_FEATURE: UpCast only support DecimalType as AbstractDataType") {
Copy link
Member Author

Choose a reason for hiding this comment

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

The test was added by #35366 recently while porting on error classes. So, it is safe to remove it.

result
} else {
throw QueryExecutionErrors.rowFromCSVParserNotExpectedError
throw new IllegalStateException("Expected one row from CSV parser.")
Copy link
Member Author

Choose a reason for hiding this comment

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

I do believe this shouldn't happen. cc @HyukjinKwon

Copy link
Member

Choose a reason for hiding this comment

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

lgtm


case UpCast(_, target, _) if target != DecimalType && !target.isInstanceOf[DataType] =>
throw QueryCompilationErrors.unsupportedAbstractDataTypeForUpCastError(target)
throw new AnalysisException(
Copy link
Contributor

Choose a reason for hiding this comment

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

For internal errors, can we throw IllegalStateException?

@MaxGekk
Copy link
Member Author

MaxGekk commented Feb 10, 2022

Merging to master. Thank you, @HyukjinKwon and @cloud-fan for review.

@MaxGekk MaxGekk closed this in 53ba6e2 Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants