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 2021/11/03 09:49:33 UTC

[GitHub] [spark] Peng-Lei opened a new pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Peng-Lei opened a new pull request #34476:
URL: https://github.com/apache/spark/pull/34476


   ### What changes were proposed in this pull request?
   
   1. Move SHOW TBLPROPERTIES parsing tests to `ShowTblPropertiesParserSuite`.
   2. Define the class `command.ShowTblPropertiesSuiteBase` that is parent of `v1.ShowTblPropertiesSuiteBase` and `v2.ShowTblPropertiesSuite`.
   3. Define the class `v1.ShowTblPropertiesSuiteBase` that is parent of `v1.ShowTblPropertiesSuite` and `hive.execution.command.ShowTblPropertiesSuite`.
   4. move testcase from `DDLParserSuite` to `ShowTblPropertiesParserSuite`
   5. move testcase from `DataSourceV2SQLSessionCatalogSuite` and `DataSourceV2SQLSuite` to `v2.ShowTblPropertiesSuite`
   6. move testcase from `HiveCommandSuite` to `hive.execution.command.ShowTblPropertiesSuite`
   
   The changes follow the approach of [#30287](https://github.com/apache/spark/pull/30287) [#34305](https://github.com/apache/spark/pull/34305)
   
   ### Why are the changes needed?
   1. The unification will allow to run common `SHOW TBLPROPERTIES` tests for both DSv1/Hive DSv1 and DSv2
   2. We can detect missing features and differences between DSv1 and DSv2 implementations.
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   ### How was this patch tested?
   Existing unit tests


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-970180327


   **[Test build #145277 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145277/testReport)** for PR 34476 at commit [`a6db08e`](https://github.com/apache/spark/commit/a6db08ea6cb333575ca6946a1d4e22c898ef755a).


-- 
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] SparkQA removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-970180327


   **[Test build #145277 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145277/testReport)** for PR 34476 at commit [`a6db08e`](https://github.com/apache/spark/commit/a6db08ea6cb333575ca6946a1d4e22c898ef755a).


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-960517770


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49365/
   


-- 
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] Peng-Lei edited a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei edited a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958797962


   I'm not sure that 
   [L1229](https://github.com/apache/spark/blob/7cb9c1c2415a0984515e4d4733f816673e4ae3c8/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala#L1229) should move to `ShowTblPropertiesParserSuite`, because it is test `Resolve` not `Parser` and we should move some method more if do it. @MaxGekk @imback82 @cloud-fan 


-- 
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] Peng-Lei commented on a change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r742584235



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala
##########
@@ -18,212 +18,25 @@
 package org.apache.spark.sql.execution.command
 
 import java.net.URI
-import java.util.{Collections, Locale}
-
-import org.mockito.ArgumentMatchers.any
-import org.mockito.Mockito.{mock, when}
-import org.mockito.invocation.InvocationOnMock
+import java.util.Locale
 
 import org.apache.spark.sql.{AnalysisException, SaveMode}
 import org.apache.spark.sql.catalyst.{AliasIdentifier, TableIdentifier}
-import org.apache.spark.sql.catalyst.analysis.{AnalysisTest, Analyzer, EmptyFunctionRegistry, NoSuchTableException, ResolvedFieldName, ResolvedTable, ResolveSessionCatalog, UnresolvedAttribute, UnresolvedRelation, UnresolvedSubqueryColumnAliases, UnresolvedTable}
-import org.apache.spark.sql.catalyst.catalog.{BucketSpec, CatalogStorageFormat, CatalogTable, CatalogTableType, InMemoryCatalog, SessionCatalog}
+import org.apache.spark.sql.catalyst.analysis.{ResolvedFieldName, ResolvedTable, UnresolvedAttribute, UnresolvedRelation, UnresolvedSubqueryColumnAliases, UnresolvedTable}
+import org.apache.spark.sql.catalyst.catalog.{BucketSpec, CatalogStorageFormat, CatalogTable, CatalogTableType}
 import org.apache.spark.sql.catalyst.expressions.{AnsiCast, AttributeReference, EqualTo, Expression, InSubquery, IntegerLiteral, ListQuery, Literal, StringLiteral}
 import org.apache.spark.sql.catalyst.expressions.objects.StaticInvoke
 import org.apache.spark.sql.catalyst.parser.{CatalystSqlParser, ParseException}
-import org.apache.spark.sql.catalyst.plans.logical.{AlterColumn, AnalysisOnlyCommand, AppendData, Assignment, CreateTableAsSelect, CreateTableStatement, CreateV2Table, DeleteAction, DeleteFromTable, DescribeRelation, DropTable, InsertAction, LocalRelation, LogicalPlan, MergeIntoTable, OneRowRelation, Project, SetTableLocation, SetTableProperties, ShowTableProperties, SubqueryAlias, UnsetTableProperties, UpdateAction, UpdateTable}
-import org.apache.spark.sql.catalyst.rules.Rule
-import org.apache.spark.sql.connector.FakeV2Provider
-import org.apache.spark.sql.connector.catalog.{CatalogManager, CatalogNotFoundException, Identifier, Table, TableCapability, TableCatalog, V1Table}
-import org.apache.spark.sql.connector.expressions.Transform
+import org.apache.spark.sql.catalyst.plans.logical.{AlterColumn, AnalysisOnlyCommand, AppendData, Assignment, CreateTableAsSelect, CreateTableStatement, CreateV2Table, DeleteAction, DeleteFromTable, DescribeRelation, DropTable, InsertAction, LogicalPlan, MergeIntoTable, OneRowRelation, Project, SetTableLocation, SetTableProperties, ShowTableProperties, SubqueryAlias, UnsetTableProperties, UpdateAction, UpdateTable}
+import org.apache.spark.sql.connector.catalog.{CatalogManager, Identifier}
 import org.apache.spark.sql.execution.datasources.CreateTable
 import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Relation
 import org.apache.spark.sql.internal.{HiveSerDe, SQLConf}
-import org.apache.spark.sql.sources.SimpleScanSource
 import org.apache.spark.sql.types.{BooleanType, CharType, DoubleType, IntegerType, LongType, StringType, StructField, StructType}
 
-class PlanResolutionSuite extends AnalysisTest {
+class PlanResolutionSuite extends PlanResolutionSuiteBase {

Review comment:
       > Today we have a unified framework to resolve database objects in commands, and we don't need to test plan resolution for each command.
   
   Thank you for reminding me, you're quite right. I will undo the last modification
   




-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-966071929


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49560/
   


-- 
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 removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958947625


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/49346/
   


-- 
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] Peng-Lei commented on a change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r747315722



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowTblPropertiesSuite.scala
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.command.v2
+
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.connector.{FakeV2Provider, InMemoryTableSessionCatalog}
+import org.apache.spark.sql.execution.command
+import org.apache.spark.sql.internal.SQLConf.V2_SESSION_CATALOG_IMPLEMENTATION
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * The class contains tests for the `SHOW TBLPROPERTIES` command to check V2 table catalogs.
+ */
+class ShowTblPropertiesSuite extends command.ShowTblPropertiesSuiteBase with CommandSuiteBase {
+
+  test("SHOW TBLPROPERTIES: v2 table") {

Review comment:
       Hold on. Let me think more and learn more about [#30287](https://github.com/apache/spark/pull/30287) [#34305](https://github.com/apache/spark/pull/34305)




-- 
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] Peng-Lei commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-970192890


   update as follow:
   - move test case from `DataSourceV2SQLSessionCatalogSuite` to `command.ShowTblPropertiesSuiteBase` to run for V2/V1/HIVE V1
   - move some test case from `HiveCommandSuite` to `command.ShowTblPropertiesSuiteBase`
   - move some test case from `HiveCommandSuite` to `v1.ShowTblPropertiesSuiteBase ` to run for V1/HIVE V1
   - Add two test case for `v1.ShowTblPropertiesSuite ` for view.
   
   


-- 
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 removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-970274372


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/49747/
   


-- 
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 #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-970443721


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145277/
   


-- 
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 closed pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #34476:
URL: https://github.com/apache/spark/pull/34476


   


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-971387082


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49795/
   


-- 
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] SparkQA removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-966045395


   **[Test build #145091 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145091/testReport)** for PR 34476 at commit [`95a2266`](https://github.com/apache/spark/commit/95a22669ec60a900cc92609c2b9486b79d7cd0b8).


-- 
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 #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958947625






-- 
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] Peng-Lei commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958797962


   I'm not sure that 
   [L1229(https://github.com/apache/spark/blob/7cb9c1c2415a0984515e4d4733f816673e4ae3c8/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala#L1229) should move to `ShowTblPropertiesParserSuite`, because it is test `Resolve` not `Parser` and we should move some method more if do it. @MaxGekk @imback82 @cloud-fan 


-- 
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 #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958947625






-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958794628


   **[Test build #144876 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/144876/testReport)** for PR 34476 at commit [`b66d351`](https://github.com/apache/spark/commit/b66d351075e6aafb1ea335ba3763bd1145567f78).


-- 
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] Peng-Lei edited a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei edited a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958797962


   I'm not sure that 
   [L1229](https://github.com/apache/spark/blob/7cb9c1c2415a0984515e4d4733f816673e4ae3c8/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala#L1229) should move to `ShowTblPropertiesParserSuite`, because it is test `Resolve` not `Parser` and we should move some method more if do it. @MaxGekk @imback82 @cloud-fan 


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-966108132


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49560/
   


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-966256050


   **[Test build #145091 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145091/testReport)** for PR 34476 at commit [`95a2266`](https://github.com/apache/spark/commit/95a22669ec60a900cc92609c2b9486b79d7cd0b8).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `class ShowTblPropertiesParserSuite extends AnalysisTest `
     * `trait ShowTblPropertiesSuiteBase extends QueryTest with DDLCommandTestUtils `
     * `class ShowTblPropertiesSuite extends ShowTblPropertiesSuiteBase with CommandSuiteBase `
     * `class ShowTblPropertiesSuite extends command.ShowTblPropertiesSuiteBase with CommandSuiteBase `
     * `class ShowTblPropertiesSuite extends v1.ShowTblPropertiesSuiteBase with CommandSuiteBase `


-- 
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 #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-970274372


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/49747/
   


-- 
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 removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-960706771


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/144895/
   


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-960495559


   **[Test build #144895 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/144895/testReport)** for PR 34476 at commit [`2806dfd`](https://github.com/apache/spark/commit/2806dfd662f7bd6c0bc8a6e04075210c2a8b7a10).


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-960702119


   **[Test build #144895 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/144895/testReport)** for PR 34476 at commit [`2806dfd`](https://github.com/apache/spark/commit/2806dfd662f7bd6c0bc8a6e04075210c2a8b7a10).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `class PlanResolutionSuite extends PlanResolutionSuiteBase `
     * `class PlanResolutionSuiteBase extends AnalysisTest `
     * `class ShowTblPropertiesParserSuite extends AnalysisTest `
     * `trait ShowTblPropertiesSuiteBase extends QueryTest with DDLCommandTestUtils `
     * `class ShowTblPropertiesPlanResolutionSuite extends PlanResolutionSuiteBase `
     * `class ShowTblPropertiesSuite extends ShowTblPropertiesSuiteBase with CommandSuiteBase `
     * `class ShowTblPropertiesPlanResolutionSuite extends PlanResolutionSuiteBase `
     * `class ShowTblPropertiesSuite extends command.ShowTblPropertiesSuiteBase with CommandSuiteBase `
     * `class ShowTblPropertiesSuite extends v1.ShowTblPropertiesSuiteBase with CommandSuiteBase `


-- 
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 change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r742568590



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala
##########
@@ -18,212 +18,25 @@
 package org.apache.spark.sql.execution.command
 
 import java.net.URI
-import java.util.{Collections, Locale}
-
-import org.mockito.ArgumentMatchers.any
-import org.mockito.Mockito.{mock, when}
-import org.mockito.invocation.InvocationOnMock
+import java.util.Locale
 
 import org.apache.spark.sql.{AnalysisException, SaveMode}
 import org.apache.spark.sql.catalyst.{AliasIdentifier, TableIdentifier}
-import org.apache.spark.sql.catalyst.analysis.{AnalysisTest, Analyzer, EmptyFunctionRegistry, NoSuchTableException, ResolvedFieldName, ResolvedTable, ResolveSessionCatalog, UnresolvedAttribute, UnresolvedRelation, UnresolvedSubqueryColumnAliases, UnresolvedTable}
-import org.apache.spark.sql.catalyst.catalog.{BucketSpec, CatalogStorageFormat, CatalogTable, CatalogTableType, InMemoryCatalog, SessionCatalog}
+import org.apache.spark.sql.catalyst.analysis.{ResolvedFieldName, ResolvedTable, UnresolvedAttribute, UnresolvedRelation, UnresolvedSubqueryColumnAliases, UnresolvedTable}
+import org.apache.spark.sql.catalyst.catalog.{BucketSpec, CatalogStorageFormat, CatalogTable, CatalogTableType}
 import org.apache.spark.sql.catalyst.expressions.{AnsiCast, AttributeReference, EqualTo, Expression, InSubquery, IntegerLiteral, ListQuery, Literal, StringLiteral}
 import org.apache.spark.sql.catalyst.expressions.objects.StaticInvoke
 import org.apache.spark.sql.catalyst.parser.{CatalystSqlParser, ParseException}
-import org.apache.spark.sql.catalyst.plans.logical.{AlterColumn, AnalysisOnlyCommand, AppendData, Assignment, CreateTableAsSelect, CreateTableStatement, CreateV2Table, DeleteAction, DeleteFromTable, DescribeRelation, DropTable, InsertAction, LocalRelation, LogicalPlan, MergeIntoTable, OneRowRelation, Project, SetTableLocation, SetTableProperties, ShowTableProperties, SubqueryAlias, UnsetTableProperties, UpdateAction, UpdateTable}
-import org.apache.spark.sql.catalyst.rules.Rule
-import org.apache.spark.sql.connector.FakeV2Provider
-import org.apache.spark.sql.connector.catalog.{CatalogManager, CatalogNotFoundException, Identifier, Table, TableCapability, TableCatalog, V1Table}
-import org.apache.spark.sql.connector.expressions.Transform
+import org.apache.spark.sql.catalyst.plans.logical.{AlterColumn, AnalysisOnlyCommand, AppendData, Assignment, CreateTableAsSelect, CreateTableStatement, CreateV2Table, DeleteAction, DeleteFromTable, DescribeRelation, DropTable, InsertAction, LogicalPlan, MergeIntoTable, OneRowRelation, Project, SetTableLocation, SetTableProperties, ShowTableProperties, SubqueryAlias, UnsetTableProperties, UpdateAction, UpdateTable}
+import org.apache.spark.sql.connector.catalog.{CatalogManager, Identifier}
 import org.apache.spark.sql.execution.datasources.CreateTable
 import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Relation
 import org.apache.spark.sql.internal.{HiveSerDe, SQLConf}
-import org.apache.spark.sql.sources.SimpleScanSource
 import org.apache.spark.sql.types.{BooleanType, CharType, DoubleType, IntegerType, LongType, StringType, StructField, StructType}
 
-class PlanResolutionSuite extends AnalysisTest {
+class PlanResolutionSuite extends PlanResolutionSuiteBase {

Review comment:
       Let's leave this suite unchanged.
   
   Today we have a unified framework to resolve database objects in commands, and we don't need to test plan resolution for each command. We will probably clean up this test suite to only test DML commands.




-- 
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 removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-960554871


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/49365/
   


-- 
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] SparkQA removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958794628


   **[Test build #144876 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/144876/testReport)** for PR 34476 at commit [`b66d351`](https://github.com/apache/spark/commit/b66d351075e6aafb1ea335ba3763bd1145567f78).


-- 
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 #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-966257568


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145091/
   


-- 
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] Peng-Lei commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-968628456


   > are you going to unify the tests? @Peng-Lei
   Yeah. I am going work on this. Sorry. I clicked the wrong request for review. @cloud-fan 
   
   


-- 
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 change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r750392989



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTblPropertiesSuite.scala
##########
@@ -0,0 +1,87 @@
+/*
+ * 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.command.v1
+
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.execution.command
+import org.apache.spark.sql.internal.SQLConf
+
+/**
+ * This base suite contains unified tests for the `SHOW TBLPROPERTIES` command that checks V1
+ * table catalogs. The tests that cannot run for all V1 catalogs are located in more
+ * specific test suites:
+ *
+ *   - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuite`
+ *   - V1 Hive External catalog:
+ *     `org.apache.spark.sql.hive.execution.command.ShowTblPropertiesSuite`
+ */
+trait ShowTblPropertiesSuiteBase extends command.ShowTblPropertiesSuiteBase
+    with command.TestsV1AndV2Commands {
+
+  test("SHOW TBLPROPERTIES(KEY) KEY NOT FOUND") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      val nonExistingKey = "nonExistingKey"
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='andrew', 'status'='new')")
+
+      val properties = sql(s"SHOW TBLPROPERTIES $tbl ('$nonExistingKey')")
+      val expected = Seq(Row(nonExistingKey,
+        s"Table ns1.tbl does not have property: $nonExistingKey"))

Review comment:
       can we change the test code so that it can be moved to the base class? e.g.
   ```
   val res = properties.collect()
   assert(res.length == 1)
   assert(res.head.getString(0) == nonExistingKey)
   assert(res.head.getString(1).contains("does not have property: $nonExistingKey"))
   ```




-- 
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 pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-971581474


   thanks, merging to master!


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-971352334


   **[Test build #145325 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145325/testReport)** for PR 34476 at commit [`95e30cf`](https://github.com/apache/spark/commit/95e30cfb99e9420e06e612c860b300c39d54113e).


-- 
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 pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-968626715


   are you going to unify the tests? @Peng-Lei 


-- 
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 #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-971444128


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/49795/
   


-- 
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] Peng-Lei commented on a change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r750184127



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTblPropertiesSuite.scala
##########
@@ -0,0 +1,87 @@
+/*
+ * 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.command.v1
+
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.execution.command
+import org.apache.spark.sql.internal.SQLConf
+
+/**
+ * This base suite contains unified tests for the `SHOW TBLPROPERTIES` command that checks V1
+ * table catalogs. The tests that cannot run for all V1 catalogs are located in more
+ * specific test suites:
+ *
+ *   - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuite`
+ *   - V1 Hive External catalog:
+ *     `org.apache.spark.sql.hive.execution.command.ShowTblPropertiesSuite`
+ */
+trait ShowTblPropertiesSuiteBase extends command.ShowTblPropertiesSuiteBase
+    with command.TestsV1AndV2Commands {
+
+  test("SHOW TBLPROPERTIES(KEY) KEY NOT FOUND") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      val nonExistingKey = "nonExistingKey"
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='andrew', 'status'='new')")
+
+      val properties = sql(s"SHOW TBLPROPERTIES $tbl ('$nonExistingKey')")
+      val expected = Seq(Row(nonExistingKey,
+        s"Table ns1.tbl does not have property: $nonExistingKey"))

Review comment:
       The table name without catalog name in V1 different with V2.




-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958891594


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49346/
   


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-959363759


   **[Test build #144876 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/144876/testReport)** for PR 34476 at commit [`b66d351`](https://github.com/apache/spark/commit/b66d351075e6aafb1ea335ba3763bd1145567f78).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `class ShowTblPropertiesParserSuite extends AnalysisTest `
     * `trait ShowTblPropertiesSuiteBase extends QueryTest with DDLCommandTestUtils `
     * `class ShowTblPropertiesSuite extends ShowTblPropertiesSuiteBase with CommandSuiteBase `
     * `class ShowTblPropertiesSuite extends command.ShowTblPropertiesSuiteBase with CommandSuiteBase `
     * `class ShowTblPropertiesSuite extends v1.ShowTblPropertiesSuiteBase with CommandSuiteBase `


-- 
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 removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958947625






-- 
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] SparkQA removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958794628






-- 
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 change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r747296244



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowTblPropertiesSuite.scala
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.command.v2
+
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.connector.{FakeV2Provider, InMemoryTableSessionCatalog}
+import org.apache.spark.sql.execution.command
+import org.apache.spark.sql.internal.SQLConf.V2_SESSION_CATALOG_IMPLEMENTATION
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * The class contains tests for the `SHOW TBLPROPERTIES` command to check V2 table catalogs.
+ */
+class ShowTblPropertiesSuite extends command.ShowTblPropertiesSuiteBase with CommandSuiteBase {
+
+  test("SHOW TBLPROPERTIES: v2 table") {

Review comment:
       is it possible to unify the test? seems this PR just move the old tests to either v1 or v2 test suite, but did not unify them.




-- 
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] Peng-Lei commented on a change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r747254263



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala
##########
@@ -18,212 +18,25 @@
 package org.apache.spark.sql.execution.command
 
 import java.net.URI
-import java.util.{Collections, Locale}
-
-import org.mockito.ArgumentMatchers.any
-import org.mockito.Mockito.{mock, when}
-import org.mockito.invocation.InvocationOnMock
+import java.util.Locale
 
 import org.apache.spark.sql.{AnalysisException, SaveMode}
 import org.apache.spark.sql.catalyst.{AliasIdentifier, TableIdentifier}
-import org.apache.spark.sql.catalyst.analysis.{AnalysisTest, Analyzer, EmptyFunctionRegistry, NoSuchTableException, ResolvedFieldName, ResolvedTable, ResolveSessionCatalog, UnresolvedAttribute, UnresolvedRelation, UnresolvedSubqueryColumnAliases, UnresolvedTable}
-import org.apache.spark.sql.catalyst.catalog.{BucketSpec, CatalogStorageFormat, CatalogTable, CatalogTableType, InMemoryCatalog, SessionCatalog}
+import org.apache.spark.sql.catalyst.analysis.{ResolvedFieldName, ResolvedTable, UnresolvedAttribute, UnresolvedRelation, UnresolvedSubqueryColumnAliases, UnresolvedTable}
+import org.apache.spark.sql.catalyst.catalog.{BucketSpec, CatalogStorageFormat, CatalogTable, CatalogTableType}
 import org.apache.spark.sql.catalyst.expressions.{AnsiCast, AttributeReference, EqualTo, Expression, InSubquery, IntegerLiteral, ListQuery, Literal, StringLiteral}
 import org.apache.spark.sql.catalyst.expressions.objects.StaticInvoke
 import org.apache.spark.sql.catalyst.parser.{CatalystSqlParser, ParseException}
-import org.apache.spark.sql.catalyst.plans.logical.{AlterColumn, AnalysisOnlyCommand, AppendData, Assignment, CreateTableAsSelect, CreateTableStatement, CreateV2Table, DeleteAction, DeleteFromTable, DescribeRelation, DropTable, InsertAction, LocalRelation, LogicalPlan, MergeIntoTable, OneRowRelation, Project, SetTableLocation, SetTableProperties, ShowTableProperties, SubqueryAlias, UnsetTableProperties, UpdateAction, UpdateTable}
-import org.apache.spark.sql.catalyst.rules.Rule
-import org.apache.spark.sql.connector.FakeV2Provider
-import org.apache.spark.sql.connector.catalog.{CatalogManager, CatalogNotFoundException, Identifier, Table, TableCapability, TableCatalog, V1Table}
-import org.apache.spark.sql.connector.expressions.Transform
+import org.apache.spark.sql.catalyst.plans.logical.{AlterColumn, AnalysisOnlyCommand, AppendData, Assignment, CreateTableAsSelect, CreateTableStatement, CreateV2Table, DeleteAction, DeleteFromTable, DescribeRelation, DropTable, InsertAction, LogicalPlan, MergeIntoTable, OneRowRelation, Project, SetTableLocation, SetTableProperties, ShowTableProperties, SubqueryAlias, UnsetTableProperties, UpdateAction, UpdateTable}
+import org.apache.spark.sql.connector.catalog.{CatalogManager, Identifier}
 import org.apache.spark.sql.execution.datasources.CreateTable
 import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Relation
 import org.apache.spark.sql.internal.{HiveSerDe, SQLConf}
-import org.apache.spark.sql.sources.SimpleScanSource
 import org.apache.spark.sql.types.{BooleanType, CharType, DoubleType, IntegerType, LongType, StringType, StructField, StructType}
 
-class PlanResolutionSuite extends AnalysisTest {
+class PlanResolutionSuite extends PlanResolutionSuiteBase {

Review comment:
       done




-- 
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 removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-971585865


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145325/
   


-- 
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 removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-970443721


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145277/
   


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-970267701


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49747/
   


-- 
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 change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r750394139



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTblPropertiesSuite.scala
##########
@@ -0,0 +1,87 @@
+/*
+ * 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.command.v1
+
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.execution.command
+import org.apache.spark.sql.internal.SQLConf
+
+/**
+ * This base suite contains unified tests for the `SHOW TBLPROPERTIES` command that checks V1
+ * table catalogs. The tests that cannot run for all V1 catalogs are located in more
+ * specific test suites:
+ *
+ *   - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuite`
+ *   - V1 Hive External catalog:
+ *     `org.apache.spark.sql.hive.execution.command.ShowTblPropertiesSuite`
+ */
+trait ShowTblPropertiesSuiteBase extends command.ShowTblPropertiesSuiteBase
+    with command.TestsV1AndV2Commands {
+
+  test("SHOW TBLPROPERTIES(KEY) KEY NOT FOUND") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      val nonExistingKey = "nonExistingKey"
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='andrew', 'status'='new')")
+
+      val properties = sql(s"SHOW TBLPROPERTIES $tbl ('$nonExistingKey')")
+      val expected = Seq(Row(nonExistingKey,
+        s"Table ns1.tbl does not have property: $nonExistingKey"))
+      assert(expected === properties.collect())
+    }
+  }
+
+  test("SHOW TBLPROPERTIES WITH LEGACY_KEEP_COMMAND_OUTPUT_SCHEMA") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='andrew', 'status'='new')")
+      withSQLConf(SQLConf.LEGACY_KEEP_COMMAND_OUTPUT_SCHEMA.key -> "true") {
+        checkAnswer(sql(s"SHOW TBLPROPERTIES $tbl('user')"), Row("andrew"))
+        checkAnswer(sql(s"SHOW TBLPROPERTIES $tbl('status')"), Row("new"))
+      }
+    }
+  }
+}
+
+/**
+ * The class contains tests for the `SHOW TBLPROPERTIES` command to check V1 In-Memory
+ * table catalog.
+ */
+class ShowTblPropertiesSuite extends ShowTblPropertiesSuiteBase with CommandSuiteBase {
+  override def commandVersion: String = super[ShowTblPropertiesSuiteBase].commandVersion
+
+  test("SHOW TBLPROPERTIES FOR VIEW") {

Review comment:
       if so can we add a comment to explain it?




-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-960550408


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49365/
   


-- 
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 #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-960554871


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/49365/
   


-- 
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 #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-960706771


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/144895/
   


-- 
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] SparkQA removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958794628


   **[Test build #144876 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/144876/testReport)** for PR 34476 at commit [`b66d351`](https://github.com/apache/spark/commit/b66d351075e6aafb1ea335ba3763bd1145567f78).


-- 
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 removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-959472795


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/144876/
   


-- 
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] Peng-Lei commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958797962


   I'm not sure that 
   [L1229(https://github.com/apache/spark/blob/7cb9c1c2415a0984515e4d4733f816673e4ae3c8/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala#L1229) should move to `ShowTblPropertiesParserSuite`, because it is test `Resolve` not `Parser` and we should move some method more if do it. @MaxGekk @imback82 @cloud-fan 


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958794628






-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-971577831


   **[Test build #145325 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145325/testReport)** for PR 34476 at commit [`95e30cf`](https://github.com/apache/spark/commit/95e30cfb99e9420e06e612c860b300c39d54113e).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `class ShowTblPropertiesSuite extends ShowTblPropertiesSuiteBase with CommandSuiteBase `


-- 
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] SparkQA removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-971352334


   **[Test build #145325 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145325/testReport)** for PR 34476 at commit [`95e30cf`](https://github.com/apache/spark/commit/95e30cfb99e9420e06e612c860b300c39d54113e).


-- 
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 #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958947625


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/49346/
   


-- 
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] Peng-Lei edited a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei edited a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958797962


   I'm not sure that 
   [L1229](https://github.com/apache/spark/blob/7cb9c1c2415a0984515e4d4733f816673e4ae3c8/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala#L1229) should move to `ShowTblPropertiesParserSuite`, because it is test `Resolve` not `Parser` and we should move some method more if do it. @MaxGekk @imback82 @cloud-fan 


-- 
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 change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r750390079



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTblPropertiesSuiteBase.scala
##########
@@ -0,0 +1,77 @@
+/*
+ * 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.command
+
+import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * This base suite contains unified tests for the `SHOW TBLPROPERTIES` command that check V1 and V2
+ * table catalogs. The tests that cannot run for all supported catalogs are located in more
+ * specific test suites:
+ *
+ *   - V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.ShowTblPropertiesSuite`
+ *   - V1 table catalog tests:
+ *     `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuiteBase`
+ *     - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuite`
+ *     - V1 Hive External catalog:
+*        `org.apache.spark.sql.hive.execution.command.ShowTblPropertiesSuite`
+ */
+trait ShowTblPropertiesSuiteBase extends QueryTest with DDLCommandTestUtils {
+  override val command = "SHOW TBLPROPERTIES"
+
+  test("SHOW TBLPROPERTIES BASIC") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      val user = "andrew"
+      val status = "new"
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='$user', 'status'='$status')")
+
+      val properties = sql(s"SHOW TBLPROPERTIES $tbl").filter("key != 'transient_lastDdlTime'")
+      val schema = new StructType()
+        .add("key", StringType, nullable = false)
+        .add("value", StringType, nullable = false)
+      val expected = Seq(
+        Row("status", status),
+        Row("user", user))
+
+      assert(properties.schema === schema)
+      assert(expected === properties.collect().sortBy(_.toString))
+    }
+  }
+
+  test("SHOW TBLPROPERTIES(KEY)") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      val user = "andrew"
+      val status = "new"
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='$user', 'status'='$status')")
+
+      val properties = sql(s"SHOW TBLPROPERTIES $tbl ('status')")
+      val expected = Seq(Row("status", status))
+      assert(expected === properties.collect())

Review comment:
       ditto




-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-970436056


   **[Test build #145277 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145277/testReport)** for PR 34476 at commit [`a6db08e`](https://github.com/apache/spark/commit/a6db08ea6cb333575ca6946a1d4e22c898ef755a).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `class ShowTblPropertiesParserSuite extends AnalysisTest `
     * `trait ShowTblPropertiesSuiteBase extends QueryTest with DDLCommandTestUtils `
     * `class ShowTblPropertiesSuite extends ShowTblPropertiesSuiteBase with CommandSuiteBase `
     * `class ShowTblPropertiesSuite extends command.ShowTblPropertiesSuiteBase with CommandSuiteBase `
     * `class ShowTblPropertiesSuite extends v1.ShowTblPropertiesSuiteBase with CommandSuiteBase `


-- 
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 removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-971444128


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/49795/
   


-- 
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 change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r751223075



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTblPropertiesSuiteBase.scala
##########
@@ -0,0 +1,90 @@
+/*
+ * 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.command
+
+import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * This base suite contains unified tests for the `SHOW TBLPROPERTIES` command that check V1 and V2
+ * table catalogs. The tests that cannot run for all supported catalogs are located in more
+ * specific test suites:
+ *
+ *   - V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.ShowTblPropertiesSuite`
+ *   - V1 table catalog tests:
+ *     `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuiteBase`
+ *     - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuite`
+ *     - V1 Hive External catalog:
+*        `org.apache.spark.sql.hive.execution.command.ShowTblPropertiesSuite`
+ */
+trait ShowTblPropertiesSuiteBase extends QueryTest with DDLCommandTestUtils {
+  override val command = "SHOW TBLPROPERTIES"
+
+  test("SHOW TBLPROPERTIES BASIC") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      val user = "andrew"
+      val status = "new"
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='$user', 'status'='$status')")
+
+      val properties = sql(s"SHOW TBLPROPERTIES $tbl").filter("key != 'transient_lastDdlTime'")
+      val schema = new StructType()
+        .add("key", StringType, nullable = false)
+        .add("value", StringType, nullable = false)
+      val expected = Seq(
+        Row("status", status),
+        Row("user", user))
+
+      assert(properties.schema === schema)
+      checkAnswer(properties.sort("key"), expected)

Review comment:
       v1 should sort as well. We can fix this in a followup.




-- 
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 #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-966113101


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/49560/
   


-- 
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] Peng-Lei commented on a change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r750969056



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTblPropertiesSuite.scala
##########
@@ -0,0 +1,87 @@
+/*
+ * 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.command.v1
+
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.execution.command
+import org.apache.spark.sql.internal.SQLConf
+
+/**
+ * This base suite contains unified tests for the `SHOW TBLPROPERTIES` command that checks V1
+ * table catalogs. The tests that cannot run for all V1 catalogs are located in more
+ * specific test suites:
+ *
+ *   - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuite`
+ *   - V1 Hive External catalog:
+ *     `org.apache.spark.sql.hive.execution.command.ShowTblPropertiesSuite`
+ */
+trait ShowTblPropertiesSuiteBase extends command.ShowTblPropertiesSuiteBase
+    with command.TestsV1AndV2Commands {
+
+  test("SHOW TBLPROPERTIES(KEY) KEY NOT FOUND") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      val nonExistingKey = "nonExistingKey"
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='andrew', 'status'='new')")
+
+      val properties = sql(s"SHOW TBLPROPERTIES $tbl ('$nonExistingKey')")
+      val expected = Seq(Row(nonExistingKey,
+        s"Table ns1.tbl does not have property: $nonExistingKey"))
+      assert(expected === properties.collect())
+    }
+  }
+
+  test("SHOW TBLPROPERTIES WITH LEGACY_KEEP_COMMAND_OUTPUT_SCHEMA") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='andrew', 'status'='new')")
+      withSQLConf(SQLConf.LEGACY_KEEP_COMMAND_OUTPUT_SCHEMA.key -> "true") {
+        checkAnswer(sql(s"SHOW TBLPROPERTIES $tbl('user')"), Row("andrew"))
+        checkAnswer(sql(s"SHOW TBLPROPERTIES $tbl('status')"), Row("new"))
+      }
+    }
+  }
+}
+
+/**
+ * The class contains tests for the `SHOW TBLPROPERTIES` command to check V1 In-Memory
+ * table catalog.
+ */
+class ShowTblPropertiesSuite extends ShowTblPropertiesSuiteBase with CommandSuiteBase {
+  override def commandVersion: String = super[ShowTblPropertiesSuiteBase].commandVersion
+
+  test("SHOW TBLPROPERTIES FOR VIEW") {

Review comment:
       > The reason to have these 2 tests here is because hive can return more properties?
   
   Yeah. An additional attribute `transient_lastDdlTime` is added for hive. I try to move the test case to `v1.base` with filter the properties `transient_lastDdlTime`. So they can run for V1/HIVE V1




-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-971416930


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49795/
   


-- 
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] Peng-Lei commented on a change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r750972162



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTblPropertiesSuiteBase.scala
##########
@@ -0,0 +1,90 @@
+/*
+ * 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.command
+
+import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * This base suite contains unified tests for the `SHOW TBLPROPERTIES` command that check V1 and V2
+ * table catalogs. The tests that cannot run for all supported catalogs are located in more
+ * specific test suites:
+ *
+ *   - V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.ShowTblPropertiesSuite`
+ *   - V1 table catalog tests:
+ *     `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuiteBase`
+ *     - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuite`
+ *     - V1 Hive External catalog:
+*        `org.apache.spark.sql.hive.execution.command.ShowTblPropertiesSuite`
+ */
+trait ShowTblPropertiesSuiteBase extends QueryTest with DDLCommandTestUtils {
+  override val command = "SHOW TBLPROPERTIES"
+
+  test("SHOW TBLPROPERTIES BASIC") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      val user = "andrew"
+      val status = "new"
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='$user', 'status'='$status')")
+
+      val properties = sql(s"SHOW TBLPROPERTIES $tbl").filter("key != 'transient_lastDdlTime'")
+      val schema = new StructType()
+        .add("key", StringType, nullable = false)
+        .add("value", StringType, nullable = false)
+      val expected = Seq(
+        Row("status", status),
+        Row("user", user))
+
+      assert(properties.schema === schema)
+      checkAnswer(properties.sort("key"), expected)

Review comment:
       v2: sort the result. v1: without the sort. So the test case sort the result before the compare




-- 
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 #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-971585865


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145325/
   


-- 
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 change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r750393962



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTblPropertiesSuite.scala
##########
@@ -0,0 +1,87 @@
+/*
+ * 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.command.v1
+
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.execution.command
+import org.apache.spark.sql.internal.SQLConf
+
+/**
+ * This base suite contains unified tests for the `SHOW TBLPROPERTIES` command that checks V1
+ * table catalogs. The tests that cannot run for all V1 catalogs are located in more
+ * specific test suites:
+ *
+ *   - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuite`
+ *   - V1 Hive External catalog:
+ *     `org.apache.spark.sql.hive.execution.command.ShowTblPropertiesSuite`
+ */
+trait ShowTblPropertiesSuiteBase extends command.ShowTblPropertiesSuiteBase
+    with command.TestsV1AndV2Commands {
+
+  test("SHOW TBLPROPERTIES(KEY) KEY NOT FOUND") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      val nonExistingKey = "nonExistingKey"
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='andrew', 'status'='new')")
+
+      val properties = sql(s"SHOW TBLPROPERTIES $tbl ('$nonExistingKey')")
+      val expected = Seq(Row(nonExistingKey,
+        s"Table ns1.tbl does not have property: $nonExistingKey"))
+      assert(expected === properties.collect())
+    }
+  }
+
+  test("SHOW TBLPROPERTIES WITH LEGACY_KEEP_COMMAND_OUTPUT_SCHEMA") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='andrew', 'status'='new')")
+      withSQLConf(SQLConf.LEGACY_KEEP_COMMAND_OUTPUT_SCHEMA.key -> "true") {
+        checkAnswer(sql(s"SHOW TBLPROPERTIES $tbl('user')"), Row("andrew"))
+        checkAnswer(sql(s"SHOW TBLPROPERTIES $tbl('status')"), Row("new"))
+      }
+    }
+  }
+}
+
+/**
+ * The class contains tests for the `SHOW TBLPROPERTIES` command to check V1 In-Memory
+ * table catalog.
+ */
+class ShowTblPropertiesSuite extends ShowTblPropertiesSuiteBase with CommandSuiteBase {
+  override def commandVersion: String = super[ShowTblPropertiesSuiteBase].commandVersion
+
+  test("SHOW TBLPROPERTIES FOR VIEW") {

Review comment:
       The reason to have these 2 tests here is because hive can return more properties?




-- 
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 change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r750389085



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTblPropertiesSuiteBase.scala
##########
@@ -0,0 +1,77 @@
+/*
+ * 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.command
+
+import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * This base suite contains unified tests for the `SHOW TBLPROPERTIES` command that check V1 and V2
+ * table catalogs. The tests that cannot run for all supported catalogs are located in more
+ * specific test suites:
+ *
+ *   - V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.ShowTblPropertiesSuite`
+ *   - V1 table catalog tests:
+ *     `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuiteBase`
+ *     - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuite`
+ *     - V1 Hive External catalog:
+*        `org.apache.spark.sql.hive.execution.command.ShowTblPropertiesSuite`
+ */
+trait ShowTblPropertiesSuiteBase extends QueryTest with DDLCommandTestUtils {
+  override val command = "SHOW TBLPROPERTIES"
+
+  test("SHOW TBLPROPERTIES BASIC") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      val user = "andrew"
+      val status = "new"
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='$user', 'status'='$status')")
+
+      val properties = sql(s"SHOW TBLPROPERTIES $tbl").filter("key != 'transient_lastDdlTime'")
+      val schema = new StructType()
+        .add("key", StringType, nullable = false)
+        .add("value", StringType, nullable = false)
+      val expected = Seq(
+        Row("status", status),
+        Row("user", user))
+
+      assert(properties.schema === schema)
+      assert(expected === properties.collect().sortBy(_.toString))

Review comment:
       nit: we can use `checkAnswer` to check result




-- 
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 removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-966113101


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/49560/
   


-- 
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] Peng-Lei edited a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei edited a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-968628456


   > are you going to unify the tests? @Peng-Lei
   
   Yeah. I am going work on this. Sorry. I clicked the wrong request for review. @cloud-fan 
   


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958945279


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49346/
   


-- 
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 #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-959472795


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/144876/
   


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958794628






-- 
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] Peng-Lei commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958797962


   I'm not sure that 
   [L1229(https://github.com/apache/spark/blob/7cb9c1c2415a0984515e4d4733f816673e4ae3c8/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala#L1229) should move to `ShowTblPropertiesParserSuite`, because it is test `Resolve` not `Parser` and we should move some method more if do it. @MaxGekk @imback82 @cloud-fan 


-- 
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] Peng-Lei edited a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei edited a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958797962


   I'm not sure that 
   [L1229](https://github.com/apache/spark/blob/7cb9c1c2415a0984515e4d4733f816673e4ae3c8/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala#L1229) should move to `ShowTblPropertiesParserSuite`, because it is test `Resolve` not `Parser` and we should move some method more if do it. @MaxGekk @imback82 @cloud-fan 


-- 
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] Peng-Lei commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958797962


   I'm not sure that 
   [L1229(https://github.com/apache/spark/blob/7cb9c1c2415a0984515e4d4733f816673e4ae3c8/sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala#L1229) should move to `ShowTblPropertiesParserSuite`, because it is test `Resolve` not `Parser` and we should move some method more if do it. @MaxGekk @imback82 @cloud-fan 


-- 
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 removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-958947625






-- 
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] Peng-Lei commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-960490762


   > If you have such tests, please, place them to a separate test suite but not to `*ParserSuite`. Actually, I planned to do so if I would work on unifying of v1 and v2 `CREATE TABLE` tests.
   
   @MaxGekk , Could you continue to look at it, and I made the following modifications
   
   1. I define the `PlanResolutionSuiteBase` that contains the properties and methods of `PlanResolutionSuite`.
   2. Define the `v1.ShowTblPropertiesPlanResolutionSuite` and `v2.ShowTblPropertiesPlanResolutionSuite` extends the `PlanResolutionSuiteBase`, so that they can use method of parent class.
   3. In order to guarantee `PlanResolutionSuite` is right that after extract method/properties  to `properties `, I change that `PlanResolutionSuite` extends `PlanResolutionSuiteBase`.
   4. `PlanResolutionSuiteBase` may not be abstract enough, but enough for this PR.
   
   
   
   


-- 
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] SparkQA removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-960495559


   **[Test build #144895 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/144895/testReport)** for PR 34476 at commit [`2806dfd`](https://github.com/apache/spark/commit/2806dfd662f7bd6c0bc8a6e04075210c2a8b7a10).


-- 
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 removed a comment on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-966257568


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145091/
   


-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-966045395


   **[Test build #145091 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145091/testReport)** for PR 34476 at commit [`95a2266`](https://github.com/apache/spark/commit/95a22669ec60a900cc92609c2b9486b79d7cd0b8).


-- 
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] Peng-Lei commented on a change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r750185101



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTblPropertiesSuite.scala
##########
@@ -0,0 +1,87 @@
+/*
+ * 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.command.v1
+
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.execution.command
+import org.apache.spark.sql.internal.SQLConf
+
+/**
+ * This base suite contains unified tests for the `SHOW TBLPROPERTIES` command that checks V1
+ * table catalogs. The tests that cannot run for all V1 catalogs are located in more
+ * specific test suites:
+ *
+ *   - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuite`
+ *   - V1 Hive External catalog:
+ *     `org.apache.spark.sql.hive.execution.command.ShowTblPropertiesSuite`
+ */
+trait ShowTblPropertiesSuiteBase extends command.ShowTblPropertiesSuiteBase
+    with command.TestsV1AndV2Commands {
+
+  test("SHOW TBLPROPERTIES(KEY) KEY NOT FOUND") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      val nonExistingKey = "nonExistingKey"
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='andrew', 'status'='new')")
+
+      val properties = sql(s"SHOW TBLPROPERTIES $tbl ('$nonExistingKey')")
+      val expected = Seq(Row(nonExistingKey,
+        s"Table ns1.tbl does not have property: $nonExistingKey"))
+      assert(expected === properties.collect())
+    }
+  }
+
+  test("SHOW TBLPROPERTIES WITH LEGACY_KEEP_COMMAND_OUTPUT_SCHEMA") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='andrew', 'status'='new')")
+      withSQLConf(SQLConf.LEGACY_KEEP_COMMAND_OUTPUT_SCHEMA.key -> "true") {

Review comment:
       In V1. We can set `LEGACY_KEEP_COMMAND_OUTPUT_SCHEMA` to control the 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-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] Peng-Lei commented on a change in pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on a change in pull request #34476:
URL: https://github.com/apache/spark/pull/34476#discussion_r750181993



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowTblPropertiesSuiteBase.scala
##########
@@ -0,0 +1,77 @@
+/*
+ * 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.command
+
+import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
+import org.apache.spark.sql.types.{StringType, StructType}
+
+/**
+ * This base suite contains unified tests for the `SHOW TBLPROPERTIES` command that check V1 and V2
+ * table catalogs. The tests that cannot run for all supported catalogs are located in more
+ * specific test suites:
+ *
+ *   - V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.ShowTblPropertiesSuite`
+ *   - V1 table catalog tests:
+ *     `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuiteBase`
+ *     - V1 In-Memory catalog: `org.apache.spark.sql.execution.command.v1.ShowTblPropertiesSuite`
+ *     - V1 Hive External catalog:
+*        `org.apache.spark.sql.hive.execution.command.ShowTblPropertiesSuite`
+ */
+trait ShowTblPropertiesSuiteBase extends QueryTest with DDLCommandTestUtils {
+  override val command = "SHOW TBLPROPERTIES"
+
+  test("SHOW TBLPROPERTIES BASIC") {
+    withNamespaceAndTable("ns1", "tbl") { tbl =>
+      val user = "andrew"
+      val status = "new"
+      spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " +
+        s"TBLPROPERTIES ('user'='$user', 'status'='$status')")
+
+      val properties = sql(s"SHOW TBLPROPERTIES $tbl").filter("key != 'transient_lastDdlTime'")

Review comment:
       In order to be compatible Hive table, so add the filter action.




-- 
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] SparkQA commented on pull request #34476: [SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34476:
URL: https://github.com/apache/spark/pull/34476#issuecomment-970218720


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49747/
   


-- 
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