Github user chunhui-shi commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1066#discussion_r158117382
  
    --- 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 --
    
    Could you explain why this is needed now? I think this used to work -- if a 
schema is not found under default, Drill falls back to the root to do the 
search. 
    
    What got changed thus you have to introduce this fix? 
    
    What about this test case?
    "use hbase; select t.col, t2.col2 from hbase2.t2 as t2, hbase.t as t where 
t.id = t2.id"



---

Reply via email to