Skip to content

HIVE-27405 - Throw out the detail error Invalid partition name to the… - #5087

Merged
zhangbutao merged 4 commits into
apache:masterfrom
tarak271:tarak-HIVE-27405
Feb 23, 2024
Merged

HIVE-27405 - Throw out the detail error Invalid partition name to the…#5087
zhangbutao merged 4 commits into
apache:masterfrom
tarak271:tarak-HIVE-27405

Conversation

@tarak271

Copy link
Copy Markdown
Contributor

… clients

What changes were proposed in this pull request?

Why are the changes needed?

When try to MSCK TABLE, if there is a directory that doesn't match the partition format, the query fails. However, it doesn't thrown out the detail error information to the client. Rethrowing exception coming from msck.repair call

Does this PR introduce any user-facing change?

Yes, change in error message thrown when there is an issue with msck repair command execution

Is the change a dependency upgrade?

No

How was this patch tested?

Junit test case added

PREHOOK: type: MSCK
PREHOOK: Output: default@table_external
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.ddl.DDLTask
FAILED: Execution Error, return code 40000 from org.apache.hadoop.hive.ql.ddl.DDLTask. Repair: Cannot add partition table_external:day=Foo due to invalid characters in the name

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new message is really helpful 👍

PREHOOK: type: MSCK
PREHOOK: Output: default@repairtable
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.ddl.DDLTask
#### A masked pattern was here ####

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's the real execption here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

real exception is FAILED: Execution Error, return code 40000 from org.apache.hadoop.hive.ql.ddl.DDLTask. org.apache.hadoop.hive.metastore.api.MetastoreException: MSCK is missing partition columns under file:/Users/tarak/IdeaProjects/tarak-Apache-Hive/itests/qtest/target/localfs/warehouse/repairtable/p1=c
since it contained file location details, it is getting masked in test case output as per Masking rules

LOG.error("Unable to create msck instance.", e);
return 1;
throw e;
} catch (SemanticException e) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will client get the detail error information in case of SemanticException?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. Added test case msck_repair_8.q to see how semantic exception is handled

PREHOOK: type: MSCK
PREHOOK: Output: default@repairtable
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.ddl.DDLTask
#### A masked pattern was here ####

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Real exception is
FAILED: Execution Error, return code 40000 from org.apache.hadoop.hive.ql.ddl.DDLTask. org.apache.hadoop.hive.metastore.api.MetastoreException: MSCK finds a file rather than a directory when it searches for file:/Users/tarak/IdeaProjects/tarak-Apache-Hive/itests/qtest/target/localfs/warehouse/repairtable/p1=c/datafile

which is getting masked as it contained location of file

PREHOOK: type: MSCK
PREHOOK: Output: default@repairtable
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.ddl.DDLTask
#### A masked pattern was here ####

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Real exception

FAILED: Execution Error, return code 40000 from org.apache.hadoop.hive.ql.ddl.DDLTask. org.apache.hadoop.hive.metastore.api.MetastoreException: MSCK finds a file rather than a directory when it searches for file:/Users/tarak/IdeaProjects/tarak-Apache-Hive/itests/qtest/target/localfs/warehouse/repairtable/p1=c/datafile

PREHOOK: type: MSCK
PREHOOK: Output: default@repairtable
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.ddl.DDLTask
#### A masked pattern was here ####

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Real exception is
FAILED: Execution Error, return code 40000 from org.apache.hadoop.hive.ql.ddl.DDLTask. org.apache.hadoop.hive.metastore.api.MetastoreException: Unexpected partition key p2 found at file:/Users/tarak/IdeaProjects/tarak-Apache-Hive/itests/qtest/target/localfs/warehouse/repairtable/p2=c

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
3 New issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@zhangbutao zhangbutao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM +1

@zhangbutao
zhangbutao merged commit a348e5d into apache:master Feb 23, 2024
dengzhhu653 pushed a commit to dengzhhu653/hive that referenced this pull request Mar 7, 2024
…clients (apache#5087)(Taraka Rama Rao Lethavadla, reviewed by okumin, Butao Zhang)
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