[SPARK-34239][SQL][FOLLOW_UP] SHOW COLUMNS Keep consistence with other SHOW
command
### What changes were proposed in this pull request? Keep consistence with other `SHOW` command according to https://github.com/apache/spark/pull/31341#issuecomment-774613080 ### Why are the changes needed? Keep consistence ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Not need Closes #31518 from AngersZhuuuu/SPARK-34239-followup. Authored-by: Angerszhuuuu <angers.zhu@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
This commit is contained in:
parent
2c243c93d9
commit
70a79e920a
|
@ -743,12 +743,13 @@ case class ShowCreateTable(child: LogicalPlan, asSerde: Boolean = false) extends
|
||||||
*/
|
*/
|
||||||
case class ShowColumns(
|
case class ShowColumns(
|
||||||
child: LogicalPlan,
|
child: LogicalPlan,
|
||||||
namespace: Option[Seq[String]]) extends Command {
|
namespace: Option[Seq[String]],
|
||||||
|
override val output: Seq[Attribute] = ShowColumns.OUTPUT) extends Command {
|
||||||
override def children: Seq[LogicalPlan] = child :: Nil
|
override def children: Seq[LogicalPlan] = child :: Nil
|
||||||
|
|
||||||
override val output: Seq[Attribute] = {
|
|
||||||
AttributeReference("col_name", StringType, nullable = false)() :: Nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object ShowColumns {
|
||||||
|
val OUTPUT: Seq[Attribute] = Seq(AttributeReference("col_name", StringType, nullable = false)())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -407,7 +407,7 @@ class ResolveSessionCatalog(val catalogManager: CatalogManager)
|
||||||
s.output,
|
s.output,
|
||||||
pattern.map(_.asInstanceOf[UnresolvedPartitionSpec].spec))
|
pattern.map(_.asInstanceOf[UnresolvedPartitionSpec].spec))
|
||||||
|
|
||||||
case s @ ShowColumns(ResolvedV1TableOrViewIdentifier(ident), ns) =>
|
case s @ ShowColumns(ResolvedV1TableOrViewIdentifier(ident), ns, output) =>
|
||||||
val v1TableName = ident.asTableIdentifier
|
val v1TableName = ident.asTableIdentifier
|
||||||
val resolver = conf.resolver
|
val resolver = conf.resolver
|
||||||
val db = ns match {
|
val db = ns match {
|
||||||
|
@ -415,7 +415,7 @@ class ResolveSessionCatalog(val catalogManager: CatalogManager)
|
||||||
throw QueryCompilationErrors.showColumnsWithConflictDatabasesError(db, v1TableName)
|
throw QueryCompilationErrors.showColumnsWithConflictDatabasesError(db, v1TableName)
|
||||||
case _ => ns.map(_.head)
|
case _ => ns.map(_.head)
|
||||||
}
|
}
|
||||||
ShowColumnsCommand(db, v1TableName, s.output)
|
ShowColumnsCommand(db, v1TableName, output)
|
||||||
|
|
||||||
case AlterTableRecoverPartitions(ResolvedV1TableIdentifier(ident)) =>
|
case AlterTableRecoverPartitions(ResolvedV1TableIdentifier(ident)) =>
|
||||||
AlterTableRecoverPartitionsCommand(
|
AlterTableRecoverPartitionsCommand(
|
||||||
|
|
|
@ -400,7 +400,7 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat
|
||||||
case TruncateTable(_: ResolvedTable, _) =>
|
case TruncateTable(_: ResolvedTable, _) =>
|
||||||
throw new AnalysisException("TRUNCATE TABLE is not supported for v2 tables.")
|
throw new AnalysisException("TRUNCATE TABLE is not supported for v2 tables.")
|
||||||
|
|
||||||
case ShowColumns(_: ResolvedTable, _) =>
|
case ShowColumns(_: ResolvedTable, _, _) =>
|
||||||
throw new AnalysisException("SHOW COLUMNS is not supported for v2 tables.")
|
throw new AnalysisException("SHOW COLUMNS is not supported for v2 tables.")
|
||||||
|
|
||||||
case r @ ShowPartitions(
|
case r @ ShowPartitions(
|
||||||
|
|
Loading…
Reference in a new issue