-
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
[hive] Fix no longer possible to drop the hms table issue when table … #4863
base: master
Are you sure you want to change the base?
Conversation
Repeated : #4860 |
@@ -272,10 +272,14 @@ public void dropTable(Identifier identifier, boolean ignoreIfNotExists) | |||
try { | |||
getTable(identifier); | |||
} catch (TableNotExistException e) { | |||
if (!tableExistsInFileSystem(getTableLocation(identifier), DEFAULT_MAIN_BRANCH)) { |
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.
As far as I know, before Spark calls catalog.dropTable
, it actually invokes catalog.getTable
fisrtly. It has already been skipped there.
case class DropTableExec(
catalog: TableCatalog,
ident: Identifier,
ifExists: Boolean,
purge: Boolean,
invalidateCache: () => Unit) extends LeafV2CommandExec {
override def run(): Seq[InternalRow] = {
if (catalog.tableExists(ident)) {
invalidateCache()
if (purge) catalog.purgeTable(ident) else catalog.dropTable(ident)
} else if (!ifExists) {
throw QueryCompilationErrors.noSuchTableError(
catalog.name() +: ident.namespace() :+ ident.name())
}
Seq.empty
}
.../paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/DDLWithHiveCatalogTestBase.scala
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java
Outdated
Show resolved
Hide resolved
9462d04
to
8ca41fc
Compare
I'm OK with this modification. The core reason is that before dropping the table, the compute engine will call table exists -> |
identifier.getDatabaseName(), | ||
identifier.getTableName()); | ||
try { | ||
dropTableImpl(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.
Drop table in getTable? This behavior is too strange.
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.
Ok, thanks
I am -1 for this. You can enrich exception message. And user can just use drop table again? |
Maybe just drop hms table in dropTable even if the table is not on FS? |
Or, just recover and return a very basic dummy table when getTable, if we find the table is in hms and not on FileSystem? |
d5c05e1
to
0df8b9d
Compare
…ogic if table in hms but not in fs
…not in fs (#4853)
Purpose Fix no longer possible to drop the hms table issue when table not in fs
Linked issue: close #4853
Tests
API and Format
Documentation