DRILL-985: Referencing a view via its filename
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/23ee6522 Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/23ee6522 Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/23ee6522 Branch: refs/heads/master Commit: 23ee6522881ffabb53a9bb48e946bcbefe534a5c Parents: 0a28365 Author: Hsuan-Yi Chu <[email protected]> Authored: Tue Nov 4 14:27:28 2014 -0800 Committer: Steven Phillips <[email protected]> Committed: Mon Nov 24 19:26:21 2014 -0800 ---------------------------------------------------------------------- .../java/org/apache/drill/exec/dotdrill/DotDrillUtil.java | 10 ++++++---- .../test/java/org/apache/drill/TestExampleQueries.java | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/23ee6522/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillUtil.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillUtil.java index ea60fae..63b22e9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillUtil.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillUtil.java @@ -53,9 +53,11 @@ public class DotDrillUtil { return getDrillFiles(fs, fs.getUnderlying().globStatus(new Path(root, "*.drill")), types); } - public static List<DotDrillFile> getDotDrills(DrillFileSystem fs, Path root, String name, DotDrillType... types) throws IOException{ - return getDrillFiles(fs, fs.getUnderlying().globStatus(new Path(root, name + DotDrillType.DOT_DRILL_GLOB)), types); - } - + public static List<DotDrillFile> getDotDrills(DrillFileSystem fs, Path root, String name, DotDrillType... types) throws IOException{ + if(!name.endsWith(".drill")) { + name = name + DotDrillType.DOT_DRILL_GLOB; + } + return getDrillFiles(fs, fs.getUnderlying().globStatus(new Path(root, name)), types); + } } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/23ee6522/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java b/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java index bb411e7..b9d9a27 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java +++ b/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java @@ -27,6 +27,14 @@ import org.junit.Test; public class TestExampleQueries extends BaseTestQuery{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestExampleQueries.class); + @Test // see DRILL-985 + public void testViewFileName() throws Exception { + test("use dfs.tmp"); + test("create view nation_view as select * from cp.`tpch/nation.parquet`;"); + test("select * from dfs.tmp.`nation_view.view.drill`"); + test("drop view nation_view"); + } + @Test public void testParquetComplex() throws Exception { test("select recipe from cp.`parquet/complex.parquet`");
