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

[SPARK-50696][PYTHON] Optimize Py4J call for DDL parse method #49320

Closed
wants to merge 1 commit into from

Conversation

zhengruifeng
Copy link
Contributor

What changes were proposed in this pull request?

Optimize the DDL parse method in Python

Why are the changes needed?

to reduce the Py4J calls

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existing tests

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

No

@zhengruifeng zhengruifeng changed the title [WIP][PYTHON] Optimize Py4J call for DDL parse method [SPARK-50696][PYTHON] Optimize Py4J call for DDL parse method Dec 30, 2024
@zhengruifeng
Copy link
Contributor Author

thanks, merged to master

@zhengruifeng zhengruifeng deleted the py_opt_ddl branch December 30, 2024 01:47
} catch {
case _: Throwable =>
try {
// For backwards compatibility, "fieldname: datatype, fieldname: datatype" case.
Copy link
Contributor

@tedyu tedyu Dec 30, 2024

Choose a reason for hiding this comment

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

should we check for fieldname: datatype at the beginning so that the number of exceptions is reduced ?
Using exception is more expensive than checking.

    val dataType = try {
      if (ddl indexof "struct<" >= 0) return parseDataType(ddl)
      if (ddl indexof ":" < 0 && ddl indexof ' ' < 0) return parseDataType(ddl)

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.

4 participants