[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
Github user asfgit closed the pull request at: https://github.com/apache/spark/pull/14550 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/14550#discussion_r74198518 --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala --- @@ -135,8 +135,8 @@ class HiveDDLSuite sql(s"CREATE VIEW $viewName COMMENT 'no comment' AS SELECT * FROM $tabName") val tableMetadata = catalog.getTableMetadata(TableIdentifier(tabName, Some("default"))) val viewMetadata = catalog.getTableMetadata(TableIdentifier(viewName, Some("default"))) -assert(tableMetadata.properties.get("comment") == Option("BLABLA")) -assert(viewMetadata.properties.get("comment") == Option("no comment")) +assert(tableMetadata.comment == Option("BLABLA")) --- End diff -- Added the test. : ) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/14550#discussion_r74197606 --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala --- @@ -413,7 +413,8 @@ private[hive] class HiveClientImpl( properties = Option(h.getTTable.getSd.getSerdeInfo.getParameters) .map(_.asScala.toMap).orNull ), -properties = properties, +properties = properties.filter(kv => kv._1 != "path"), --- End diff -- haha, sure. Multiple PRs are being done at the same time. Will open a new PR tomorrow regarding `path`... --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/14550#discussion_r74195804 --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala --- @@ -135,8 +135,8 @@ class HiveDDLSuite sql(s"CREATE VIEW $viewName COMMENT 'no comment' AS SELECT * FROM $tabName") val tableMetadata = catalog.getTableMetadata(TableIdentifier(tabName, Some("default"))) val viewMetadata = catalog.getTableMetadata(TableIdentifier(viewName, Some("default"))) -assert(tableMetadata.properties.get("comment") == Option("BLABLA")) -assert(viewMetadata.properties.get("comment") == Option("no comment")) +assert(tableMetadata.comment == Option("BLABLA")) --- End diff -- also test that the `comment` is not in table properties? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/14550#discussion_r74195770 --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala --- @@ -413,7 +413,8 @@ private[hive] class HiveClientImpl( properties = Option(h.getTTable.getSd.getSerdeInfo.getParameters) .map(_.asScala.toMap).orNull ), -properties = properties, +properties = properties.filter(kv => kv._1 != "path"), --- End diff -- hey, we should filter out `comment` here, not `path` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/14550#discussion_r74195744 --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala --- @@ -413,7 +413,8 @@ private[hive] class HiveClientImpl( properties = Option(h.getTTable.getSd.getSerdeInfo.getParameters) .map(_.asScala.toMap).orNull ), -properties = properties, +properties = properties.filter(kv => kv._1 != "path"), --- End diff -- ah i see --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/14550#discussion_r74194235 --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala --- @@ -413,7 +413,8 @@ private[hive] class HiveClientImpl( properties = Option(h.getTTable.getSd.getSerdeInfo.getParameters) .map(_.asScala.toMap).orNull ), -properties = properties, +properties = properties.filter(kv => kv._1 != "path"), --- End diff -- The implementation of `filterKeys` will create a new object. ``` override def filterKeys(p: A => Boolean): Map[A, B] = new FilteredKeys(p) with DefaultMap[A, B] ``` Thus, I got the following error: ``` org.apache.spark.SparkException: Task not serializable``` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/14550#discussion_r74193561 --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala --- @@ -413,7 +413,8 @@ private[hive] class HiveClientImpl( properties = Option(h.getTTable.getSd.getSerdeInfo.getParameters) .map(_.asScala.toMap).orNull ), -properties = properties, +properties = properties.filter(kv => kv._1 != "path"), --- End diff -- why not use `filterKeys`? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/14550#discussion_r74186144 --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala --- @@ -135,7 +135,9 @@ class HiveDDLSuite sql(s"CREATE VIEW $viewName COMMENT 'no comment' AS SELECT * FROM $tabName") val tableMetadata = catalog.getTableMetadata(TableIdentifier(tabName, Some("default"))) val viewMetadata = catalog.getTableMetadata(TableIdentifier(viewName, Some("default"))) +assert(tableMetadata.comment == Option("BLABLA")) assert(tableMetadata.properties.get("comment") == Option("BLABLA")) --- End diff -- Ok. I see. Let me fix it now. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/14550#discussion_r74185996 --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala --- @@ -135,7 +135,9 @@ class HiveDDLSuite sql(s"CREATE VIEW $viewName COMMENT 'no comment' AS SELECT * FROM $tabName") val tableMetadata = catalog.getTableMetadata(TableIdentifier(tabName, Some("default"))) val viewMetadata = catalog.getTableMetadata(TableIdentifier(viewName, Some("default"))) +assert(tableMetadata.comment == Option("BLABLA")) assert(tableMetadata.properties.get("comment") == Option("BLABLA")) --- End diff -- I don't think so. `HiveClient` should be symmetrical, the table meta read back should be same with what users saved into. We don't need to follow hive here. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/14550#discussion_r74137525 --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala --- @@ -135,7 +135,9 @@ class HiveDDLSuite sql(s"CREATE VIEW $viewName COMMENT 'no comment' AS SELECT * FROM $tabName") val tableMetadata = catalog.getTableMetadata(TableIdentifier(tabName, Some("default"))) val viewMetadata = catalog.getTableMetadata(TableIdentifier(viewName, Some("default"))) +assert(tableMetadata.comment == Option("BLABLA")) assert(tableMetadata.properties.get("comment") == Option("BLABLA")) --- End diff -- As explained below, Hive keeps `comment` in the table properties. Should we keep it too? Thanks! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/14550#discussion_r73994067 --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala --- @@ -135,7 +135,9 @@ class HiveDDLSuite sql(s"CREATE VIEW $viewName COMMENT 'no comment' AS SELECT * FROM $tabName") val tableMetadata = catalog.getTableMetadata(TableIdentifier(tabName, Some("default"))) val viewMetadata = catalog.getTableMetadata(TableIdentifier(viewName, Some("default"))) +assert(tableMetadata.comment == Option("BLABLA")) assert(tableMetadata.properties.get("comment") == Option("BLABLA")) --- End diff -- I think we should also remove the `comment` from table properties, to not surprise users. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #14550: [SPARK-16959] [SQL] Rebuild Table Comment when Re...
GitHub user gatorsmile opened a pull request: https://github.com/apache/spark/pull/14550 [SPARK-16959] [SQL] Rebuild Table Comment when Retrieving Metadata from Hive Metastore ### What changes were proposed in this pull request? The `comment` in `CatalogTable` returned from Hive is always empty. We store it in the table property when creating a table. However, when we try to retrieve the table metadata from Hive metastore, we do not rebuild it. The `comment` is always empty. This PR is to fix the issue. ### How was this patch tested? Fixed the test case to verify the change. You can merge this pull request into a Git repository by running: $ git pull https://github.com/gatorsmile/spark tableComment Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/14550.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #14550 commit e546af52499a5d790a1abd7a0157438d4d7ad284 Author: gatorsmile Date: 2016-08-08T23:43:04Z fix. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org