[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-13 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r668624893



##
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCatalogsExec.scala
##
@@ -0,0 +1,47 @@
+/*
+ * 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.execution.datasources.v2
+
+import scala.collection.mutable.ArrayBuffer
+
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.Attribute
+import org.apache.spark.sql.catalyst.util.{escapeSingleQuotedString, 
StringUtils}
+import org.apache.spark.sql.connector.catalog.CatalogManager
+
+/**
+ * Physical plan node for showing all catalogs.
+ */
+case class ShowCatalogsExec(
+output: Seq[Attribute],
+catalogManager: CatalogManager,
+pattern: Option[String])
+  extends LeafV2CommandExec {
+  override protected def run(): Seq[InternalRow] = {
+val rows = new ArrayBuffer[InternalRow]()
+val catalogs = 
catalogManager.listCatalogs.map(_._1).map(escapeSingleQuotedString(_))

Review comment:
   > do we have tests to trigger `escapeSingleQuotedString`?
   
   No, I remove and update




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-12 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r667599786



##
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCatalogsExec.scala
##
@@ -0,0 +1,47 @@
+/*
+ * 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.execution.datasources.v2
+
+import scala.collection.mutable.ArrayBuffer
+
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.Attribute
+import org.apache.spark.sql.catalyst.util.{escapeSingleQuotedString, 
StringUtils}
+import org.apache.spark.sql.connector.catalog.CatalogManager
+
+/**
+ * Physical plan node for showing all catalogs.
+ */
+case class ShowCatalogsExec(
+output: Seq[Attribute],
+catalogManager: CatalogManager,
+pattern: Option[String])
+  extends LeafV2CommandExec {
+  override protected def run(): Seq[InternalRow] = {
+val rows = new ArrayBuffer[InternalRow]()
+val catalogs = 
catalogManager.listCatalogs.map(_._1).map(escapeSingleQuotedString(_))

Review comment:
   @cloud-fan I write a test case to test the catalog that name contain 
special char `'`. The `'` can be passed by spark conf.
   ```scala
   spark.sessionState.catalogManager.reset()
   spark.conf.set("spark.sql.catalog.'spark-35973", 
classOf[InMemoryCatalog].getName)
   sql("use `'spark-35973`")
   sql("SHOW CATALOGS").show()
   assert(sql("SHOW CATALOGS").collect() === Array(
 Row("spark_catalog"), Row("\\'spark-35973")))
   ```




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-11 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r667656166



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,16 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(
+catalogManager: CatalogManager,
+pattern: Option[String]) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(

Review comment:
   ok




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-11 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r667599786



##
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCatalogsExec.scala
##
@@ -0,0 +1,47 @@
+/*
+ * 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.execution.datasources.v2
+
+import scala.collection.mutable.ArrayBuffer
+
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.Attribute
+import org.apache.spark.sql.catalyst.util.{escapeSingleQuotedString, 
StringUtils}
+import org.apache.spark.sql.connector.catalog.CatalogManager
+
+/**
+ * Physical plan node for showing all catalogs.
+ */
+case class ShowCatalogsExec(
+output: Seq[Attribute],
+catalogManager: CatalogManager,
+pattern: Option[String])
+  extends LeafV2CommandExec {
+  override protected def run(): Seq[InternalRow] = {
+val rows = new ArrayBuffer[InternalRow]()
+val catalogs = 
catalogManager.listCatalogs.map(_._1).map(escapeSingleQuotedString(_))

Review comment:
   @cloud-fan I write a test case to test the catalog that name contain 
special char `'`. The `'` can be passed by spark conf.
   ```scala
   spark.sessionState.catalogManager.reset()
   spark.conf.set("spark.sql.catalog.'spark-35973", 
classOf[InMemoryCatalog].getName)
   sql("use `'spark-35973`")
   sql("SHOW CATALOGS").show()
   assert(sql("SHOW CATALOGS").collect() === Array(
 Row("spark_catalog"), Row("\\'spark-35973")))
   ```




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-11 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r667601070



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,15 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(catalogManager: CatalogManager) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(
+AttributeReference("catalog", StringType, nullable = false)(),
+AttributeReference("default-namespace", StringType, nullable = false)())

Review comment:
   A mistake:  Output of `SHOW TABLES` contains three columns 
`namespace`,`tableName`,`isTemporary`.  It is different from the rds that just 
show `name`.




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-11 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r667599786



##
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCatalogsExec.scala
##
@@ -0,0 +1,47 @@
+/*
+ * 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.execution.datasources.v2
+
+import scala.collection.mutable.ArrayBuffer
+
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.Attribute
+import org.apache.spark.sql.catalyst.util.{escapeSingleQuotedString, 
StringUtils}
+import org.apache.spark.sql.connector.catalog.CatalogManager
+
+/**
+ * Physical plan node for showing all catalogs.
+ */
+case class ShowCatalogsExec(
+output: Seq[Attribute],
+catalogManager: CatalogManager,
+pattern: Option[String])
+  extends LeafV2CommandExec {
+  override protected def run(): Seq[InternalRow] = {
+val rows = new ArrayBuffer[InternalRow]()
+val catalogs = 
catalogManager.listCatalogs.map(_._1).map(escapeSingleQuotedString(_))

Review comment:
   @cloud-fan I write a test case to test the catalog that name contain 
special char `'`. The `'` can be passed by spark conf.
   ```scala
   spark.sessionState.catalogManager.reset()
   spark.conf.set("spark.sql.catalog.'spark-35973", 
classOf[InMemoryCatalog].getName)
   sql("use `'spark-35973`")
   sql("SHOW CATALOGS").show()
   assert(sql("SHOW CATALOGS").collect() === Array(
 Row("spark_catalog"), Row("\\'spark-35973")))
   ```
   Am I wrong? Thank you.




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-08 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r666139334



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,14 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(catalogManager: CatalogManager) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(
+AttributeReference("catalog", StringType, nullable = false)())

Review comment:
   @pan3793 Thank you for input. But I'm pretty sure it doesn't support 
catalog in MySQL any version. The link you gave is only a work log. There is no 
implementation for it. In MySQL:
   database == schema == catalog == a namespace within the server. And all 
command entry point in server is do_command in sql_parse.cc, there is no case 
for catalog.




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-06 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r664475325



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,14 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(catalogManager: CatalogManager) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(
+AttributeReference("catalog", StringType, nullable = false)())

Review comment:
   in big data:
   1.[Presto](https://prestodb.io/docs/current/sql/show-catalogs.html),  There 
is no output information in the link, but actual output is just `name` 
   
2.[Flink](https://ci.apache.org/projects/flink/flink-docs-release-1.13/docs/dev/table/sql/show/#run-a-show-statement).
   in RDBMS
   The catalog layer is not strictly implemented in RDS
   1.In PG, Catalog(=database).Schema(namespace).Table, So `show catalogs` == 
`show databases`; Unfortunately, pg doesn't have this command. we should use 
`select statement` instead of `show` command. 
[difference-between-a-catalog-and-a-schema-in-a-relational-database](https://stackoverflow.com/questions/7022755/whats-the-difference-between-a-catalog-and-a-schema-in-a-relational-database)
   2.In MySQL, There is no catalog, just schema(database).table. So we can 
create a database use create schema/database xxx




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-06 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r664475325



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,14 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(catalogManager: CatalogManager) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(
+AttributeReference("catalog", StringType, nullable = false)())

Review comment:
   in big data:
   1.[Presto](https://prestodb.io/docs/current/sql/show-catalogs.html),  There 
is no output information in the link, but actual output is just `name` 
   
2.[Flink](https://ci.apache.org/projects/flink/flink-docs-release-1.13/docs/dev/table/sql/show/#run-a-show-statement).
   in RDBMS
   The catalog layer is not strictly implemented in RDS
   1.In PG, Catalog(=database).Schema(namespace).Table, So `show catalogs` == 
`show databases`; Unfortunately, pg doesn't have this command. we should use 
`select statement` instead of `show` command. databases; 
[difference-between-a-catalog-and-a-schema-in-a-relational-database](https://stackoverflow.com/questions/7022755/whats-the-difference-between-a-catalog-and-a-schema-in-a-relational-database)
   2.In MySQL, There is no catalog, just schema(database).table. So we can 
create a database use create schema/database xxx
   3.In Oracle,The is no catalog, if we want access metadata, we can use select 
statement.[Link](https://en.wikipedia.org/wiki/Oracle_metadata ) 

##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,14 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(catalogManager: CatalogManager) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(
+AttributeReference("catalog", StringType, nullable = false)())

Review comment:
   in big data:
   1.[Presto](https://prestodb.io/docs/current/sql/show-catalogs.html),  There 
is no output information in the link, but actual output is just `name` 
   
2.[Flink](https://ci.apache.org/projects/flink/flink-docs-release-1.13/docs/dev/table/sql/show/#run-a-show-statement).
   in RDBMS
   The catalog layer is not strictly implemented in RDS
   1.In PG, Catalog(=database).Schema(namespace).Table, So `show catalogs` == 
`show databases`; Unfortunately, pg doesn't have this command. we should use 
`select statement` instead of `show` command. 
[difference-between-a-catalog-and-a-schema-in-a-relational-database](https://stackoverflow.com/questions/7022755/whats-the-difference-between-a-catalog-and-a-schema-in-a-relational-database)
   2.In MySQL, There is no catalog, just schema(database).table. So we can 
create a database use create schema/database xxx
   3.In Oracle,The is no catalog, if we want access metadata, we can use select 
statement.[Link](https://en.wikipedia.org/wiki/Oracle_metadata ) 

##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,14 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(catalogManager: CatalogManager) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(
+AttributeReference("catalog", StringType, nullable = false)())

Review comment:
   in big data:
   1.[Presto](https://prestodb.io/docs/current/sql/show-catalogs.html),  There 
is no output information in the link, but actual output is just `name` 
   
2.[Flink](https://ci.apache.org/projects/flink/flink-docs-release-1.13/docs/dev/table/sql/show/#run-a-show-statement).
   in RDBMS
   The catalog layer is not strictly implemented in RDS
   1.In PG, Catalog(=database).Schema(namespace).Table, So `show catalogs` == 
`show databases`; Unfortunately, pg doesn't have this command. we should use 
`select statement` instead of `show` command. 
[difference-between-a-catalog-and-a-schema-in-a-relational-database](https://stackoverflow.com/questions/7022755/whats-the-difference-between-a-catalog-and-a-schema-in-a-relational-database)
   2.In MySQL, There is no catalog, just schema(database).table. So we can 
create a database use create schema/database xxx
   3.In Oracle,The is no catalog, if we want access metadata, we can use select 
statement. [Link](https://en.wikipedia.org/wiki/Oracle_metadata ) 




-- 
This is an automated message from the Apa

[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-06 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r664372808



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,14 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(catalogManager: CatalogManager) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(
+AttributeReference("catalog", StringType, nullable = false)())

Review comment:
   just show `name` in presto. 




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-06 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r664372808



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,14 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(catalogManager: CatalogManager) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(
+AttributeReference("catalog", StringType, nullable = false)())

Review comment:
   just show `name` in presto. 




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-03 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r663311232



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogManager.scala
##
@@ -128,6 +128,10 @@ class CatalogManager(
 }
   }
 
+  def listCatalogs(): mutable.HashMap[String, CatalogPlugin] = synchronized {
+catalogs

Review comment:
   Yeah, This behavior is desired for me because of that the displayed 
catalogs registered are meaningful because they can be loaded correctly. 
@imback82 @yaooqinn @cloud-fan Do you have any suggestions for this? show all 
catalogs configed or show catalogs registered? Thank you.




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-02 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r663311709



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,15 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(catalogManager: CatalogManager) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(
+AttributeReference("catalog", StringType, nullable = false)(),
+AttributeReference("default-namespace", StringType, nullable = false)())

Review comment:
   @yaooqinn Sorry. I misunderstood what you mean. `default-namespace` 
really doesn't need. I need to maintain consistent behavior with `SHOW TABLES` 
`SHOW DATABASES` that just show `name`. Thank you very much for reminding 
@yaooqinn 




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-02 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r663311709



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,15 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(catalogManager: CatalogManager) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(
+AttributeReference("catalog", StringType, nullable = false)(),
+AttributeReference("default-namespace", StringType, nullable = false)())

Review comment:
   @yaooqinn Sorry. I misunderstood what you mean. `default-namespace` 
really doesn't need. I need to maintain consistent behavior with `SHOW TABLES` 
`SHOW DATABASES` that just show `name`. Thank you very much for 
reminding@yaooqinn 




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-02 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r663311232



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogManager.scala
##
@@ -128,6 +128,10 @@ class CatalogManager(
 }
   }
 
+  def listCatalogs(): mutable.HashMap[String, CatalogPlugin] = synchronized {
+catalogs

Review comment:
   Yeah, This behavior is desired for me because of that it is easy to get 
and the displayed catalogs are meaningful because they can be loaded correctly. 
But at now I think it is unreasonable. From the user's point of view, when he 
uses this command, it should display all the catalogs that configured with conf 
even if its configuration is incorrect and it cannot be loaded correctly. Thank 
you very much @imback82 . I will rewrite this method by scanning the 
configuration of conf.




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-02 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r663311232



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogManager.scala
##
@@ -128,6 +128,10 @@ class CatalogManager(
 }
   }
 
+  def listCatalogs(): mutable.HashMap[String, CatalogPlugin] = synchronized {
+catalogs

Review comment:
   Yeah, This behavior is desired for me because of that it is easy to get 
and the displayed catalogs are meaningful because they can be loaded correctly. 
But at now I think it is unreasonable. From the user's point of view, when he 
uses this command, it should display all the catalogs that configured with conf 
even if its configuration is incorrect and it cannot be loaded correctly. Thank 
you very much @imback82 . I will rewrite this method by scanning the 
configuration of conf




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-02 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r662839253



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,15 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(catalogManager: CatalogManager) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(
+AttributeReference("catalog", StringType, nullable = false)(),
+AttributeReference("default-namespace", StringType, nullable = false)())

Review comment:
   @yaooqinn schema of output




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] Peng-Lei commented on a change in pull request #33175: [SPARK-35973][SQL] DataSourceV2: Support SHOW CATALOGS

2021-07-02 Thread GitBox


Peng-Lei commented on a change in pull request #33175:
URL: https://github.com/apache/spark/pull/33175#discussion_r662839253



##
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
##
@@ -662,6 +662,15 @@ case class ShowCurrentNamespace(catalogManager: 
CatalogManager) extends LeafComm
 AttributeReference("namespace", StringType, nullable = false)())
 }
 
+/**
+ * The logical plan of the SHOW CATALOGS command.
+ */
+case class ShowCatalogs(catalogManager: CatalogManager) extends LeafCommand {
+  override val output: Seq[Attribute] = Seq(
+AttributeReference("catalog", StringType, nullable = false)(),
+AttributeReference("default-namespace", StringType, nullable = false)())

Review comment:
   schema of output




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org