-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[core]Fix drop table in Hive and jdbc catalog when the file path does not exists. #4860
Conversation
@@ -598,6 +595,10 @@ public Optional<TableSchema> tableSchemaInFileSystem(Path tablePath, String bran | |||
}); | |||
} | |||
|
|||
protected boolean tableExists(Identifier identifier) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
In hive and jdbc catalog, tableExists method has different implement. So I used protected.
Identifier.create(databaseName, tableName), DEFAULT_TABLE_SCHEMA, false); | ||
JdbcCatalog jdbcCatalog = (JdbcCatalog) catalog; | ||
Path path = jdbcCatalog.getTableLocation(Identifier.create(databaseName, tableName)); | ||
// delete file path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe "delete table path" is better?
identifier.getDatabaseName(), identifier.getTableName())); | ||
} catch (TException e) { | ||
throw new RuntimeException( | ||
"Cannot determine if table " + identifier.getFullName() + "exists.", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"exists." -> " exists."
Identifier.create(databaseName, tableName), | ||
addHiveTableParametersSchema, | ||
false); | ||
// delete file path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dito
catalog.dropTable(Identifier.create(databaseName, tableName), false); | ||
List<String> tables = catalog.listTables(databaseName); | ||
assertThat(tableName).isNotIn(tables); | ||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This try statement is very big, maybe add "throw Exception" in the method signature is better?
What the relation between this pr and #4863? |
It seems we resloved same problem. In UTCase and ITCase Spark 4.x and Spark 3.x, it still has some problem which I not sure how to solve.I'll close it. |
Purpose
Fix drop table in Hive and jdbc catalog when the file path does not exists.
Linked issue: close #4853
Tests
API and Format
Documentation