Skip to content

Conversation

@zhengruifeng
Copy link
Contributor

What changes were proposed in this pull request?

Refactor data type json parse

Why are the changes needed?

the _all_atomic_types causes confusions:

  • it is only used in json parse, so it should use the jsonValue instead of typeName (and so it causes the typeName not consistent with Scala, will fix in separate PR);
  • not all atomic types are included in it (e.g. YearMonthIntervalType);
  • not all atomic types should be placed in it (e.g. VarcharType which has to be excluded here and there)

Does this PR introduce any user-facing change?

no

How was this patch tested?

ci, added tests

Was this patch authored or co-authored using generative AI tooling?

no

init
@HyukjinKwon
Copy link
Member

Is this just refactoring or causing any behaviour change?

# 2, DecimalType can be parsed by both mapping ('decimal') and regex ('decimal(10, 2)');
# 3, CalendarIntervalType is not an atomic type, but can be mapped by 'interval';
_all_mappable_types: Dict[str, Type[DataType]] = {
"string": StringType,
Copy link
Member

Choose a reason for hiding this comment

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

Hm, why don't we call typeName()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is another issue: existing typeName are not consistent with the Scala side.
I want to fix it in a separate PR.

@zhengruifeng
Copy link
Contributor Author

Is this just refactoring or causing any behaviour change?

this is just refactoring

@zhengruifeng
Copy link
Contributor Author

merged to master

@zhengruifeng zhengruifeng deleted the refactor_json_parse branch May 24, 2024 09:37
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.

2 participants