Github user sudheeshkatkam commented on the issue:
https://github.com/apache/drill/pull/541
tl;dr +1, please open a ticket.
Moving conversation. Vitalii said:
> I checked every schema#getTable and found that every method can throw
exception only if something go wrong (permissionError, dataReadError,
IOException etc).
getTableFromSchema()can not throw any exception, because in this method
catch (Exception e) is used.
Correct, `catch(Exception e)` is used, but the exception is wrapped in a
`DrillRuntimeException` and re-thrown.
I think it "happens so" that all plugins are doing the right thing. To
explain myself, there are two cases that I am concerned about:
1. `getTableFromSchema` (and underlying `schema#getTable`) throws an
exception when a table does not exist. For example, if the HBase plugin
supports dropping tables in the future, an invalid table name will cause the
query to [fail
with](https://github.com/apache/drill/blob/master/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/DrillHBaseTable.java#L42)
a `TableNotFoundException`, which is exactly the case an exception should not
thrown, if `IF EXISTS` exists. _For now,_ since hbase schema is not mutable,
the [check for schema
mutability](https://github.com/apache/drill/pull/541/files#diff-50862f72c560b2d1bd9af36e83019d80R66),
before deleting the table, fails.
2. `getTableFromSchema` (and underlying `schema#getTable`) does not return
`null` for non-existent tables, and `schema#dropTable` will fail. _For now_,
only two schema support dropping tables: `WorkspaceSchema` and `KuduTables`,
and they return `null` for non-existent tables. The check for schema mutability
fails for other schema.
Overall, it seems there is an unwritten rule (`schema#getTable` should
return `null` if the table does not exist) that should be documented, and HBase
plugin should be fixed. AFAIK other plugins follow this rule.
+1 for the changes; I think we should track these above issues in another
ticket.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---