Skip to content

Conversation

@dchvn
Copy link
Contributor

@dchvn dchvn commented Dec 24, 2021

What changes were proposed in this pull request?

According to #cmt, unify the error of v1, v2 and hive external catalog in DROP NAMESPACE tests.

Why are the changes needed?

Currently, v1 and hive external catalog command throw AnalysisException, while v2 command throws SparkException. The error messages of v1 and hive catalog are also completely different from v2.
So this PR is for unifying those errors to AnalysisException. The error message will have one difference between v1/hive and v2: Cannot drop a non-empty database: ... vs Cannot drop a non-empty namespace: ...

Does this PR introduce any user-facing change?

No

How was this patch tested?

v1/v2 and Hive v1 DropNamespaceSuite:

$ build/sbt -Phive-2.3 -Phive-thriftserver "test:testOnly *DropNamespaceSuite"

@github-actions github-actions bot added the SQL label Dec 24, 2021
@dchvn
Copy link
Contributor Author

dchvn commented Dec 24, 2021

cc @cloud-fan @huaxingao. FYI !

Comment on lines 543 to 546
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change the error message of v1 command.

Comment on lines 547 to 550
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move cannotDropNonemptyNamespaceError from QueryExecutionErrors to QueryCompilationErrors as SPARK-33539

Copy link
Contributor

Choose a reason for hiding this comment

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

Does CASCADE work for the v1 command? If yes, we should also mention it in the v1 error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it works. I'll mention it in v1 error message. Thank you, @cloud-fan!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alias for namespace: database for v1 and namespace for v2

Comment on lines 199 to 207
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Try-catch the error from hive catalog and re-throw it with a different error message that matches v1, v2

@SparkQA
Copy link

SparkQA commented Dec 24, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/51023/

@SparkQA
Copy link

SparkQA commented Dec 24, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/51023/

@SparkQA
Copy link

SparkQA commented Dec 24, 2021

Test build #146548 has finished for PR 35007 at commit e1793be.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Dec 24, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/51031/

@SparkQA
Copy link

SparkQA commented Dec 24, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/51031/

@SparkQA
Copy link

SparkQA commented Dec 24, 2021

Test build #146556 has finished for PR 35007 at commit a881d22.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dchvn
Copy link
Contributor Author

dchvn commented Dec 24, 2021

Please take a look if you have time @cloud-fan, @huaxingao . Many thanks!

Copy link
Contributor

@cloud-fan cloud-fan Dec 27, 2021

Choose a reason for hiding this comment

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

Seems we can remove the details parameter now.

Copy link
Contributor Author

@dchvn dchvn Dec 28, 2021

Choose a reason for hiding this comment

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

Sorry, I missed the call cannotDropNonemptyDatabaseError(db, "tables") and cannotDropNonemptyDatabaseError(db, "functions") in InMemoryCatalog file. So I think keep original error message and also mention use CASCADE.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I think One or more $details exist is a repeat of non-empty database, and it's OK to remove it, to keep consistent with v2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Thank you @cloud-fan!

@dchvn dchvn force-pushed the unify_dropnamespace_error branch from 2fa0bc8 to 941207d Compare December 28, 2021 10:04
case NonFatal(exception) =>
if (exception.getClass.getName.equals("org.apache.hadoop.hive.ql.metadata.HiveException")
&& exception.getMessage.contains(s"Database $db is not empty.")) {
throw new AnalysisException(s"Cannot drop a non-empty database: $db.")
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we use cannotDropNonemptyDatabaseError?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Thank you @cloud-fan!

@cloud-fan
Copy link
Contributor

thanks, merging to master!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants