cloud-fan commented on a change in pull request #31245:
URL: https://github.com/apache/spark/pull/31245#discussion_r563843765
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowTablesExec.scala
##########
@@ -40,7 +40,7 @@ case class ShowTablesExec(
val tables = catalog.listTables(namespace.toArray)
tables.map { table =>
if (pattern.map(StringUtils.filterPattern(Seq(table.name()),
_).nonEmpty).getOrElse(true)) {
- rows += toCatalystRow(table.namespace().quoted, table.name())
+ rows += toCatalystRow(table.namespace().quoted, table.name(), false)
Review comment:
This is v2 command, which can't use the built-in session catalog.
It does raise a question about whether SHOW TABLES should include temp views
or not. We can investigate other databases. This can be done later.
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowTablesExec.scala
##########
@@ -40,7 +40,7 @@ case class ShowTablesExec(
val tables = catalog.listTables(namespace.toArray)
tables.map { table =>
if (pattern.map(StringUtils.filterPattern(Seq(table.name()),
_).nonEmpty).getOrElse(true)) {
- rows += toCatalystRow(table.namespace().quoted, table.name())
+ rows += toCatalystRow(table.namespace().quoted, table.name(), false)
Review comment:
This is v2 command, which can't use the built-in session catalog.
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
##########
@@ -835,22 +835,23 @@ case class DescribeColumnCommand(
case class ShowTablesCommand(
databaseName: Option[String],
tableIdentifierPattern: Option[String],
+ attributes: Seq[Attribute] = Seq.empty,
isExtended: Boolean = false,
partitionSpec: Option[TablePartitionSpec] = None) extends RunnableCommand {
- // The result of SHOW TABLES/SHOW TABLE has three basic columns: database,
tableName and
- // isTemporary. If `isExtended` is true, append column `information` to the
output columns.
- override val output: Seq[Attribute] = {
- val tableExtendedInfo = if (isExtended) {
- AttributeReference("information", StringType, nullable = false)() :: Nil
- } else {
- Nil
- }
- AttributeReference("database", StringType, nullable = false)() ::
+ override val output: Seq[Attribute] = if (attributes.isEmpty) {
+ // The output should be delivered by logical nodes(ShowTables and
ShowTableExtended) in normal.
+ // Since the output is not specified when constructing ShowTablesCommand
in SQLContext.tables,
Review comment:
if `SQLContext.tables` is the only exception, can we put this special
logic there?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]