Skip to content

[SPARK-47700][SQL] Fix formatting of error messages with treeNode#45825

Closed
jchen5 wants to merge 2 commits into
apache:masterfrom
jchen5:treenode-error-format
Closed

[SPARK-47700][SQL] Fix formatting of error messages with treeNode#45825
jchen5 wants to merge 2 commits into
apache:masterfrom
jchen5:treenode-error-format

Conversation

@jchen5
Copy link
Copy Markdown
Contributor

@jchen5 jchen5 commented Apr 2, 2024

What changes were proposed in this pull request?

Fix formatting of error messages.

Example: In several error messages, we are concatenating the plan without any separation: in this locationFilter (dept_id#652. We should add a colon and space or newline in between.

Before:

org.apache.spark.sql.catalyst.ExtendedAnalysisException: [UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY.ACCESSING_OUTER_QUERY_COLUMN_IS_NOT_ALLOWED] Unsupported subquery expression: Accessing outer query column is not allowed in this locationFilter (dept_id#22 = outer(dept_id#16))
+- SubqueryAlias dept
   +- View (`DEPT`, [dept_id#22, dept_name#23, state#24])
      +- Project [cast(dept_id#25 as int) AS dept_id#22, cast(dept_name#26 as string) AS dept_name#23, cast(state#27 as string) AS state#24]
         +- Project [dept_id#25, dept_name#26, state#27]
            +- SubqueryAlias DEPT
               +- LocalRelation [dept_id#25, dept_name#26, state#27]
. SQLSTATE: 0A000; line 3 pos 19;

After:

org.apache.spark.sql.catalyst.ExtendedAnalysisException: [UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY.ACCESSING_OUTER_QUERY_COLUMN_IS_NOT_ALLOWED] Unsupported subquery expression: Accessing outer query column is not allowed in this location:
Filter (dept_id#71 = outer(dept_id#65))
+- SubqueryAlias dept
   +- View (`DEPT`, [dept_id#71, dept_name#72, state#73])
      +- Project [cast(dept_id#74 as int) AS dept_id#71, cast(dept_name#75 as string) AS dept_name#72, cast(state#76 as string) AS state#73]
         +- Project [dept_id#74, dept_name#75, state#76]
            +- SubqueryAlias DEPT
               +- LocalRelation [dept_id#74, dept_name#75, state#76]
. SQLSTATE: 0A000; line 3 pos 19;

Why are the changes needed?

Improve error messages readability.

Does this PR introduce any user-facing change?

Improve error messages readability.

How was this patch tested?

Unit tests

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

No

Copy link
Copy Markdown
Member

@HyukjinKwon HyukjinKwon left a comment

Choose a reason for hiding this comment

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

LGTM pending CI

@jchen5
Copy link
Copy Markdown
Contributor Author

jchen5 commented Apr 3, 2024

Updated, CI is passing now

@HyukjinKwon
Copy link
Copy Markdown
Member

Merged to master.

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