Skip to content

Commit

Permalink
comment and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
askwang committed Oct 14, 2024
1 parent aeb0f6a commit f8e7af4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions docs/content/spark/sql-ddl.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,9 @@ CREATE TABLE my_table_all (
);
CREATE TABLE my_table_all_as PARTITIONED BY (dt) TBLPROPERTIES ('primary-key' = 'dt,hh') AS SELECT * FROM my_table_all;
```

## Show Tags
The SHOW TAGS statement is used to list all tags of a table.
```
SHOW TAGS my_table;
```
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import org.apache.spark.sql.{SparkSession, Strategy}
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions.{Expression, GenericInternalRow, PredicateHelper}
import org.apache.spark.sql.catalyst.plans.logical.{CreateTableAsSelect, LogicalPlan}
import org.apache.spark.sql.connector.catalog.{CatalogManager, Identifier, PaimonLookupCatalog, TableCatalog}
import org.apache.spark.sql.connector.catalog.{Identifier, PaimonLookupCatalog, TableCatalog}
import org.apache.spark.sql.execution.SparkPlan
import org.apache.spark.sql.execution.shim.PaimonCreateTableAsSelectStrategy

Expand All @@ -46,6 +46,7 @@ case class PaimonStrategy(spark: SparkSession)
case c @ PaimonCallCommand(procedure, args) =>
val input = buildInternalRow(args)
PaimonCallExec(c.output, procedure, input) :: Nil

case t @ ShowTagsCommand(PaimonCatalogAndIdentifier(catalog, ident)) =>
ShowTagsExec(catalog, ident, t.output) :: Nil
case _ => Nil
Expand All @@ -61,11 +62,11 @@ case class PaimonStrategy(spark: SparkSession)

private object PaimonCatalogAndIdentifier {
def unapply(identifier: Seq[String]): Option[(TableCatalog, Identifier)] = {
val catalogAndIdentifer =
val catalogAndIdentifier =
SparkUtils.catalogAndIdentifier(spark, identifier.asJava, catalogManager.currentCatalog)
catalogAndIdentifer.catalog match {
catalogAndIdentifier.catalog match {
case paimonCatalog: SparkCatalog =>
Some((paimonCatalog, catalogAndIdentifer.identifier()))
Some((paimonCatalog, catalogAndIdentifier.identifier()))
case _ =>
None
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ case class ShowTagsExec(catalog: TableCatalog, ident: Identifier, out: Seq[Attri
val tagNames = paimonTable.tagManager().allTagNames()
tags = tagNames.asScala.toList.sorted.map(t => InternalRow(UTF8String.fromString(t)))
case t =>
throw new UnsupportedOperationException(s"Can not show tags for non-paimon table: $t")
throw new UnsupportedOperationException(
s"Can not show tags for non-paimon FileStoreTable: $t")
}
tags
}
Expand Down

0 comments on commit f8e7af4

Please sign in to comment.