Skip to content

Conversation

@imback82
Copy link
Contributor

@imback82 imback82 commented Jan 4, 2020

What changes were proposed in this pull request?

#26847 introduced new framework for resolving catalog/namespaces. This PR proposes to integrate commands that need to resolve namespaces into the new framework.

Why are the changes needed?

This is one of the work items for moving into the new resolution framework. Resolving v1/v2 tables with the new framework will be followed up in different PRs.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existing tests should cover the changes.

@SparkQA
Copy link

SparkQA commented Jan 4, 2020

Test build #116109 has finished for PR 27095 at commit 33e938b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • case class ShowNamespacesStatement(

case s @ ShowTablesStatement(UnresolvedNamespace(Seq()), _) =>
s.copy(namespace =
ResolvedNamespace(currentCatalog.asNamespaceCatalog, catalogManager.currentNamespace))
case UnresolvedNamespace(Seq()) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

We can move this logic to CatalogAndNamespace, but I'm fine with what it is now.

*/
case class CreateNamespaceStatement(
namespace: Seq[String],
namespace: LogicalPlan,
Copy link
Contributor

@cloud-fan cloud-fan Jan 7, 2020

Choose a reason for hiding this comment

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

I'm not very sure about this. For CREATE commands, they only need to know the catalog, but no need to lookup table or namespace. I think we can keep using Seq[String], still handle the commands in ResolveCatalogs/ResolveSessionCatalogs and resolve the Seq[String] directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea you are right, and in this case, it will be consistent for tables as well.

@cloud-fan
Copy link
Contributor

LGTM except one comment

@SparkQA
Copy link

SparkQA commented Jan 7, 2020

Test build #116206 has finished for PR 27095 at commit 080aff6.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • case class ShowTablesStatement(

@SparkQA
Copy link

SparkQA commented Jan 7, 2020

Test build #116218 has finished for PR 27095 at commit b31f07b.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@imback82
Copy link
Contributor Author

imback82 commented Jan 7, 2020

Retest this please

@SparkQA
Copy link

SparkQA commented Jan 7, 2020

Test build #116233 has finished for PR 27095 at commit b31f07b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan cloud-fan closed this in 314e70f Jan 7, 2020
@cloud-fan
Copy link
Contributor

thanks, merging to master!

@imback82 imback82 deleted the unresolved_ns branch January 8, 2020 01:36
cloud-fan pushed a commit that referenced this pull request Jan 8, 2020
…pace commands

### What changes were proposed in this pull request?

This is a follow-up to address the following comment: #27095 (comment)

Currently, a SQL command string is parsed to a "statement" logical plan, converted to a logical plan with catalog/namespace, then finally converted to a physical plan. With the new resolution framework, there is no need to create a "statement" logical plan; a logical plan can contain `UnresolvedNamespace` which will be resolved to a `ResolvedNamespace`. This should simply the code base and make it a bit easier to add a new command.

### Why are the changes needed?

Clean up codebase.

### Does this PR introduce any user-facing change?

No

### How was this patch tested?

Existing tests should cover the changes.

Closes #27125 from imback82/SPARK-30214-followup.

Authored-by: Terry Kim <yuminkim@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
@imback82 imback82 changed the title [SPARK-30214][SQL] V2 commands resolves namespaces with new resolution framework [SPARK-30420][SQL] V2 commands resolves namespaces with new resolution framework Jan 16, 2020
rdblue pushed a commit to Netflix/spark that referenced this pull request Jan 21, 2020
…pace commands

This is a follow-up to address the following comment: apache/spark#27095 (comment)

Currently, a SQL command string is parsed to a "statement" logical plan, converted to a logical plan with catalog/namespace, then finally converted to a physical plan. With the new resolution framework, there is no need to create a "statement" logical plan; a logical plan can contain `UnresolvedNamespace` which will be resolved to a `ResolvedNamespace`. This should simply the code base and make it a bit easier to add a new command.

Clean up codebase.

No

Existing tests should cover the changes.

Closes #27125 from imback82/SPARK-30214-followup.

Authored-by: Terry Kim <yuminkim@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
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.

4 participants