You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/07/20 18:54:06 UTC
[GitHub] [spark] amaliujia opened a new pull request, #37241: [SPARK-39828] Catalog.listTables() should respect currentCatalog
amaliujia opened a new pull request, #37241:
URL: https://github.com/apache/spark/pull/37241
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'core/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
1. `Catalog.listTables()` should respect current catalog now as we have introduced that concept in 3.4.0.
2. During the development I realized that `ShowTables` v2 command does not list views.
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
3. If you fix a bug, you can clarify why it is a bug.
-->
To make `Catalog.listTables()` should respect current catalog if that is used.
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
No. Existing users without caring about catalog name in qualified identifiers will remain the same behavior.
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
UT
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r925977940
##########
sql/core/src/test/scala/org/apache/spark/sql/internal/CatalogSuite.scala:
##########
@@ -182,6 +182,31 @@ class CatalogSuite extends SharedSparkSession with AnalysisTest with BeforeAndAf
assert(spark.catalog.listTables().collect().map(_.name).toSet == Set("my_table2"))
}
+ test("SPARK-39828: Catalog.listTables() should respect currentCatalog") {
+ assert(spark.catalog.currentCatalog() == "spark_catalog")
+ assert(spark.catalog.listTables().collect().isEmpty)
+ createTable("my_table1")
+ assert(spark.catalog.listTables().collect().map(_.name).toSet == Set("my_table1"))
+
+ val catalogName = "testcat"
+ val dbName = "my_db"
+ val tableName = "my_table2"
+ val tableSchema = new StructType().add("i", "int")
+ val description = "this is a test managed table"
+ sql(s"CREATE NAMESPACE ${catalogName}.${dbName}")
+
+ spark.catalog.setCurrentCatalog("testcat")
+ spark.catalog.setCurrentDatabase("my_db")
+ assert(spark.catalog.listTables().collect().isEmpty)
+
+ createTable(tableName, dbName, catalogName, classOf[FakeV2Provider].getName, tableSchema,
+ Map.empty[String, String], description)
+ assert(spark.catalog.listTables()
+ .collect()
+ .map(t => Array(t.catalog, t.namespace.mkString("."), t.name).mkString(".")).toSet
+ == Set("testcat.my_db.my_table2"))
Review Comment:
updated indentation.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r925961911
##########
sql/core/src/test/scala/org/apache/spark/sql/internal/CatalogSuite.scala:
##########
@@ -182,6 +182,31 @@ class CatalogSuite extends SharedSparkSession with AnalysisTest with BeforeAndAf
assert(spark.catalog.listTables().collect().map(_.name).toSet == Set("my_table2"))
}
+ test("SPARK-39828: Catalog.listTables() should respect currentCatalog") {
+ assert(spark.catalog.currentCatalog() == "spark_catalog")
+ assert(spark.catalog.listTables().collect().isEmpty)
+ createTable("my_table1")
+ assert(spark.catalog.listTables().collect().map(_.name).toSet == Set("my_table1"))
+
+ val catalogName = "testcat"
+ val dbName = "my_db"
+ val tableName = "my_table2"
+ val tableSchema = new StructType().add("i", "int")
+ val description = "this is a test managed table"
+ sql(s"CREATE NAMESPACE ${catalogName}.${dbName}")
+
+ spark.catalog.setCurrentCatalog("testcat")
+ spark.catalog.setCurrentDatabase("my_db")
+ assert(spark.catalog.listTables().collect().isEmpty)
+
+ createTable(tableName, dbName, catalogName, classOf[FakeV2Provider].getName, tableSchema,
+ Map.empty[String, String], description)
+ assert(spark.catalog.listTables()
+ .collect()
+ .map(t => Array(t.catalog, t.namespace.mkString("."), t.name).mkString(".")).toSet
+ == Set("testcat.my_db.my_table2"))
Review Comment:
ditto. Indentation.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r925974243
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
+ if (row.getString(0).isEmpty) {
+ Seq(row.getString(1))
+ } else {
+ ident ++ Seq(row.getString(1))
+ })
Review Comment:
[SPARK-39236](https://issues.apache.org/jira/browse/SPARK-39236) updated `listTables(dbName)`. This PR does not cause regression on that JIRA.
This is more like a side effect of [SPARK-39506](https://issues.apache.org/jira/browse/SPARK-39506). Because in [SPARK-39506](https://issues.apache.org/jira/browse/SPARK-39506) we support `setCurrentCatalog` and get `currentCatalog`, now for `listTables` it has a choice of which catalog to search for tables. In the past it always go to the only catalog which is `spark_catalog`, but now that catalog can be changed.
`listDatabases()` was already updated to respect the current 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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r925976129
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
+ if (row.getString(0).isEmpty) {
+ Seq(row.getString(1))
+ } else {
+ ident ++ Seq(row.getString(1))
+ })
Review Comment:
Maybe it is hard to define whether this is a regression (I would rather say it is a side effect that given we introduced a way to control current catalog). I think at least it still maintains backwards compatibility. For old users who do not need set current catalog, it will still be the one that they would target to `spark_catalog`. The existing UT has tested that.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r925976129
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
+ if (row.getString(0).isEmpty) {
+ Seq(row.getString(1))
+ } else {
+ ident ++ Seq(row.getString(1))
+ })
Review Comment:
Maybe it is hard to define whether this is a regression (I would rather it is a side effect given we introduce a way to control current catalog). I think at least it still maintains backwards compatibility. For old users who do not need set current catalog, it will still be the one that they would target to `spark_catalog`. The existing UT has tested that.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia closed pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia closed pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
URL: https://github.com/apache/spark/pull/37241
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on pull request #37241: [SPARK-39828] Catalog.listTables() should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on PR #37241:
URL: https://github.com/apache/spark/pull/37241#issuecomment-1190640278
Thank you for pinging me, @amaliujia .
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r927007065
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
Review Comment:
For example, for a temp view named `my_temp_table`, this is the internal row in-memory value: `[0,2000000000,200000000d,1,5f706d65745f796d,656c626174]`
`toCatalystRow(table.namespace().quoted, table.name(), isTempView(table))`. The isTempView is the third value, which is `200000000d`.
Also I actually don't know why there are five values in the row....
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on pull request #37241: [SPARK-39828] Catalog.listTables() should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia commented on PR #37241:
URL: https://github.com/apache/spark/pull/37241#issuecomment-1190639237
R: @cloud-fan @dongjoon-hyun
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r926132347
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
+ if (row.getString(0).isEmpty) {
+ Seq(row.getString(1))
+ } else {
+ ident ++ Seq(row.getString(1))
+ })
Review Comment:
agreed on that there should be a period of time to have new features mature enough with good adoptions before talking about deprecations.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #37241: [SPARK-39828] Catalog.listTables() should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r925957518
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2SessionCatalog.scala:
##########
@@ -53,10 +53,15 @@ class V2SessionCatalog(catalog: SessionCatalog)
override def listTables(namespace: Array[String]): Array[Identifier] = {
Review Comment:
There is no `listViews` in `TableCatalog` interface so I think it should be in `listTables`. IIUC existing v1 session catalog does this already (list views when calling `listTables`)
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r925976129
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
+ if (row.getString(0).isEmpty) {
+ Seq(row.getString(1))
+ } else {
+ ident ++ Seq(row.getString(1))
+ })
Review Comment:
Maybe it is hard to define whether this is a regression (I would rather say it is a side effect that given we introduced a way to control current catalog). I think at least it still maintains backwards compatibility. For old users who do not need set current catalog, it will still be the one that they would target to (`spark_catalog`). The existing UT has tested that.
And then for new users, their set current catalog will be respected.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r926091316
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
+ if (row.getString(0).isEmpty) {
+ Seq(row.getString(1))
+ } else {
+ ident ++ Seq(row.getString(1))
+ })
Review Comment:
Thanks for the detail. Yes, it's hard to say always during extending the existing semantics. New features are always nice to have, but what I hope is to keep the original features safe and independent as much as possible . As long as the old code works, we are good. Thank you again for all your efforts, @amaliujia .
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r925976129
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
+ if (row.getString(0).isEmpty) {
+ Seq(row.getString(1))
+ } else {
+ ident ++ Seq(row.getString(1))
+ })
Review Comment:
Maybe it is hard to define whether this is a regression (I would rather say it is a side effect that given we introduced a way to control current catalog). I think at least it still maintains backwards compatibility. For old users who do not need set current catalog, it will still be the one that they would target to (`spark_catalog`). The existing UT has tested that.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r926204086
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
Review Comment:
I think it's only true for temp views?
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r926092214
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
+ if (row.getString(0).isEmpty) {
+ Seq(row.getString(1))
+ } else {
+ ident ++ Seq(row.getString(1))
+ })
Review Comment:
Avoiding deprecations is also the best way until we are sure that the new features are manure enough.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia commented on PR #37241:
URL: https://github.com/apache/spark/pull/37241#issuecomment-1203203645
This PR is already covered by https://github.com/apache/spark/pull/37287. I will close my PR then.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r925961653
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
+ if (row.getString(0).isEmpty) {
+ Seq(row.getString(1))
+ } else {
+ ident ++ Seq(row.getString(1))
+ })
Review Comment:
For my understanding, is this a regression due to one of the recent commits like SPARK-39236?
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on PR #37241:
URL: https://github.com/apache/spark/pull/37241#issuecomment-1190642375
cc @imback82 too
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] amaliujia commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
amaliujia commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r926969643
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
Review Comment:
I tried to parse that `isTemporary` which is the third string in the row. Neither `row.getString(2).toInt` or `row.getString(2).toBoolean` does not work. I dig into the codebase and seems essentially the RowSerializer uses `Unsafe.putBoolean`.
Do you know what is the right way to parse a serialized boolean? Should I use a RowDeserializer somehow?
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on PR #37241:
URL: https://github.com/apache/spark/pull/37241#issuecomment-1191842164
Can one of the admins verify this patch?
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a diff in pull request #37241: [SPARK-39828][SQL] `Catalog.listTables` should respect currentCatalog
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #37241:
URL: https://github.com/apache/spark/pull/37241#discussion_r926204320
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
val plan = ShowTables(UnresolvedNamespace(ident), None)
val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect()
val tables = ret
- .map(row => ident ++ Seq(row.getString(1)))
+ .map(row =>
+ // for views, their namespace are empty
Review Comment:
`SHOW TABLES` outputs a `isTemporary` column and we can check that directly.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org