Github user vvysotskyi commented on a diff in the pull request:
https://github.com/apache/drill/pull/1066#discussion_r158260235
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/SqlConverter.java
---
@@ -470,34 +576,32 @@ public void disallowTemporaryTables() {
* @throws UserException if temporary tables usage is disallowed
*/
@Override
- public RelOptTableImpl getTable(final List<String> names) {
- RelOptTableImpl temporaryTable = null;
-
- if (mightBeTemporaryTable(names, session.getDefaultSchemaPath(),
drillConfig)) {
- String temporaryTableName =
session.resolveTemporaryTableName(names.get(names.size() - 1));
- if (temporaryTableName != null) {
- List<String> temporaryNames =
Lists.newArrayList(temporarySchema, temporaryTableName);
- temporaryTable = super.getTable(temporaryNames);
+ public Prepare.PreparingTable getTable(final List<String> names) {
+ String originalTableName =
session.getOriginalTableNameFromTemporaryTable(names.get(names.size() - 1));
+ if (originalTableName != null) {
+ if (!allowTemporaryTables) {
+ throw UserException
+ .validationError()
+ .message("Temporary tables usage is disallowed. Used
temporary table name: [%s].", originalTableName)
+ .build(logger);
}
}
- if (temporaryTable != null) {
- if (allowTemporaryTables) {
- return temporaryTable;
+ // Fix for select from hbase table with schema name in query
(example: "SELECT col FROM hbase.t)
+ // from hbase schema (did "USE hbase" before).
--- End diff --
This change was made before the change, where we catch and log exceptions
from `HBaseSchema.getTable()` method. So yes, it is not needed now.
---