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

[Fix] Fix the error msg when parse schema with unsupported type #5790

Merged
merged 3 commits into from
Nov 7, 2023

Conversation

Hisoka-X
Copy link
Member

@Hisoka-X Hisoka-X commented Nov 6, 2023

Purpose of this pull request

This PR fixed when parse schema with unsupported type will return unexpected error msg.
eg:
parse schema type with uuid.

Caused by: org.apache.seatunnel.shade.com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'uuid': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: (byte[])"uuid"; line: 1, column: 5]
	at org.apache.seatunnel.shade.com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2391)
	at org.apache.seatunnel.shade.com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:745)
	at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:3635)
	at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2734)
	at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:902)
	at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:794)
	at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4703)
	at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3090)
	at org.apache.seatunnel.common.utils.JsonUtils.parseObject(JsonUtils.java:261)
	... 79 more

After this PR, it will display like:

java.lang.UnsupportedOperationException: the type[uuid] is not support

	at org.apache.seatunnel.api.table.catalog.SeaTunnelDataTypeConvertorUtil.parseComplexDataType(SeaTunnelDataTypeConvertorUtil.java:101)
	at org.apache.seatunnel.api.table.catalog.SeaTunnelDataTypeConvertorUtil.deserializeSeaTunnelDataType(SeaTunnelDataTypeConvertorUtil.java:49)

Does this PR introduce any user-facing change?

no

How was this patch tested?

add new test

Check list

@Hisoka-X
Copy link
Member Author

Hisoka-X commented Nov 6, 2023

cc @ruanwenjun

* @param columnConfig columns config
* @return columns
*/
private Column parseFromColumn(ReadonlyConfig columnConfig) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Also remove useless code.

ruanwenjun
ruanwenjun previously approved these changes Nov 6, 2023
Copy link
Member

@ruanwenjun ruanwenjun left a comment

Choose a reason for hiding this comment

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

LGTM

@hailin0 hailin0 merged commit 7b78952 into apache:dev Nov 7, 2023
5 checks passed
@Hisoka-X Hisoka-X deleted the fix-schema-parse branch November 7, 2023 02:52
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.

None yet

4 participants