diff options
author | Igor Guzenko <ihor.huzenko.igs@gmail.com> | 2018-10-12 12:02:43 +0300 |
---|---|---|
committer | Gautam Parai <gparai@apache.org> | 2019-01-03 16:35:30 -0800 |
commit | 7a25d9d86b9324dc4c3121a51e3d964bdb7b0284 (patch) | |
tree | c6633c2534d973feb45f48b8ec748d49d4cf3219 /exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillViewTable.java | |
parent | e65079a5d6f9b4e54783bef9f3af64a0684af3f0 (diff) |
DRILL-540: Allow querying hive views in Drill
1. Added DrillHiveViewTable which allows construction of DrillViewTable based
on Hive metadata
2. Added initialization of DrillHiveViewTable in HiveSchemaFactory
3. Extracted conversion of Hive data types from DrillHiveTable
to HiveToRelDataTypeConverter
4. Removed throwing of UnsupportedOperationException from HiveStoragePlugin
5. Added TestHiveViewsSupport and authorization tests
6. Added closeSilently() method to AutoCloseables
closes #1559
Diffstat (limited to 'exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillViewTable.java')
-rw-r--r-- | exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillViewTable.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillViewTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillViewTable.java index 2eb9137ef..a90a135f8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillViewTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillViewTable.java @@ -17,6 +17,9 @@ */ package org.apache.drill.exec.planner.logical; +import java.util.List; + +import org.apache.calcite.schema.SchemaPlus; import org.apache.drill.shaded.guava.com.google.common.collect.ImmutableList; import org.apache.calcite.config.CalciteConnectionConfig; import org.apache.calcite.schema.Schema.TableType; @@ -67,7 +70,7 @@ public class DrillViewTable implements TranslatableTable, DrillViewInfoProvider if (viewExpansionContext.isImpersonationEnabled()) { token = viewExpansionContext.reserveViewExpansionToken(viewOwner); - rel = context.expandView(rowType, view.getSql(), token.getSchemaTree(), view.getWorkspaceSchemaPath()).rel; + rel = expandViewForImpersonatedUser(context, rowType, view.getWorkspaceSchemaPath(), token.getSchemaTree()); } else { rel = context.expandView(rowType, view.getSql(), view.getWorkspaceSchemaPath(), ImmutableList.<String>of()).rel; } @@ -85,6 +88,14 @@ public class DrillViewTable implements TranslatableTable, DrillViewInfoProvider } } + + protected RelNode expandViewForImpersonatedUser(ToRelContext context, + RelDataType rowType, + List<String> workspaceSchemaPath, + SchemaPlus tokenSchemaTree) { + return context.expandView(rowType, view.getSql(), tokenSchemaTree, workspaceSchemaPath).rel; + } + @Override public TableType getJdbcTableType() { return TableType.VIEW; @@ -104,4 +115,5 @@ public class DrillViewTable implements TranslatableTable, DrillViewInfoProvider @Override public boolean isRolledUp(String column) { return false; } + } |