-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-30497][SQL] migrate DESCRIBE TABLE to the new framework #27187
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/namespace.scala
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/table.scala
This file was deleted.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/v2ResolutionPlans.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.spark.sql.catalyst.analysis | ||
|
||
import org.apache.spark.sql.catalyst.expressions.Attribute | ||
import org.apache.spark.sql.catalyst.plans.logical.{LeafNode, LogicalPlan} | ||
import org.apache.spark.sql.connector.catalog.{Identifier, SupportsNamespaces, Table, TableCatalog} | ||
|
||
/** | ||
* Holds the name of a namespace that has yet to be looked up in a catalog. It will be resolved to | ||
* [[ResolvedNamespace]] during analysis. | ||
*/ | ||
case class UnresolvedNamespace(multipartIdentifier: Seq[String]) extends LeafNode { | ||
override lazy val resolved: Boolean = false | ||
|
||
override def output: Seq[Attribute] = Nil | ||
} | ||
|
||
/** | ||
* Holds the name of a table that has yet to be looked up in a catalog. It will be resolved to | ||
* [[ResolvedTable]] during analysis. | ||
*/ | ||
case class UnresolvedTable(multipartIdentifier: Seq[String]) extends LeafNode { | ||
override lazy val resolved: Boolean = false | ||
|
||
override def output: Seq[Attribute] = Nil | ||
} | ||
|
||
/** | ||
* Holds the name of a table or view that has yet to be looked up in a catalog. It will | ||
* be resolved to [[ResolvedTable]] or [[ResolvedView]] during analysis. | ||
*/ | ||
case class UnresolvedTableOrView(multipartIdentifier: Seq[String]) extends LeafNode { | ||
override lazy val resolved: Boolean = false | ||
override def output: Seq[Attribute] = Nil | ||
} | ||
|
||
/** | ||
* A plan containing resolved namespace. | ||
*/ | ||
case class ResolvedNamespace(catalog: SupportsNamespaces, namespace: Seq[String]) | ||
extends LeafNode { | ||
override def output: Seq[Attribute] = Nil | ||
} | ||
|
||
/** | ||
* A plan containing resolved table. | ||
*/ | ||
case class ResolvedTable(catalog: TableCatalog, identifier: Identifier, table: Table) | ||
extends LeafNode { | ||
override def output: Seq[Attribute] = Nil | ||
} | ||
|
||
/** | ||
* A plan containing resolved (temp) views. | ||
*/ | ||
// TODO: create a generic representation for temp view, v1 view and v2 view, after we add view | ||
// support to v2 catalog. For now we only need the identifier to fallback to v1 command. | ||
case class ResolvedView(identifier: Identifier) extends LeafNode { | ||
override def output: Seq[Attribute] = Nil | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
package org.apache.spark.sql.catalyst.plans.logical | ||
|
||
import org.apache.spark.sql.catalyst.analysis.{NamedRelation, UnresolvedException} | ||
import org.apache.spark.sql.catalyst.catalog.CatalogTypes.TablePartitionSpec | ||
import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference, Expression, Unevaluable} | ||
import org.apache.spark.sql.catalyst.plans.DescribeTableSchema | ||
import org.apache.spark.sql.connector.catalog._ | ||
|
@@ -314,12 +315,13 @@ case class ShowNamespaces( | |
} | ||
|
||
/** | ||
* The logical plan of the DESCRIBE TABLE command that works for v2 tables. | ||
* The logical plan of the DESCRIBE relation_name command that works for v2 tables. | ||
*/ | ||
case class DescribeTable(table: NamedRelation, isExtended: Boolean) extends Command { | ||
|
||
override lazy val resolved: Boolean = table.resolved | ||
|
||
case class DescribeRelation( | ||
relation: LogicalPlan, | ||
partitionSpec: TablePartitionSpec, | ||
isExtended: Boolean) extends Command { | ||
override def children: Seq[LogicalPlan] = Seq(relation) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this |
||
override def output: Seq[Attribute] = DescribeTableSchema.describeTableAttributes() | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add
UnresolvedView
when we migrate ALTER VIEW command. @imback82There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Thanks!