-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-29869][SQL] improve error message in HiveMetastoreCatalog#convertToLogicalRelation #26499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
dd1efc8
1071b50
1c98c38
363afb6
46c16c0
1df7b8d
9f29abc
ad71656
2efaafc
3288ffd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,9 @@ | |
|
|
||
| package org.apache.spark.sql.hive | ||
|
|
||
| import org.apache.hadoop.conf.Configuration | ||
| import org.apache.hadoop.fs.Path | ||
|
|
||
| import org.apache.spark.sql.{QueryTest, Row, SaveMode} | ||
| import org.apache.spark.sql.catalyst.{AliasIdentifier, TableIdentifier} | ||
| import org.apache.spark.sql.catalyst.catalog.CatalogTableType | ||
|
|
@@ -358,4 +361,23 @@ class DataSourceWithHiveMetastoreCatalogSuite | |
| Seq(table("src").count().toString)) | ||
| } | ||
| } | ||
|
|
||
| test("SPARK-29869: fix HiveMetastoreCatalog#convertToLogicalRelation throws AssertionError") { | ||
| withTempPath(dir => { | ||
| val baseDir = s"${dir.getCanonicalFile.toURI.toString}/test" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the location can be set to anywhere. |
||
| val partitionLikeDir = s"${dir.getCanonicalFile.toURI.toString}/test/dt=20191113" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| spark.range(3).selectExpr("id").write.parquet(partitionLikeDir) | ||
| withTable("non_partition_table") { | ||
| withSQLConf(HiveUtils.CONVERT_METASTORE_PARQUET.key -> "true") { | ||
| spark.sql( | ||
| s""" | ||
| |CREATE TABLE non_partition_table (id bigint) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't it a malformed table? Does hive ignore the directories for non-partitioned tables?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems Hive return none when query this table(1.2.1):
But no assertion error
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe you are right. Actually the table LOCATION is So should I revert the code changes and only keep the assert detail information? Or throws exception instead of assertion, and catch it then rollback to do not use built-in Parquet reader to read? |
||
| |STORED AS PARQUET LOCATION '$baseDir' | ||
| |""".stripMargin) | ||
| assert(spark.sql("select * from non_partition_table").collect() === | ||
| Array(Row(0), Row(1), Row(2))) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok. I wanna wait more comments to update in one. |
||
| } | ||
| } | ||
| }) | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.