You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "YannByron (via GitHub)" <gi...@apache.org> on 2024/11/27 10:12:32 UTC
[PR] [spark] show table extended [paimon]
YannByron opened a new pull request, #4603:
URL: https://github.com/apache/paimon/pull/4603
<!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
### Purpose
to support `SHOW TABLE EXTENDED ((FROM | IN) ns=identifierReference)? LIKE pattern=stringLit partitionSpec?` syntax.
<!-- Linking this pull request to the issue -->
Linked issue: close #xxx
<!-- What is the purpose of the change -->
### Tests
<!-- List UT and IT cases to verify this change -->
### API and Format
<!-- Does this change affect API or storage format -->
### Documentation
<!-- Does this change introduce a new feature -->
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] show table extended [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #4603:
URL: https://github.com/apache/paimon/pull/4603#issuecomment-2505179787
Thanks @YannByron , Can you also modify documentation?
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] show table extended [paimon]
Posted by "YannByron (via GitHub)" <gi...@apache.org>.
YannByron commented on PR #4603:
URL: https://github.com/apache/paimon/pull/4603#issuecomment-2506954137
> Nice Job,seems SparkSQL had not supported with the v2 syntax yet.
Spark supports it for v2 table in 4.x. So I just need do this for spark 3.x.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] show table extended [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #4603:
URL: https://github.com/apache/paimon/pull/4603#discussion_r1861617133
##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/spark/sql/connector/catalog/PaimonCatalogImplicits.scala:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.connector.catalog
+
+object PaimonCatalogImplicits {
+
+ import CatalogV2Implicits._
+
+ implicit class PaimonCatalogHelper(plugin: CatalogPlugin) extends CatalogHelper(plugin)
+
+ implicit class PaimonNamespaceHelper(namespace: Array[String]) extends NamespaceHelper(namespace)
+
+// implicit class PaimonTableHelper(table: Table) extends TableHelper(table)
Review Comment:
This line can be deleted.
##########
paimon-spark/paimon-spark3-common/src/main/scala/org/apache/paimon/spark/commands/PaimonShowTablesExtendedCommand.scala:
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.paimon.spark.commands
+
+import org.apache.paimon.spark.leafnode.PaimonLeafRunnableCommand
+
+import org.apache.spark.sql.{Row, SparkSession}
+import org.apache.spark.sql.catalyst.catalog.CatalogTableType
+import org.apache.spark.sql.catalyst.catalog.CatalogTypes.TablePartitionSpec
+import org.apache.spark.sql.catalyst.expressions.Attribute
+import org.apache.spark.sql.catalyst.util.{QuotingUtils, StringUtils}
+import org.apache.spark.sql.connector.catalog.{Identifier, PaimonCatalogUtils, SupportsPartitionManagement, Table, TableCatalog}
+import org.apache.spark.sql.connector.catalog.PaimonCatalogImplicits._
+import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Implicits._
+
+import scala.collection.JavaConverters._
+import scala.collection.mutable
+
+case class PaimonShowTablesExtendedCommand(
+ catalog: TableCatalog,
+ namespace: Seq[String],
+ pattern: String,
+ override val output: Seq[Attribute],
+ isExtended: Boolean = false,
+ partitionSpec: Option[TablePartitionSpec] = None)
+ extends PaimonLeafRunnableCommand {
+
+ override def run(spark: SparkSession): Seq[Row] = {
+ val rows = new mutable.ArrayBuffer[Row]()
+
+ val tables = catalog.listTables(namespace.toArray)
+ tables.map {
+ tableIdent: Identifier =>
+ if (StringUtils.filterPattern(Seq(tableIdent.name()), pattern).nonEmpty) {
+ val table = catalog.loadTable(tableIdent)
+ val information = getTableDetails(catalog.name, tableIdent, table)
+ rows += Row(tableIdent.namespace().quoted, tableIdent.name(), false, s"$information\n")
+ }
+ }
+
+ // TODO: view
+
+ rows.toSeq
+ }
+
+ private def getTableDetails(catalogName: String, identifier: Identifier, table: Table): String = {
+ val results = new mutable.LinkedHashMap[String, String]()
+
+ results.put("Catalog", catalogName)
Review Comment:
"Catalog", "Namespace","Table" change to constant ?
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] show table extended [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on PR #4603:
URL: https://github.com/apache/paimon/pull/4603#issuecomment-2505409548
Nice Job,seems SparkSQL had not supported with the v2 syntax yet.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] show table extended [paimon]
Posted by "YannByron (via GitHub)" <gi...@apache.org>.
YannByron commented on PR #4603:
URL: https://github.com/apache/paimon/pull/4603#issuecomment-2507027799
> Thanks @YannByron , Can you also modify documentation?
added.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] show table extended [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on PR #4603:
URL: https://github.com/apache/paimon/pull/4603#issuecomment-2506239379
+1, left some minor comments.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] show table extended [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 merged PR #4603:
URL: https://github.com/apache/paimon/pull/4603
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org