tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [34/43] git commit: TAJO-1104: Using asterisk with GROUP BY causes NPE.
Date Fri, 10 Oct 2014 04:33:40 GMT
TAJO-1104: Using asterisk with GROUP BY causes NPE.

Closes #187


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/8967d113
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/8967d113
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/8967d113

Branch: refs/heads/index_support
Commit: 8967d113571fe72131433e39753e41c35abe2297
Parents: 561edf3
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Wed Oct 8 09:07:48 2014 -0700
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Wed Oct 8 09:08:48 2014 -0700

----------------------------------------------------------------------
 CHANGES                                         |  2 +
 .../engine/planner/LogicalPlanPreprocessor.java | 35 +++++---
 .../engine/planner/LogicalPlanVerifier.java     | 14 +++
 .../org/apache/tajo/master/GlobalEngine.java    |  4 +
 .../java/org/apache/tajo/QueryTestCaseBase.java | 91 ++++++++++++++++----
 .../planner/TestPreLogicalPlanVerifier.java     | 74 ----------------
 .../engine/planner/TestQueryValidation.java     | 52 +++++++++++
 .../TestQueryValidation/error_groupby_1.sql     |  1 +
 .../TestQueryValidation/error_groupby_2.sql     |  1 +
 .../TestQueryValidation/invalid_casewhen_1.sql  | 15 ++++
 .../TestQueryValidation/invalid_limit_1.sql     |  1 +
 .../TestQueryValidation/valid_groupby_1.sql     |  1 +
 .../TestQueryValidation/valid_limit_1.sql       |  1 +
 13 files changed, 190 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 8196cfe..cc2b8b8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -163,6 +163,8 @@ Release 0.9.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1104: Using asterisk with GROUP BY causes NPE. (hyunsik)
+
     TAJO-1099: LogicalPlanner::convertDataType causes NPE in some cases.
     (hyunsik)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanPreprocessor.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanPreprocessor.java
b/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanPreprocessor.java
index 5897ba6..9338979 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanPreprocessor.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanPreprocessor.java
@@ -148,8 +148,8 @@ public class LogicalPlanPreprocessor extends BaseAlgebraVisitor<LogicalPlanner.P
     return newTargetExprs;
   }
 
-  private static boolean hasAsterisk(Projection projection) {
-    for (NamedExpr eachTarget : projection.getNamedExprs()) {
+  private static boolean hasAsterisk(NamedExpr [] namedExprs) {
+    for (NamedExpr eachTarget : namedExprs) {
       if (eachTarget.getExpr().getType() == OpType.Asterisk) {
         return true;
       }
@@ -157,6 +157,20 @@ public class LogicalPlanPreprocessor extends BaseAlgebraVisitor<LogicalPlanner.P
     return false;
   }
 
+  private static NamedExpr [] voidResolveAsteriskNamedExpr(LogicalPlanner.PlanContext context,
+                                                           NamedExpr [] namedExprs) throws
PlanningException {
+    List<NamedExpr> rewrittenTargets = TUtil.newList();
+    for (NamedExpr originTarget : namedExprs) {
+      if (originTarget.getExpr().getType() == OpType.Asterisk) {
+        // rewrite targets
+        rewrittenTargets.addAll(resolveAsterisk(context, (QualifiedAsteriskExpr) originTarget.getExpr()));
+      } else {
+        rewrittenTargets.add(originTarget);
+      }
+    }
+    return rewrittenTargets.toArray(new NamedExpr[rewrittenTargets.size()]);
+  }
+
   @Override
   public LogicalNode visitProjection(LogicalPlanner.PlanContext ctx, Stack<Expr> stack,
Projection expr)
       throws PlanningException {
@@ -171,17 +185,8 @@ public class LogicalPlanPreprocessor extends BaseAlgebraVisitor<LogicalPlanner.P
     LogicalNode child = visit(ctx, stack, expr.getChild());
 
     // Resolve the asterisk expression
-    if (hasAsterisk(expr)) {
-      List<NamedExpr> rewrittenTargets = TUtil.newList();
-      for (NamedExpr originTarget : expr.getNamedExprs()) {
-        if (originTarget.getExpr().getType() == OpType.Asterisk) {
-          // rewrite targets
-          rewrittenTargets.addAll(resolveAsterisk(ctx, (QualifiedAsteriskExpr) originTarget.getExpr()));
-        } else {
-          rewrittenTargets.add(originTarget);
-        }
-      }
-      expr.setNamedExprs(rewrittenTargets.toArray(new NamedExpr[rewrittenTargets.size()]));
+    if (hasAsterisk(expr.getNamedExprs())) {
+      expr.setNamedExprs(voidResolveAsteriskNamedExpr(ctx, expr.getNamedExprs()));
     }
 
     NamedExpr[] projectTargetExprs = expr.getNamedExprs();
@@ -278,6 +283,10 @@ public class LogicalPlanPreprocessor extends BaseAlgebraVisitor<LogicalPlanner.P
     int finalTargetNum = projection.getNamedExprs().length;
     Target [] targets = new Target[finalTargetNum];
 
+    if (hasAsterisk(projection.getNamedExprs())) {
+      projection.setNamedExprs(voidResolveAsteriskNamedExpr(ctx, projection.getNamedExprs()));
+    }
+
     for (int i = 0; i < finalTargetNum; i++) {
       NamedExpr namedExpr = projection.getNamedExprs()[i];
       EvalNode evalNode = annotator.createEvalNode(ctx, namedExpr.getExpr(), NameResolvingMode.SUBEXPRS_AND_RELS);

http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanVerifier.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanVerifier.java
b/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanVerifier.java
index 6512ae0..c9932fa 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanVerifier.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanVerifier.java
@@ -184,6 +184,20 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri
   }
 
   @Override
+  public LogicalNode visitTableSubQuery(Context context, LogicalPlan plan, LogicalPlan.QueryBlock
block,
+                                   TableSubQueryNode node, Stack<LogicalNode> stack)
throws PlanningException {
+    super.visitTableSubQuery(context, plan, block, node, stack);
+    if (node.hasTargets()) {
+      for (Target target : node.getTargets()) {
+        ExprsVerifier.verify(context.state, node, target.getEvalTree());
+      }
+    }
+
+    verifyProjectableOutputSchema(node);
+    return node;
+  }
+
+  @Override
   public LogicalNode visitScan(Context context, LogicalPlan plan, LogicalPlan.QueryBlock
block, ScanNode node,
                                Stack<LogicalNode> stack) throws PlanningException {
     if (node.hasTargets()) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java b/tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java
index 1537c89..342f8d7 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java
@@ -137,6 +137,10 @@ public class GlobalEngine extends AbstractService {
     return optimizer;
   }
 
+  public LogicalPlanVerifier getLogicalPlanVerifier() {
+    return annotatedPlanVerifier;
+  }
+
   private QueryContext createQueryContext(Session session) {
     QueryContext newQueryContext =  new QueryContext(context.getConf(), session);
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java b/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java
index 8cd1bff..7b89587 100644
--- a/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java
+++ b/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java
@@ -34,6 +34,9 @@ import org.apache.tajo.cli.SimpleParser;
 import org.apache.tajo.client.TajoClient;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.engine.parser.SQLAnalyzer;
+import org.apache.tajo.engine.planner.*;
+import org.apache.tajo.engine.query.QueryContext;
+import org.apache.tajo.master.GlobalEngine;
 import org.apache.tajo.storage.StorageUtil;
 import org.apache.tajo.util.FileUtil;
 import org.junit.*;
@@ -125,7 +128,11 @@ public class QueryTestCaseBase {
   protected static TajoConf conf;
   protected static TajoClient client;
   protected static final CatalogService catalog;
-  protected static final SQLAnalyzer sqlParser = new SQLAnalyzer();
+  protected static final SQLAnalyzer sqlParser;
+  protected static PreLogicalPlanVerifier verifier;
+  protected static LogicalPlanner planner;
+  protected static LogicalOptimizer optimizer;
+  protected static LogicalPlanVerifier postVerifier;
 
   /** the base path of dataset directories */
   protected static final Path datasetBasePath;
@@ -145,6 +152,13 @@ public class QueryTestCaseBase {
     queryBasePath = new Path(queryBaseURL.toString());
     URL resultBaseURL = ClassLoader.getSystemResource("results");
     resultBasePath = new Path(resultBaseURL.toString());
+
+    GlobalEngine engine = testingCluster.getMaster().getContext().getGlobalEngine();
+    sqlParser = engine.getAnalyzer();
+    verifier = engine.getPreLogicalPlanVerifier();
+    planner = engine.getLogicalPlanner();
+    optimizer = engine.getLogicalOptimizer();
+    postVerifier = engine.getLogicalPlanVerifier();
   }
 
   /** It transiently contains created tables for the running test class. */
@@ -225,6 +239,52 @@ public class QueryTestCaseBase {
     return currentDatabase;
   }
 
+  private static VerificationState verify(String query) throws PlanningException {
+
+    VerificationState state = new VerificationState();
+    QueryContext context = LocalTajoTestingUtility.createDummyContext(conf);
+
+    Expr expr = sqlParser.parse(query);
+    verifier.verify(context, state, expr);
+    if (state.getErrorMessages().size() > 0) {
+      return state;
+    }
+    LogicalPlan plan = planner.createPlan(context, expr);
+    optimizer.optimize(plan);
+    postVerifier.verify(context, state, plan);
+
+    return state;
+  }
+
+  public void assertValidSQL(String fileName) throws PlanningException, IOException {
+    Path queryFilePath = getQueryFilePath(fileName);
+    String query = FileUtil.readTextFile(new File(queryFilePath.toUri()));
+    VerificationState state = verify(query);
+    if (state.getErrorMessages().size() > 0) {
+      fail(state.getErrorMessages().get(0));
+    }
+  }
+
+  public void assertInvalidSQL(String fileName) throws PlanningException, IOException {
+    Path queryFilePath = getQueryFilePath(fileName);
+    String query = FileUtil.readTextFile(new File(queryFilePath.toUri()));
+    VerificationState state = verify(query);
+    if (state.getErrorMessages().size() == 0) {
+      fail(PreLogicalPlanVerifier.class.getSimpleName() + " cannot catch any verification
error: " + query);
+    }
+  }
+
+  public void assertPlanError(String fileName) throws PlanningException, IOException {
+    Path queryFilePath = getQueryFilePath(fileName);
+    String query = FileUtil.readTextFile(new File(queryFilePath.toUri()));
+    try {
+      verify(query);
+    } catch (PlanningException e) {
+      return;
+    }
+    fail("Cannot catch any planning error from: " + query);
+  }
+
   protected ResultSet executeString(String sql) throws Exception {
     return client.executeQueryAndGetResult(sql);
   }
@@ -261,8 +321,6 @@ public class QueryTestCaseBase {
    */
   public ResultSet executeFile(String queryFileName) throws Exception {
     Path queryFilePath = getQueryFilePath(queryFileName);
-    FileSystem fs = currentQueryPath.getFileSystem(testBase.getTestingCluster().getConfiguration());
-    assertTrue(queryFilePath.toString() + " existence check", fs.exists(queryFilePath));
 
     List<ParsedResult> parsedResults = SimpleParser.parseScript(FileUtil.readTextFile(new
File(queryFilePath.toUri())));
     if (parsedResults.size() > 1) {
@@ -275,8 +333,6 @@ public class QueryTestCaseBase {
 
   public ResultSet executeJsonFile(String jsonFileName) throws Exception {
     Path queryFilePath = getQueryFilePath(jsonFileName);
-    FileSystem fs = currentQueryPath.getFileSystem(testBase.getTestingCluster().getConfiguration());
-    assertTrue(queryFilePath.toString() + " existence check", fs.exists(queryFilePath));
 
     ResultSet result = client.executeJsonQueryAndGetResult(FileUtil.readTextFile(new File(queryFilePath.toUri())));
     assertNotNull("Query succeeded test", result);
@@ -314,7 +370,6 @@ public class QueryTestCaseBase {
   public final void assertResultSet(String message, ResultSet result, String resultFileName)
throws IOException {
     FileSystem fs = currentQueryPath.getFileSystem(testBase.getTestingCluster().getConfiguration());
     Path resultFile = getResultFile(resultFileName);
-    assertTrue(resultFile.toString() + " existence check", fs.exists(resultFile));
     try {
       verifyResultText(message, result, resultFile);
     } catch (SQLException e) {
@@ -331,10 +386,7 @@ public class QueryTestCaseBase {
   }
 
   public final void assertStrings(String message, String actual, String resultFileName) throws
IOException {
-    FileSystem fs = currentQueryPath.getFileSystem(testBase.getTestingCluster().getConfiguration());
     Path resultFile = getResultFile(resultFileName);
-    assertTrue(resultFile.toString() + " existence check", fs.exists(resultFile));
-
     String expectedResult = FileUtil.readTextFile(new File(resultFile.toUri()));
     assertEquals(message, expectedResult, actual);
   }
@@ -438,16 +490,25 @@ public class QueryTestCaseBase {
     assertEquals(message, expectedResult.trim(), actualResult.trim());
   }
 
-  private Path getQueryFilePath(String fileName) {
-    return StorageUtil.concatPath(currentQueryPath, fileName);
+  private Path getQueryFilePath(String fileName) throws IOException {
+    Path queryFilePath = StorageUtil.concatPath(currentQueryPath, fileName);
+    FileSystem fs = currentQueryPath.getFileSystem(testBase.getTestingCluster().getConfiguration());
+    assertTrue(queryFilePath.toString() + " existence check", fs.exists(queryFilePath));
+    return queryFilePath;
   }
 
-  private Path getResultFile(String fileName) {
-    return StorageUtil.concatPath(currentResultPath, fileName);
+  private Path getResultFile(String fileName) throws IOException {
+    Path resultPath = StorageUtil.concatPath(currentResultPath, fileName);
+    FileSystem fs = currentResultPath.getFileSystem(testBase.getTestingCluster().getConfiguration());
+    assertTrue(resultPath.toString() + " existence check", fs.exists(resultPath));
+    return resultPath;
   }
 
-  private Path getDataSetFile(String fileName) {
-    return StorageUtil.concatPath(currentDatasetPath, fileName);
+  private Path getDataSetFile(String fileName) throws IOException {
+    Path dataFilePath = StorageUtil.concatPath(currentDatasetPath, fileName);
+    FileSystem fs = currentDatasetPath.getFileSystem(testBase.getTestingCluster().getConfiguration());
+    assertTrue(dataFilePath.toString() + " existence check", fs.exists(dataFilePath));
+    return dataFilePath;
   }
 
   public List<String> executeDDL(String ddlFileName, @Nullable String [] args) throws
Exception {

http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestPreLogicalPlanVerifier.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestPreLogicalPlanVerifier.java
b/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestPreLogicalPlanVerifier.java
deleted file mode 100644
index b009785..0000000
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestPreLogicalPlanVerifier.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Lisensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.engine.planner;
-
-import org.apache.tajo.LocalTajoTestingUtility;
-import org.apache.tajo.QueryTestCaseBase;
-import org.apache.tajo.algebra.Expr;
-import org.apache.tajo.engine.parser.SQLAnalyzer;
-import org.apache.tajo.engine.query.QueryContext;
-import org.apache.tajo.master.GlobalEngine;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import static org.junit.Assert.fail;
-
-public class TestPreLogicalPlanVerifier extends QueryTestCaseBase {
-
-  private static SQLAnalyzer analyzer;
-  private static PreLogicalPlanVerifier verifier;
-
-  @BeforeClass
-  public static void setUp() {
-    GlobalEngine engine = testingCluster.getMaster().getContext().getGlobalEngine();
-    analyzer = engine.getAnalyzer();
-    verifier = engine.getPreLogicalPlanVerifier();
-  }
-
-  public static VerificationState verify(String query) throws PlanningException {
-
-    VerificationState state = new VerificationState();
-    QueryContext context = LocalTajoTestingUtility.createDummyContext(conf);
-
-    Expr expr = analyzer.parse(query);
-    verifier.verify(context, state, expr);
-
-    return state;
-  }
-
-  public static void valid(String query) throws PlanningException {
-    VerificationState state = verify(query);
-    if (state.errorMessages.size() > 0) {
-      fail(state.getErrorMessages().get(0));
-    }
-  }
-
-  public static void invalid(String query) throws PlanningException {
-    VerificationState state = verify(query);
-    if (state.errorMessages.size() == 0) {
-      fail(PreLogicalPlanVerifier.class.getSimpleName() + " cannot catch any verification
error: " + query);
-    }
-  }
-
-  @Test
-  public void testLimitWithFieldReference() throws PlanningException {
-    valid("select * from lineitem limit 3");
-    invalid("select * from lineitem limit l_orderkey");
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestQueryValidation.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestQueryValidation.java
b/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestQueryValidation.java
new file mode 100644
index 0000000..e17b325
--- /dev/null
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestQueryValidation.java
@@ -0,0 +1,52 @@
+/*
+ * Lisensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.engine.planner;
+
+import org.apache.tajo.QueryTestCaseBase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+public class TestQueryValidation extends QueryTestCaseBase {
+  @Test
+  public void testLimitClauses() throws PlanningException, IOException {
+    // select * from lineitem limit 3;
+    assertValidSQL("valid_limit_1.sql");
+
+    // select * from lineitem limit l_orderkey;
+    assertInvalidSQL("invalid_limit_1.sql");
+  }
+
+  @Test
+  public void testGroupByClauses() throws PlanningException, IOException {
+    // select l_orderkey from lineitem group by l_orderkey;
+    assertValidSQL("valid_groupby_1.sql");
+
+    // select * from lineitem group by l_orderkey;
+    assertPlanError("error_groupby_1.sql");
+    // select l_orderkey from lineitem group by l_paerkey;
+    assertPlanError("error_groupby_2.sql");
+  }
+
+  @Test
+  public void testCaseWhenExprs() throws PlanningException, IOException {
+    // See TAJO-1098
+    assertInvalidSQL("invalid_casewhen_1.sql");
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/tajo-core/src/test/resources/queries/TestQueryValidation/error_groupby_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestQueryValidation/error_groupby_1.sql
b/tajo-core/src/test/resources/queries/TestQueryValidation/error_groupby_1.sql
new file mode 100644
index 0000000..7aa9439
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestQueryValidation/error_groupby_1.sql
@@ -0,0 +1 @@
+select * from lineitem group by l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/tajo-core/src/test/resources/queries/TestQueryValidation/error_groupby_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestQueryValidation/error_groupby_2.sql
b/tajo-core/src/test/resources/queries/TestQueryValidation/error_groupby_2.sql
new file mode 100644
index 0000000..90b31b2
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestQueryValidation/error_groupby_2.sql
@@ -0,0 +1 @@
+select l_orderkey from lineitem group by l_paerkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/tajo-core/src/test/resources/queries/TestQueryValidation/invalid_casewhen_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestQueryValidation/invalid_casewhen_1.sql
b/tajo-core/src/test/resources/queries/TestQueryValidation/invalid_casewhen_1.sql
new file mode 100644
index 0000000..57b369b
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestQueryValidation/invalid_casewhen_1.sql
@@ -0,0 +1,15 @@
+SELECT
+  CASE
+    WHEN PERIOD < 0 THEN 'N/A'
+    WHEN PERIOD <= INTERVAL '12h' THEN 'C0'
+    WHEN PERIOD <= INTERVAL '24h' THEN 'C1'
+    WHEN PERIOD <= INTERVAL '48h' THEN 'C2'
+    ELSE 'XX'
+  END AS P
+FROM (
+  SELECT
+    INTERVAL '12h' as PERIOD,
+    L_ORDERKEY
+  FROM
+    LINEITEM
+) T;

http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/tajo-core/src/test/resources/queries/TestQueryValidation/invalid_limit_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestQueryValidation/invalid_limit_1.sql
b/tajo-core/src/test/resources/queries/TestQueryValidation/invalid_limit_1.sql
new file mode 100644
index 0000000..65c72b1
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestQueryValidation/invalid_limit_1.sql
@@ -0,0 +1 @@
+select * from lineitem limit l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/tajo-core/src/test/resources/queries/TestQueryValidation/valid_groupby_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestQueryValidation/valid_groupby_1.sql
b/tajo-core/src/test/resources/queries/TestQueryValidation/valid_groupby_1.sql
new file mode 100644
index 0000000..90c2371
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestQueryValidation/valid_groupby_1.sql
@@ -0,0 +1 @@
+select l_orderkey from lineitem group by l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/8967d113/tajo-core/src/test/resources/queries/TestQueryValidation/valid_limit_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestQueryValidation/valid_limit_1.sql b/tajo-core/src/test/resources/queries/TestQueryValidation/valid_limit_1.sql
new file mode 100644
index 0000000..79cf804
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestQueryValidation/valid_limit_1.sql
@@ -0,0 +1 @@
+select * from lineitem limit 3;
\ No newline at end of file


Mime
View raw message