http://git-wip-us.apache.org/repos/asf/tajo/blob/4841c656/tajo-plan/src/main/java/org/apache/tajo/plan/serder/LogicalNodeSerializer.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/serder/LogicalNodeSerializer.java b/tajo-plan/src/main/java/org/apache/tajo/plan/serder/LogicalNodeSerializer.java index 76370a9..0207932 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/serder/LogicalNodeSerializer.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/serder/LogicalNodeSerializer.java @@ -22,9 +22,10 @@ import com.google.common.collect.Maps; import org.apache.hadoop.fs.Path; import org.apache.tajo.algebra.JoinType; import org.apache.tajo.catalog.proto.CatalogProtos; +import org.apache.tajo.exception.TajoException; +import org.apache.tajo.exception.TajoInternalError; import org.apache.tajo.exception.UnimplementedException; import org.apache.tajo.plan.LogicalPlan; -import org.apache.tajo.plan.PlanningException; import org.apache.tajo.plan.Target; import org.apache.tajo.plan.logical.*; import org.apache.tajo.plan.serder.PlanProto.AlterTableNode.AddColumn; @@ -68,8 +69,8 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe SerializeContext context = new SerializeContext(); try { instance.visit(context, null, null, node, new Stack<LogicalNode>()); - } catch (PlanningException e) { - throw new RuntimeException(e); + } catch (TajoException e) { + throw new TajoInternalError(e); } return context.treeBuilder.build(); } @@ -105,7 +106,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe } public LogicalNode visitRoot(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - LogicalRootNode root, Stack<LogicalNode> stack) throws PlanningException { + LogicalRootNode root, Stack<LogicalNode> stack) throws TajoException { super.visitRoot(context, plan, block, root, stack); int [] childIds = registerGetChildIds(context, root); @@ -122,7 +123,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe @Override public LogicalNode visitSetSession(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - SetSessionNode node, Stack<LogicalNode> stack) throws PlanningException { + SetSessionNode node, Stack<LogicalNode> stack) throws TajoException { super.visitSetSession(context, plan, block, node, stack); PlanProto.SetSessionNode.Builder builder = PlanProto.SetSessionNode.newBuilder(); @@ -139,7 +140,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe } public LogicalNode visitEvalExpr(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - EvalExprNode exprEval, Stack<LogicalNode> stack) throws PlanningException { + EvalExprNode exprEval, Stack<LogicalNode> stack) throws TajoException { PlanProto.EvalExprNode.Builder exprEvalBuilder = PlanProto.EvalExprNode.newBuilder(); exprEvalBuilder.addAllTargets( ProtoUtil.<PlanProto.Target>toProtoObjects(exprEval.getTargets())); @@ -152,7 +153,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe } public LogicalNode visitProjection(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - ProjectionNode projection, Stack<LogicalNode> stack) throws PlanningException { + ProjectionNode projection, Stack<LogicalNode> stack) throws TajoException { super.visitProjection(context, plan, block, projection, stack); int [] childIds = registerGetChildIds(context, projection); @@ -172,7 +173,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe @Override public LogicalNode visitLimit(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - LimitNode limit, Stack<LogicalNode> stack) throws PlanningException { + LimitNode limit, Stack<LogicalNode> stack) throws TajoException { super.visitLimit(context, plan, block, limit, stack); int [] childIds = registerGetChildIds(context, limit); @@ -189,7 +190,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe } public LogicalNode visitWindowAgg(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - WindowAggNode windowAgg, Stack<LogicalNode> stack) throws PlanningException { + WindowAggNode windowAgg, Stack<LogicalNode> stack) throws TajoException { super.visitWindowAgg(context, plan, block, windowAgg, stack); int [] childIds = registerGetChildIds(context, windowAgg); @@ -226,7 +227,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe @Override public LogicalNode visitSort(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - SortNode sort, Stack<LogicalNode> stack) throws PlanningException { + SortNode sort, Stack<LogicalNode> stack) throws TajoException { super.visitSort(context, plan, block, sort, stack); int [] childIds = registerGetChildIds(context, sort); @@ -246,7 +247,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe @Override public LogicalNode visitHaving(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - HavingNode having, Stack<LogicalNode> stack) throws PlanningException { + HavingNode having, Stack<LogicalNode> stack) throws TajoException { super.visitHaving(context, plan, block, having, stack); int [] childIds = registerGetChildIds(context, having); @@ -263,7 +264,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe } public LogicalNode visitGroupBy(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - GroupbyNode node, Stack<LogicalNode> stack) throws PlanningException { + GroupbyNode node, Stack<LogicalNode> stack) throws TajoException { super.visitGroupBy(context, plan, block, node, new Stack<LogicalNode>()); PlanProto.LogicalNode.Builder nodeBuilder = buildGroupby(context, node); @@ -272,7 +273,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe } private PlanProto.LogicalNode.Builder buildGroupby(SerializeContext context, GroupbyNode node) - throws PlanningException { + throws TajoException { int [] childIds = registerGetChildIds(context, node); PlanProto.GroupbyNode.Builder groupbyBuilder = PlanProto.GroupbyNode.newBuilder(); @@ -298,7 +299,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe } public LogicalNode visitDistinctGroupby(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - DistinctGroupbyNode node, Stack<LogicalNode> stack) throws PlanningException { + DistinctGroupbyNode node, Stack<LogicalNode> stack) throws TajoException { super.visitDistinctGroupby(context, plan, block, node, new Stack<LogicalNode>()); int [] childIds = registerGetChildIds(context, node); @@ -337,7 +338,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe @Override public LogicalNode visitFilter(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - SelectionNode filter, Stack<LogicalNode> stack) throws PlanningException { + SelectionNode filter, Stack<LogicalNode> stack) throws TajoException { super.visitFilter(context, plan, block, filter, stack); int [] childIds = registerGetChildIds(context, filter); @@ -354,7 +355,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe } public LogicalNode visitJoin(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, JoinNode join, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { super.visitJoin(context, plan, block, join, stack); int [] childIds = registerGetChildIds(context, join); @@ -384,7 +385,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe @Override public LogicalNode visitUnion(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, UnionNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { super.visitUnion(context, plan, block, node, stack); int [] childIds = registerGetChildIds(context, node); @@ -403,7 +404,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe @Override public LogicalNode visitScan(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - ScanNode scan, Stack<LogicalNode> stack) throws PlanningException { + ScanNode scan, Stack<LogicalNode> stack) throws TajoException { PlanProto.ScanNode.Builder scanBuilder = buildScanNode(scan); @@ -439,7 +440,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe @Override public LogicalNode visitPartitionedTableScan(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, PartitionedTableScanNode node, Stack<LogicalNode> stack) - throws PlanningException { + throws TajoException { PlanProto.ScanNode.Builder scanBuilder = buildScanNode(node); @@ -461,7 +462,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe } public LogicalNode visitTableSubQuery(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - TableSubQueryNode node, Stack<LogicalNode> stack) throws PlanningException { + TableSubQueryNode node, Stack<LogicalNode> stack) throws TajoException { super.visitTableSubQuery(context, plan, block, node, stack); int [] childIds = registerGetChildIds(context, node); @@ -483,7 +484,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe } public LogicalNode visitCreateTable(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - CreateTableNode node, Stack<LogicalNode> stack) throws PlanningException { + CreateTableNode node, Stack<LogicalNode> stack) throws TajoException { super.visitCreateTable(context, plan, block, node, stack); int [] childIds = registerGetChildIds(context, node); @@ -523,7 +524,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe @Override public LogicalNode visitAlterTablespace(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - AlterTablespaceNode node, Stack<LogicalNode> stack) throws PlanningException { + AlterTablespaceNode node, Stack<LogicalNode> stack) throws TajoException { PlanProto.AlterTablespaceNode.Builder alterTablespaceBuilder = PlanProto.AlterTablespaceNode.newBuilder(); alterTablespaceBuilder.setTableSpaceName(node.getTablespaceName()); @@ -611,7 +612,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe @Override public LogicalNode visitTruncateTable(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - TruncateTableNode node, Stack<LogicalNode> stack) throws PlanningException { + TruncateTableNode node, Stack<LogicalNode> stack) throws TajoException { PlanProto.TruncateTableNode.Builder truncateTableBuilder = PlanProto.TruncateTableNode.newBuilder(); truncateTableBuilder.addAllTableNames(node.getTableNames()); @@ -623,7 +624,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe } public LogicalNode visitInsert(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - InsertNode node, Stack<LogicalNode> stack) throws PlanningException { + InsertNode node, Stack<LogicalNode> stack) throws TajoException { super.visitInsert(context, plan, block, node, stack); int [] childIds = registerGetChildIds(context, node); @@ -684,7 +685,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe @Override public LogicalNode visitCreateDatabase(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - CreateDatabaseNode node, Stack<LogicalNode> stack) throws PlanningException { + CreateDatabaseNode node, Stack<LogicalNode> stack) throws TajoException { PlanProto.CreateDatabaseNode.Builder createDatabaseBuilder = PlanProto.CreateDatabaseNode.newBuilder(); createDatabaseBuilder.setDbName(node.getDatabaseName()); createDatabaseBuilder.setIfNotExists(node.isIfNotExists()); @@ -698,7 +699,7 @@ public class LogicalNodeSerializer extends BasicLogicalPlanVisitor<LogicalNodeSe @Override public LogicalNode visitDropDatabase(SerializeContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, - DropDatabaseNode node, Stack<LogicalNode> stack) throws PlanningException { + DropDatabaseNode node, Stack<LogicalNode> stack) throws TajoException { PlanProto.DropDatabaseNode.Builder dropDatabaseBuilder = PlanProto.DropDatabaseNode.newBuilder(); dropDatabaseBuilder.setDbName(node.getDatabaseName()); dropDatabaseBuilder.setIfExists(node.isIfExists());
http://git-wip-us.apache.org/repos/asf/tajo/blob/4841c656/tajo-plan/src/main/java/org/apache/tajo/plan/util/ExprFinder.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/util/ExprFinder.java b/tajo-plan/src/main/java/org/apache/tajo/plan/util/ExprFinder.java index 6800582..bc9ec28 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/util/ExprFinder.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/util/ExprFinder.java @@ -22,6 +22,8 @@ import org.apache.tajo.algebra.BinaryOperator; import org.apache.tajo.algebra.Expr; import org.apache.tajo.algebra.OpType; import org.apache.tajo.algebra.UnaryOperator; +import org.apache.tajo.exception.TajoException; +import org.apache.tajo.exception.TajoInternalError; import org.apache.tajo.plan.PlanningException; import org.apache.tajo.plan.visitor.SimpleAlgebraVisitor; @@ -47,14 +49,14 @@ public class ExprFinder extends SimpleAlgebraVisitor<ExprFinder.Context, Object> stack.push(expr); try { finder.visit(context, new Stack<Expr>(), expr); - } catch (PlanningException e) { - throw new RuntimeException(e); + } catch (TajoException e) { + throw new TajoInternalError(e); } stack.pop(); return (Set<T>) context.set; } - public Object visit(Context ctx, Stack<Expr> stack, Expr expr) throws PlanningException { + public Object visit(Context ctx, Stack<Expr> stack, Expr expr) throws TajoException { if (expr instanceof UnaryOperator) { preHook(ctx, stack, expr); visitUnaryOperator(ctx, stack, (UnaryOperator) expr); http://git-wip-us.apache.org/repos/asf/tajo/blob/4841c656/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java b/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java index 1aee05f..9c34826 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java @@ -25,6 +25,8 @@ import org.apache.tajo.algebra.*; import org.apache.tajo.annotation.Nullable; import org.apache.tajo.catalog.*; import org.apache.tajo.common.TajoDataTypes.DataType; +import org.apache.tajo.exception.TajoException; +import org.apache.tajo.exception.TajoInternalError; import org.apache.tajo.plan.InvalidQueryException; import org.apache.tajo.plan.LogicalPlan; import org.apache.tajo.plan.PlanningException; @@ -214,7 +216,7 @@ public class PlannerUtil { return tableNames; } - public static String getTopRelationInLineage(LogicalPlan plan, LogicalNode from) throws PlanningException { + public static String getTopRelationInLineage(LogicalPlan plan, LogicalNode from) throws TajoException { RelationFinderVisitor visitor = new RelationFinderVisitor(true); visitor.visit(null, plan, null, from, new Stack<LogicalNode>()); if (visitor.getFoundRelations().isEmpty()) { @@ -224,20 +226,6 @@ public class PlannerUtil { } } - /** - * Get all RelationNodes which are descendant of a given LogicalNode. - * The finding is restricted within a query block. - * - * @param from The LogicalNode to start visiting LogicalNodes. - * @return an array of all descendant RelationNode of LogicalNode. - */ - public static Collection<String> getRelationLineageWithinQueryBlock(LogicalPlan plan, LogicalNode from) - throws PlanningException { - RelationFinderVisitor visitor = new RelationFinderVisitor(false); - visitor.visit(null, plan, null, from, new Stack<LogicalNode>()); - return visitor.getFoundRelations(); - } - public static class RelationFinderVisitor extends BasicLogicalPlanVisitor<Object, LogicalNode> { private Set<String> foundRelNameSet = Sets.newHashSet(); private boolean topOnly = false; @@ -252,7 +240,7 @@ public class PlannerUtil { @Override public LogicalNode visit(Object context, LogicalPlan plan, @Nullable LogicalPlan.QueryBlock block, LogicalNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { if (topOnly && foundRelNameSet.size() > 0) { return node; } @@ -307,8 +295,8 @@ public class PlannerUtil { LogicalNodeReplaceVisitor replacer = new LogicalNodeReplaceVisitor(oldNode, newNode); try { replacer.visit(new ReplacerContext(), plan, null, startNode, new Stack<LogicalNode>()); - } catch (PlanningException e) { - e.printStackTrace(); + } catch (TajoException e) { + throw new TajoInternalError(e); } } @@ -334,7 +322,7 @@ public class PlannerUtil { @Override public LogicalNode visit(ReplacerContext context, LogicalPlan plan, @Nullable LogicalPlan.QueryBlock block, - LogicalNode node, Stack<LogicalNode> stack) throws PlanningException { + LogicalNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode left = null; LogicalNode right = null; @@ -389,15 +377,13 @@ public class PlannerUtil { @Override public LogicalNode visitScan(ReplacerContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, ScanNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return node; } @Override public LogicalNode visitPartitionedTableScan(ReplacerContext context, LogicalPlan plan, LogicalPlan. - QueryBlock block, PartitionedTableScanNode node, Stack<LogicalNode> stack) - - throws PlanningException { + QueryBlock block, PartitionedTableScanNode node, Stack<LogicalNode> stack) { return node; } } @@ -779,14 +765,14 @@ public class PlannerUtil { return joinType == JoinType.LEFT_OUTER || joinType == JoinType.RIGHT_OUTER || joinType==JoinType.FULL_OUTER; } - public static boolean existsAggregationFunction(Expr expr) throws PlanningException { + public static boolean existsAggregationFunction(Expr expr) throws TajoException { AggregationFunctionFinder finder = new AggregationFunctionFinder(); AggFunctionFoundResult result = new AggFunctionFoundResult(); finder.visit(result, new Stack<Expr>(), expr); return result.generalSetFunction; } - public static boolean existsDistinctAggregationFunction(Expr expr) throws PlanningException { + public static boolean existsDistinctAggregationFunction(Expr expr) throws TajoException { AggregationFunctionFinder finder = new AggregationFunctionFinder(); AggFunctionFoundResult result = new AggFunctionFoundResult(); finder.visit(result, new Stack<Expr>(), expr); @@ -801,14 +787,14 @@ public class PlannerUtil { static class AggregationFunctionFinder extends SimpleAlgebraVisitor<AggFunctionFoundResult, Object> { @Override public Object visitCountRowsFunction(AggFunctionFoundResult ctx, Stack<Expr> stack, CountRowsFunctionExpr expr) - throws PlanningException { + throws TajoException { ctx.generalSetFunction = true; return super.visitCountRowsFunction(ctx, stack, expr); } @Override public Object visitGeneralSetFunction(AggFunctionFoundResult ctx, Stack<Expr> stack, GeneralSetFunctionExpr expr) - throws PlanningException { + throws TajoException { ctx.generalSetFunction = true; ctx.distinctSetFunction = expr.isDistinct(); return super.visitGeneralSetFunction(ctx, stack, expr); @@ -844,8 +830,8 @@ public class PlannerUtil { explains.append( ExplainLogicalPlanVisitor.printDepthString(explainContext.getMaxDepth(), explainContext.explains.pop())); } - } catch (PlanningException e) { - throw new RuntimeException(e); + } catch (TajoException e) { + throw new TajoInternalError(e); } return explains.toString(); http://git-wip-us.apache.org/repos/asf/tajo/blob/4841c656/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/ExprsVerifier.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/ExprsVerifier.java b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/ExprsVerifier.java index 212fa9e..eaf8775 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/ExprsVerifier.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/ExprsVerifier.java @@ -47,8 +47,7 @@ public class ExprsVerifier extends BasicEvalNodeVisitor<VerificationState, EvalN instance = new ExprsVerifier(); } - public static VerificationState verify(VerificationState state, LogicalNode currentNode, EvalNode expression) - throws PlanningException { + public static VerificationState verify(VerificationState state, LogicalNode currentNode, EvalNode expression) { instance.visitChild(state, expression, new Stack<EvalNode>()); Set<Column> referredColumns = EvalTreeUtil.findUniqueColumns(expression); for (Column referredColumn : referredColumns) { http://git-wip-us.apache.org/repos/asf/tajo/blob/4841c656/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/LogicalPlanVerifier.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/LogicalPlanVerifier.java b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/LogicalPlanVerifier.java index c6062e9..f249def 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/LogicalPlanVerifier.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/LogicalPlanVerifier.java @@ -27,19 +27,17 @@ import org.apache.tajo.common.TajoDataTypes.Type; import org.apache.tajo.conf.TajoConf; import org.apache.tajo.error.Errors; import org.apache.tajo.exception.TajoException; +import org.apache.tajo.exception.TajoInternalError; import org.apache.tajo.exception.UnsupportedException; import org.apache.tajo.plan.LogicalPlan; -import org.apache.tajo.plan.util.PlannerUtil; -import org.apache.tajo.plan.PlanningException; import org.apache.tajo.plan.Target; import org.apache.tajo.plan.logical.*; +import org.apache.tajo.plan.util.PlannerUtil; import org.apache.tajo.plan.visitor.BasicLogicalPlanVisitor; import java.util.Stack; -import static org.apache.tajo.plan.verifier.SyntaxErrorUtil.makeDataTypeMisMatch; -import static org.apache.tajo.plan.verifier.SyntaxErrorUtil.makeSetOpDataTypeMisMatch; -import static org.apache.tajo.plan.verifier.SyntaxErrorUtil.makeSyntaxError; +import static org.apache.tajo.plan.verifier.SyntaxErrorUtil.*; public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVerifier.Context, LogicalNode> { public LogicalPlanVerifier(TajoConf conf, CatalogService catalog) { @@ -54,7 +52,7 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri } public VerificationState verify(OverridableConf queryContext, VerificationState state, LogicalPlan plan) - throws PlanningException { + throws TajoException { Context context = new Context(queryContext, state); visit(context, plan, plan.getRootBlock()); return context.state; @@ -63,13 +61,13 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri /** * It checks if an output schema of a projectable node and target's output data types are equivalent to each other. */ - private static void verifyProjectableOutputSchema(Context context, Projectable node) throws PlanningException { + private static void verifyProjectableOutputSchema(Context context, Projectable node) throws TajoException { Schema outputSchema = node.getOutSchema(); Schema targetSchema = PlannerUtil.targetToSchema(node.getTargets()); if (outputSchema.size() != node.getTargets().length) { - throw new PlanningException(String.format("Output schema and Target's schema are mismatched at Node (%d)", + throw new TajoInternalError(String.format("Output schema and Target's schema are mismatched at Node (%d)", + node.getPID())); } @@ -83,14 +81,14 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri if (!outputColumn.getDataType().equals(targetSchema.getColumn(i).getDataType())) { Column targetColumn = targetSchema.getColumn(i); Column insertColumn = outputColumn; - throw new PlanningException(SyntaxErrorUtil.makeDataTypeMisMatch(insertColumn, targetColumn)); + throw new TajoInternalError(SyntaxErrorUtil.makeDataTypeMisMatch(insertColumn, targetColumn)); } } } @Override public LogicalNode visitProjection(Context state, LogicalPlan plan, LogicalPlan.QueryBlock block, - ProjectionNode node, Stack<LogicalNode> stack) throws PlanningException { + ProjectionNode node, Stack<LogicalNode> stack) throws TajoException { super.visitProjection(state, plan, block, node, stack); for (Target target : node.getTargets()) { @@ -104,7 +102,7 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri @Override public LogicalNode visitLimit(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - LimitNode node, Stack<LogicalNode> stack) throws PlanningException { + LimitNode node, Stack<LogicalNode> stack) throws TajoException { super.visitLimit(context, plan, block, node, stack); if (node.getFetchFirstNum() < 0) { @@ -116,7 +114,7 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri @Override public LogicalNode visitGroupBy(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - GroupbyNode node, Stack<LogicalNode> stack) throws PlanningException { + GroupbyNode node, Stack<LogicalNode> stack) throws TajoException { super.visitGroupBy(context, plan, block, node, stack); verifyProjectableOutputSchema(context, node); @@ -125,7 +123,7 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri @Override public LogicalNode visitFilter(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - SelectionNode node, Stack<LogicalNode> stack) throws PlanningException { + SelectionNode node, Stack<LogicalNode> stack) throws TajoException { visit(context, plan, block, node.getChild(), stack); ExprsVerifier.verify(context.state, node, node.getQual()); return node; @@ -133,7 +131,7 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri @Override public LogicalNode visitJoin(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, JoinNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { visit(context, plan, block, node.getLeftChild(), stack); visit(context, plan, block, node.getRightChild(), stack); @@ -172,7 +170,7 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri @Override public LogicalNode visitUnion(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - UnionNode node, Stack<LogicalNode> stack) throws PlanningException { + UnionNode node, Stack<LogicalNode> stack) throws TajoException { super.visitUnion(context, plan, block, node, stack); verifySetStatement(context.state, node); return node; @@ -180,7 +178,7 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri @Override public LogicalNode visitExcept(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - ExceptNode node, Stack<LogicalNode> stack) throws PlanningException { + ExceptNode node, Stack<LogicalNode> stack) throws TajoException { super.visitExcept(context, plan, block, node, stack); verifySetStatement(context.state, node); return node; @@ -188,7 +186,7 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri @Override public LogicalNode visitIntersect(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - IntersectNode node, Stack<LogicalNode> stack) throws PlanningException { + IntersectNode node, Stack<LogicalNode> stack) throws TajoException { super.visitIntersect(context, plan, block, node, stack); verifySetStatement(context.state, node); return node; @@ -196,7 +194,7 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri @Override public LogicalNode visitTableSubQuery(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - TableSubQueryNode node, Stack<LogicalNode> stack) throws PlanningException { + TableSubQueryNode node, Stack<LogicalNode> stack) throws TajoException { super.visitTableSubQuery(context, plan, block, node, stack); if (node.hasTargets()) { for (Target target : node.getTargets()) { @@ -210,7 +208,7 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri @Override public LogicalNode visitScan(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, ScanNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { if (node.hasTargets()) { for (Target target : node.getTargets()) { ExprsVerifier.verify(context.state, node, target.getEvalTree()); @@ -228,14 +226,14 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri @Override public LogicalNode visitStoreTable(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - StoreTableNode node, Stack<LogicalNode> stack) throws PlanningException { + StoreTableNode node, Stack<LogicalNode> stack) throws TajoException { super.visitStoreTable(context, plan, block, node, stack); return node; } @Override public LogicalNode visitInsert(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - InsertNode node, Stack<LogicalNode> stack) throws PlanningException { + InsertNode node, Stack<LogicalNode> stack) throws TajoException { super.visitInsert(context, plan, block, node, stack); return node; } @@ -244,7 +242,7 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri * This ensures that corresponding columns in both tables are equivalent to each other. */ private static void ensureDomains(VerificationState state, Schema targetTableScheme, Schema schema) - throws PlanningException { + throws TajoException { for (int i = 0; i < schema.size(); i++) { if (!schema.getColumn(i).getDataType().equals(targetTableScheme.getColumn(i).getDataType())) { Column targetColumn = targetTableScheme.getColumn(i); @@ -256,7 +254,7 @@ public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVeri @Override public LogicalNode visitCreateTable(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - CreateTableNode node, Stack<LogicalNode> stack) throws PlanningException { + CreateTableNode node, Stack<LogicalNode> stack) throws TajoException { super.visitCreateTable(context, plan, block, node, stack); // here, we don't need check table existence because this check is performed in PreLogicalPlanVerifier. return node; http://git-wip-us.apache.org/repos/asf/tajo/blob/4841c656/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/PreLogicalPlanVerifier.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/PreLogicalPlanVerifier.java b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/PreLogicalPlanVerifier.java index 6330268..cfdb005 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/PreLogicalPlanVerifier.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/PreLogicalPlanVerifier.java @@ -26,12 +26,16 @@ import org.apache.tajo.algebra.*; import org.apache.tajo.catalog.CatalogService; import org.apache.tajo.catalog.CatalogUtil; import org.apache.tajo.catalog.TableDesc; -import org.apache.tajo.catalog.exception.*; +import org.apache.tajo.catalog.exception.CatalogExceptionUtil; +import org.apache.tajo.catalog.exception.DuplicateDatabaseException; +import org.apache.tajo.catalog.exception.UndefinedDatabaseException; +import org.apache.tajo.catalog.exception.UndefinedTableException; import org.apache.tajo.exception.ExceptionUtil; -import org.apache.tajo.exception.UnimplementedException; -import org.apache.tajo.plan.util.ExprFinder; +import org.apache.tajo.exception.TajoException; +import org.apache.tajo.exception.TajoInternalError; import org.apache.tajo.plan.PlanningException; import org.apache.tajo.plan.algebra.BaseAlgebraVisitor; +import org.apache.tajo.plan.util.ExprFinder; import org.apache.tajo.util.TUtil; import org.apache.tajo.validation.ConstraintViolation; @@ -60,14 +64,14 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor<PreLogicalPlanVer } public VerificationState verify(OverridableConf queryContext, VerificationState state, Expr expr) - throws PlanningException { + throws TajoException { Context context = new Context(queryContext, state); visit(context, new Stack<Expr>(), expr); return context.state; } @Override - public Expr visitSetSession(Context ctx, Stack<Expr> stack, SetSession expr) throws PlanningException { + public Expr visitSetSession(Context ctx, Stack<Expr> stack, SetSession expr) throws TajoException { // we should allow undefined session variables which can be used in query statements in the future. if (SessionVars.exists(expr.getName())) { @@ -84,7 +88,7 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor<PreLogicalPlanVer return expr; } - public Expr visitProjection(Context context, Stack<Expr> stack, Projection expr) throws PlanningException { + public Expr visitProjection(Context context, Stack<Expr> stack, Projection expr) throws TajoException { super.visitProjection(context, stack, expr); Set<String> names = TUtil.newHashSet(); @@ -103,7 +107,7 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor<PreLogicalPlanVer } @Override - public Expr visitLimit(Context context, Stack<Expr> stack, Limit expr) throws PlanningException { + public Expr visitLimit(Context context, Stack<Expr> stack, Limit expr) throws TajoException { stack.push(expr); if (ExprFinder.finds(expr.getFetchFirstNum(), OpType.Column).size() > 0) { @@ -117,7 +121,7 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor<PreLogicalPlanVer } @Override - public Expr visitGroupBy(Context context, Stack<Expr> stack, Aggregation expr) throws PlanningException { + public Expr visitGroupBy(Context context, Stack<Expr> stack, Aggregation expr) throws TajoException { super.visitGroupBy(context, stack, expr); // Enforcer only ordinary grouping set. @@ -136,14 +140,14 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor<PreLogicalPlanVer } if (projection == null) { - throw new PlanningException("No Projection"); + throw new TajoInternalError("No Projection"); } return expr; } @Override - public Expr visitRelation(Context context, Stack<Expr> stack, Relation expr) throws PlanningException { + public Expr visitRelation(Context context, Stack<Expr> stack, Relation expr) throws TajoException { assertRelationExistence(context, expr.getName()); return expr; } @@ -215,7 +219,7 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor<PreLogicalPlanVer @Override public Expr visitCreateDatabase(Context context, Stack<Expr> stack, CreateDatabase expr) - throws PlanningException { + throws TajoException { super.visitCreateDatabase(context, stack, expr); if (!expr.isIfNotExists()) { assertDatabaseNoExistence(context.state, expr.getDatabaseName()); @@ -224,7 +228,7 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor<PreLogicalPlanVer } @Override - public Expr visitDropDatabase(Context context, Stack<Expr> stack, DropDatabase expr) throws PlanningException { + public Expr visitDropDatabase(Context context, Stack<Expr> stack, DropDatabase expr) throws TajoException { super.visitDropDatabase(context, stack, expr); if (!expr.isIfExists()) { assertDatabaseExistence(context.state, expr.getDatabaseName()); @@ -233,7 +237,7 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor<PreLogicalPlanVer } @Override - public Expr visitCreateTable(Context context, Stack<Expr> stack, CreateTable expr) throws PlanningException { + public Expr visitCreateTable(Context context, Stack<Expr> stack, CreateTable expr) throws TajoException { super.visitCreateTable(context, stack, expr); if (!expr.isIfNotExists()) { assertRelationNoExistence(context, expr.getTableName()); @@ -245,7 +249,7 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor<PreLogicalPlanVer } @Override - public Expr visitDropTable(Context context, Stack<Expr> stack, DropTable expr) throws PlanningException { + public Expr visitDropTable(Context context, Stack<Expr> stack, DropTable expr) throws TajoException { super.visitDropTable(context, stack, expr); if (!expr.isIfExists()) { assertRelationExistence(context, expr.getTableName()); @@ -257,7 +261,7 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor<PreLogicalPlanVer // Insert or Update Section /////////////////////////////////////////////////////////////////////////////////////////////////////////// - public Expr visitInsert(Context context, Stack<Expr> stack, Insert expr) throws PlanningException { + public Expr visitInsert(Context context, Stack<Expr> stack, Insert expr) throws TajoException { Expr child = super.visitInsert(context, stack, expr); if (expr.hasTableName()) { http://git-wip-us.apache.org/repos/asf/tajo/blob/4841c656/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/BasicLogicalPlanVisitor.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/BasicLogicalPlanVisitor.java b/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/BasicLogicalPlanVisitor.java index 90ff1dc..ebb5c80 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/BasicLogicalPlanVisitor.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/BasicLogicalPlanVisitor.java @@ -18,6 +18,8 @@ package org.apache.tajo.plan.visitor; +import org.apache.tajo.exception.TajoException; +import org.apache.tajo.exception.TajoInternalError; import org.apache.tajo.plan.LogicalPlan; import org.apache.tajo.plan.PlanningException; import org.apache.tajo.plan.logical.*; @@ -31,7 +33,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi */ @SuppressWarnings("unused") public void preHook(LogicalPlan plan, LogicalNode node, Stack<LogicalNode> stack, CONTEXT data) - throws PlanningException { + throws TajoException { } /** @@ -39,11 +41,11 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi */ @SuppressWarnings("unused") public void postHook(LogicalPlan plan, LogicalNode node, Stack<LogicalNode> stack, CONTEXT data) - throws PlanningException { + throws TajoException { } public CONTEXT visit(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block) - throws PlanningException { + throws TajoException { visit(context, plan, block, block.getRoot(), new Stack<LogicalNode>()); return context; } @@ -53,7 +55,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi */ public RESULT visit(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, LogicalNode node, Stack<LogicalNode> stack) - throws PlanningException { + throws TajoException { preHook(plan, node, stack, context); RESULT current; switch (node.getType()) { @@ -139,7 +141,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi current = visitTruncateTable(context, plan, block, (TruncateTableNode) node, stack); break; default: - throw new PlanningException("Unknown logical node type: " + node.getType()); + throw new TajoInternalError("Unknown logical node type: " + node.getType()); } postHook(plan, node, stack, context); @@ -148,7 +150,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitRoot(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, LogicalRootNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); @@ -157,20 +159,20 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitSetSession(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, SetSessionNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return null; } @Override public RESULT visitEvalExpr(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, EvalExprNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return null; } @Override public RESULT visitProjection(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, ProjectionNode node, Stack<LogicalNode> stack) - throws PlanningException { + throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); @@ -179,7 +181,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitLimit(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, LimitNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); @@ -188,7 +190,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitSort(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, SortNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); @@ -197,7 +199,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitHaving(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, HavingNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); @@ -206,7 +208,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitGroupBy(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, GroupbyNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); @@ -215,7 +217,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitWindowAgg(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, WindowAggNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); @@ -223,7 +225,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi } public RESULT visitDistinctGroupby(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, - DistinctGroupbyNode node, Stack<LogicalNode> stack) throws PlanningException { + DistinctGroupbyNode node, Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); @@ -232,7 +234,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitFilter(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, SelectionNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); @@ -241,7 +243,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitJoin(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, JoinNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getLeftChild(), stack); visit(context, plan, block, node.getRightChild(), stack); @@ -251,7 +253,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitUnion(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, UnionNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = null; if (plan != null) { @@ -270,7 +272,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitExcept(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, ExceptNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getLeftChild(), stack); visit(context, plan, block, node.getRightChild(), stack); @@ -280,7 +282,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitIntersect(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, IntersectNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getLeftChild(), stack); visit(context, plan, block, node.getRightChild(), stack); @@ -290,7 +292,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitTableSubQuery(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, - TableSubQueryNode node, Stack<LogicalNode> stack) throws PlanningException { + TableSubQueryNode node, Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = null; if (plan != null) { @@ -305,20 +307,20 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitScan(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, ScanNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return null; } @Override public RESULT visitPartitionedTableScan(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, PartitionedTableScanNode node, Stack<LogicalNode> stack) - throws PlanningException { + throws TajoException { return null; } @Override public RESULT visitStoreTable(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, StoreTableNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); @@ -327,7 +329,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitInsert(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, InsertNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); @@ -336,18 +338,19 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitCreateDatabase(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, - CreateDatabaseNode node, Stack<LogicalNode> stack) throws PlanningException { + CreateDatabaseNode node, Stack<LogicalNode> stack) throws TajoException { return null; } @Override - public RESULT visitDropDatabase(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, DropDatabaseNode node, Stack<LogicalNode> stack) throws PlanningException { + public RESULT visitDropDatabase(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, + DropDatabaseNode node, Stack<LogicalNode> stack) throws TajoException { return null; } @Override public RESULT visitCreateTable(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, CreateTableNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { RESULT result = null; stack.push(node); if (node.hasSubQuery()) { @@ -365,7 +368,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitAlterTablespace(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, - AlterTablespaceNode node, Stack<LogicalNode> stack) throws PlanningException { + AlterTablespaceNode node, Stack<LogicalNode> stack) throws TajoException { return null; } @@ -377,7 +380,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi @Override public RESULT visitTruncateTable(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, - TruncateTableNode node, Stack<LogicalNode> stack) throws PlanningException { + TruncateTableNode node, Stack<LogicalNode> stack) throws TajoException { return null; } } http://git-wip-us.apache.org/repos/asf/tajo/blob/4841c656/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/ExplainLogicalPlanVisitor.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/ExplainLogicalPlanVisitor.java b/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/ExplainLogicalPlanVisitor.java index 52db8eb..925742a 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/ExplainLogicalPlanVisitor.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/ExplainLogicalPlanVisitor.java @@ -19,6 +19,7 @@ package org.apache.tajo.plan.visitor; import org.apache.tajo.annotation.Nullable; +import org.apache.tajo.exception.TajoException; import org.apache.tajo.plan.LogicalPlan; import org.apache.tajo.plan.PlanString; import org.apache.tajo.plan.PlanningException; @@ -68,7 +69,7 @@ public class ExplainLogicalPlanVisitor extends BasicLogicalPlanVisitor<ExplainLo } } - public Context getBlockPlanStrings(@Nullable LogicalPlan plan, LogicalNode node) throws PlanningException { + public Context getBlockPlanStrings(@Nullable LogicalPlan plan, LogicalNode node) throws TajoException { Stack<LogicalNode> stack = new Stack<LogicalNode>(); Context explainContext = new Context(); visit(explainContext, plan, null, node, stack); @@ -77,54 +78,54 @@ public class ExplainLogicalPlanVisitor extends BasicLogicalPlanVisitor<ExplainLo @Override public LogicalNode visitRoot(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, LogicalRootNode node, Stack<LogicalNode> stack) - throws PlanningException { + throws TajoException { return visit(context, plan, block, node.getChild(), stack); } @Override public LogicalNode visitProjection(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, ProjectionNode node, Stack<LogicalNode> stack) - throws PlanningException { + throws TajoException { return visitUnaryNode(context, plan, block, node, stack); } @Override public LogicalNode visitLimit(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - LimitNode node, Stack<LogicalNode> stack) throws PlanningException { + LimitNode node, Stack<LogicalNode> stack) throws TajoException { return visitUnaryNode(context, plan, block, node, stack); } @Override public LogicalNode visitSort(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, SortNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return visitUnaryNode(context, plan, block, node, stack); } public LogicalNode visitHaving(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, HavingNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return visitUnaryNode(context, plan, block, node, stack); } @Override public LogicalNode visitGroupBy(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, GroupbyNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return visitUnaryNode(context, plan, block, node, stack); } @Override public LogicalNode visitWindowAgg(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, WindowAggNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return visitUnaryNode(context, plan, block, node, stack); } public LogicalNode visitDistinctGroupby(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, DistinctGroupbyNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return visitUnaryNode(context, plan, block, node, stack); } private LogicalNode visitUnaryNode(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - UnaryNode node, Stack<LogicalNode> stack) throws PlanningException { + UnaryNode node, Stack<LogicalNode> stack) throws TajoException { context.depth++; stack.push(node); visit(context, plan, block, node.getChild(), stack); @@ -135,7 +136,7 @@ public class ExplainLogicalPlanVisitor extends BasicLogicalPlanVisitor<ExplainLo private LogicalNode visitBinaryNode(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, BinaryNode node, Stack<LogicalNode> stack) - throws PlanningException { + throws TajoException { context.depth++; stack.push(node); visit(context, plan, block, node.getLeftChild(), stack); @@ -148,37 +149,37 @@ public class ExplainLogicalPlanVisitor extends BasicLogicalPlanVisitor<ExplainLo @Override public LogicalNode visitFilter(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, SelectionNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return visitUnaryNode(context, plan, block, node, stack); } @Override public LogicalNode visitJoin(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, JoinNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return visitBinaryNode(context, plan, block, node, stack); } @Override public LogicalNode visitUnion(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, UnionNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return visitBinaryNode(context, plan, block, node, stack); } @Override public LogicalNode visitExcept(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, ExceptNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return visitBinaryNode(context, plan, block, node, stack); } @Override public LogicalNode visitIntersect(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, IntersectNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { return visitBinaryNode(context, plan, block, node, stack); } @Override public LogicalNode visitTableSubQuery(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - TableSubQueryNode node, Stack<LogicalNode> stack) throws PlanningException { + TableSubQueryNode node, Stack<LogicalNode> stack) throws TajoException { context.depth++; stack.push(node); visit(context, plan, block, node.getSubQuery(), new Stack<LogicalNode>()); @@ -191,7 +192,7 @@ public class ExplainLogicalPlanVisitor extends BasicLogicalPlanVisitor<ExplainLo @Override public LogicalNode visitScan(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, ScanNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { context.add(context.depth, node.getPlanString()); return node; } @@ -199,32 +200,32 @@ public class ExplainLogicalPlanVisitor extends BasicLogicalPlanVisitor<ExplainLo @Override public LogicalNode visitPartitionedTableScan(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, PartitionedTableScanNode node, Stack<LogicalNode> stack) - throws PlanningException { + throws TajoException { context.add(context.depth, node.getPlanString()); return node; } @Override public LogicalNode visitStoreTable(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - StoreTableNode node, Stack<LogicalNode> stack) throws PlanningException { + StoreTableNode node, Stack<LogicalNode> stack) throws TajoException { return visitUnaryNode(context, plan, block, node, stack); } public LogicalNode visitCreateDatabase(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - CreateDatabaseNode node, Stack<LogicalNode> stack) throws PlanningException { + CreateDatabaseNode node, Stack<LogicalNode> stack) throws TajoException { context.add(context.depth, node.getPlanString()); return node; } public LogicalNode visitDropDatabase(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, - DropDatabaseNode node, Stack<LogicalNode> stack) throws PlanningException { + DropDatabaseNode node, Stack<LogicalNode> stack) throws TajoException { context.add(context.depth, node.getPlanString()); return node; } @Override public LogicalNode visitInsert(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, InsertNode node, - Stack<LogicalNode> stack) throws PlanningException { + Stack<LogicalNode> stack) throws TajoException { context.depth++; stack.push(node); super.visitInsert(context, plan, block, node, stack); http://git-wip-us.apache.org/repos/asf/tajo/blob/4841c656/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/LogicalPlanVisitor.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/LogicalPlanVisitor.java b/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/LogicalPlanVisitor.java index 5be2eec..dd832ae 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/LogicalPlanVisitor.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/LogicalPlanVisitor.java @@ -18,6 +18,7 @@ package org.apache.tajo.plan.visitor; +import org.apache.tajo.exception.TajoException; import org.apache.tajo.plan.LogicalPlan; import org.apache.tajo.plan.PlanningException; import org.apache.tajo.plan.logical.*; @@ -27,81 +28,81 @@ import java.util.Stack; public interface LogicalPlanVisitor<CONTEXT, RESULT> { RESULT visitRoot(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, LogicalRootNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitSetSession(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, SetSessionNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitEvalExpr(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, EvalExprNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitProjection(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, ProjectionNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitLimit(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, LimitNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitSort(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, SortNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitHaving(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, HavingNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitGroupBy(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, GroupbyNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitWindowAgg(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, WindowAggNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitDistinctGroupby(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, DistinctGroupbyNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitFilter(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, SelectionNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitJoin(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, JoinNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitUnion(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, UnionNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitExcept(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, ExceptNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitIntersect(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, IntersectNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitTableSubQuery(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, TableSubQueryNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitScan(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, ScanNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitPartitionedTableScan(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, - PartitionedTableScanNode node, Stack<LogicalNode> stack) throws PlanningException; + PartitionedTableScanNode node, Stack<LogicalNode> stack) throws TajoException; RESULT visitStoreTable(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, StoreTableNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitInsert(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, InsertNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitCreateDatabase(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, CreateDatabaseNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitDropDatabase(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, DropDatabaseNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitCreateTable(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, CreateTableNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitDropTable(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, DropTableNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitAlterTablespace(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, AlterTablespaceNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitAlterTable(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, AlterTableNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; RESULT visitTruncateTable(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, TruncateTableNode node, - Stack<LogicalNode> stack) throws PlanningException; + Stack<LogicalNode> stack) throws TajoException; } http://git-wip-us.apache.org/repos/asf/tajo/blob/4841c656/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/SimpleAlgebraVisitor.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/SimpleAlgebraVisitor.java b/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/SimpleAlgebraVisitor.java index ad4ef18..989af88 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/SimpleAlgebraVisitor.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/SimpleAlgebraVisitor.java @@ -19,6 +19,7 @@ package org.apache.tajo.plan.visitor; import org.apache.tajo.algebra.*; +import org.apache.tajo.exception.TajoException; import org.apache.tajo.plan.PlanningException; import org.apache.tajo.plan.algebra.BaseAlgebraVisitor; @@ -29,7 +30,7 @@ import java.util.Stack; */ public abstract class SimpleAlgebraVisitor<CONTEXT, RESULT> extends BaseAlgebraVisitor<CONTEXT, RESULT> { - public RESULT visit(CONTEXT ctx, Stack<Expr> stack, Expr expr) throws PlanningException { + public RESULT visit(CONTEXT ctx, Stack<Expr> stack, Expr expr) throws TajoException { RESULT result = null; if (expr instanceof UnaryOperator) { preHook(ctx, stack, expr); @@ -46,14 +47,14 @@ public abstract class SimpleAlgebraVisitor<CONTEXT, RESULT> extends BaseAlgebraV return result; } - public RESULT visitUnaryOperator(CONTEXT ctx, Stack<Expr> stack, UnaryOperator expr) throws PlanningException { + public RESULT visitUnaryOperator(CONTEXT ctx, Stack<Expr> stack, UnaryOperator expr) throws TajoException { stack.push(expr); RESULT result = visit(ctx, stack, expr.getChild()); stack.pop(); return result; } - public RESULT visitBinaryOperator(CONTEXT ctx, Stack<Expr> stack, BinaryOperator expr) throws PlanningException { + public RESULT visitBinaryOperator(CONTEXT ctx, Stack<Expr> stack, BinaryOperator expr) throws TajoException { stack.push(expr); visit(ctx, stack, expr.getLeft()); RESULT result = visit(ctx, stack, expr.getRight()); @@ -66,46 +67,46 @@ public abstract class SimpleAlgebraVisitor<CONTEXT, RESULT> extends BaseAlgebraV /////////////////////////////////////////////////////////////////////////////////////////////////////////// @Override - public RESULT visitProjection(CONTEXT ctx, Stack<Expr> stack, Projection expr) throws PlanningException { + public RESULT visitProjection(CONTEXT ctx, Stack<Expr> stack, Projection expr) throws TajoException { return super.visitProjection(ctx, stack, expr); } @Override - public RESULT visitLimit(CONTEXT ctx, Stack<Expr> stack, Limit expr) throws PlanningException { + public RESULT visitLimit(CONTEXT ctx, Stack<Expr> stack, Limit expr) throws TajoException { return super.visitLimit(ctx, stack, expr); } @Override - public RESULT visitSort(CONTEXT ctx, Stack<Expr> stack, Sort expr) throws PlanningException { + public RESULT visitSort(CONTEXT ctx, Stack<Expr> stack, Sort expr) throws TajoException { return super.visitSort(ctx, stack, expr); } @Override - public RESULT visitHaving(CONTEXT ctx, Stack<Expr> stack, Having expr) throws PlanningException { + public RESULT visitHaving(CONTEXT ctx, Stack<Expr> stack, Having expr) throws TajoException { return super.visitHaving(ctx, stack, expr); } @Override - public RESULT visitGroupBy(CONTEXT ctx, Stack<Expr> stack, Aggregation expr) throws PlanningException { + public RESULT visitGroupBy(CONTEXT ctx, Stack<Expr> stack, Aggregation expr) throws TajoException { return super.visitGroupBy(ctx, stack, expr); } - public RESULT visitFilter(CONTEXT ctx, Stack<Expr> stack, Selection expr) throws PlanningException { + public RESULT visitFilter(CONTEXT ctx, Stack<Expr> stack, Selection expr) throws TajoException { return super.visitFilter(ctx, stack, expr); } @Override - public RESULT visitJoin(CONTEXT ctx, Stack<Expr> stack, Join expr) throws PlanningException { + public RESULT visitJoin(CONTEXT ctx, Stack<Expr> stack, Join expr) throws TajoException { return super.visitJoin(ctx, stack, expr); } @Override - public RESULT visitTableSubQuery(CONTEXT ctx, Stack<Expr> stack, TablePrimarySubQuery expr) throws PlanningException { + public RESULT visitTableSubQuery(CONTEXT ctx, Stack<Expr> stack, TablePrimarySubQuery expr) throws TajoException { return super.visitTableSubQuery(ctx, stack, expr); } @Override - public RESULT visitRelationList(CONTEXT ctx, Stack<Expr> stack, RelationList expr) throws PlanningException { + public RESULT visitRelationList(CONTEXT ctx, Stack<Expr> stack, RelationList expr) throws TajoException { return super.visitRelationList(ctx, stack, expr); } @@ -114,17 +115,17 @@ public abstract class SimpleAlgebraVisitor<CONTEXT, RESULT> extends BaseAlgebraV /////////////////////////////////////////////////////////////////////////////////////////////////////////// @Override - public RESULT visitCreateTable(CONTEXT ctx, Stack<Expr> stack, CreateTable expr) throws PlanningException { + public RESULT visitCreateTable(CONTEXT ctx, Stack<Expr> stack, CreateTable expr) throws TajoException { return super.visitCreateTable(ctx, stack, expr); } @Override - public RESULT visitDropTable(CONTEXT ctx, Stack<Expr> stack, DropTable expr) throws PlanningException { + public RESULT visitDropTable(CONTEXT ctx, Stack<Expr> stack, DropTable expr) throws TajoException { return super.visitDropTable(ctx, stack, expr); } @Override - public RESULT visitAlterTable(CONTEXT ctx, Stack<Expr> stack, AlterTable expr) throws PlanningException { + public RESULT visitAlterTable(CONTEXT ctx, Stack<Expr> stack, AlterTable expr) throws TajoException { return super.visitAlterTable(ctx, stack, expr); } @@ -132,7 +133,7 @@ public abstract class SimpleAlgebraVisitor<CONTEXT, RESULT> extends BaseAlgebraV // Insert or Update Section /////////////////////////////////////////////////////////////////////////////////////////////////////////// @Override - public RESULT visitInsert(CONTEXT ctx, Stack<Expr> stack, Insert expr) throws PlanningException { + public RESULT visitInsert(CONTEXT ctx, Stack<Expr> stack, Insert expr) throws TajoException { return super.visitInsert(ctx, stack, expr); } @@ -142,17 +143,17 @@ public abstract class SimpleAlgebraVisitor<CONTEXT, RESULT> extends BaseAlgebraV /////////////////////////////////////////////////////////////////////////////////////////////////////////// @Override - public RESULT visitBetween(CONTEXT ctx, Stack<Expr> stack, BetweenPredicate expr) throws PlanningException { + public RESULT visitBetween(CONTEXT ctx, Stack<Expr> stack, BetweenPredicate expr) throws TajoException { return super.visitBetween(ctx, stack, expr); } @Override - public RESULT visitCaseWhen(CONTEXT ctx, Stack<Expr> stack, CaseWhenPredicate expr) throws PlanningException { + public RESULT visitCaseWhen(CONTEXT ctx, Stack<Expr> stack, CaseWhenPredicate expr) throws TajoException { return super.visitCaseWhen(ctx, stack, expr); } @Override - public RESULT visitValueListExpr(CONTEXT ctx, Stack<Expr> stack, ValueListExpr expr) throws PlanningException { + public RESULT visitValueListExpr(CONTEXT ctx, Stack<Expr> stack, ValueListExpr expr) throws TajoException { return super.visitValueListExpr(ctx, stack, expr); } @@ -160,24 +161,24 @@ public abstract class SimpleAlgebraVisitor<CONTEXT, RESULT> extends BaseAlgebraV // Functions and General Set Function Section /////////////////////////////////////////////////////////////////////////////////////////////////////////// @Override - public RESULT visitFunction(CONTEXT ctx, Stack<Expr> stack, FunctionExpr expr) throws PlanningException { + public RESULT visitFunction(CONTEXT ctx, Stack<Expr> stack, FunctionExpr expr) throws TajoException { return super.visitFunction(ctx, stack, expr); } @Override public RESULT visitCountRowsFunction(CONTEXT ctx, Stack<Expr> stack, CountRowsFunctionExpr expr) - throws PlanningException { + throws TajoException { return super.visitCountRowsFunction(ctx, stack, expr); } @Override public RESULT visitGeneralSetFunction(CONTEXT ctx, Stack<Expr> stack, GeneralSetFunctionExpr expr) - throws PlanningException { + throws TajoException { return super.visitGeneralSetFunction(ctx, stack, expr); } @Override - public RESULT visitWindowFunction(CONTEXT ctx, Stack<Expr> stack, WindowFunctionExpr expr) throws PlanningException { + public RESULT visitWindowFunction(CONTEXT ctx, Stack<Expr> stack, WindowFunctionExpr expr) throws TajoException { return super.visitWindowFunction(ctx, stack, expr); } @@ -186,27 +187,27 @@ public abstract class SimpleAlgebraVisitor<CONTEXT, RESULT> extends BaseAlgebraV /////////////////////////////////////////////////////////////////////////////////////////////////////////// @Override - public RESULT visitDataType(CONTEXT ctx, Stack<Expr> stack, DataTypeExpr expr) throws PlanningException { + public RESULT visitDataType(CONTEXT ctx, Stack<Expr> stack, DataTypeExpr expr) throws TajoException { return super.visitDataType(ctx, stack, expr); } @Override - public RESULT visitLiteral(CONTEXT ctx, Stack<Expr> stack, LiteralValue expr) throws PlanningException { + public RESULT visitLiteral(CONTEXT ctx, Stack<Expr> stack, LiteralValue expr) throws TajoException { return super.visitLiteral(ctx, stack, expr); } @Override - public RESULT visitNullLiteral(CONTEXT ctx, Stack<Expr> stack, NullLiteral expr) throws PlanningException { + public RESULT visitNullLiteral(CONTEXT ctx, Stack<Expr> stack, NullLiteral expr) throws TajoException { return super.visitNullLiteral(ctx, stack, expr); } @Override - public RESULT visitTimestampLiteral(CONTEXT ctx, Stack<Expr> stack, TimestampLiteral expr) throws PlanningException { + public RESULT visitTimestampLiteral(CONTEXT ctx, Stack<Expr> stack, TimestampLiteral expr) throws TajoException { return super.visitTimestampLiteral(ctx, stack, expr); } @Override - public RESULT visitTimeLiteral(CONTEXT ctx, Stack<Expr> stack, TimeLiteral expr) throws PlanningException { + public RESULT visitTimeLiteral(CONTEXT ctx, Stack<Expr> stack, TimeLiteral expr) throws TajoException { return super.visitTimeLiteral(ctx, stack, expr); } } http://git-wip-us.apache.org/repos/asf/tajo/blob/4841c656/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java ---------------------------------------------------------------------- diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java index 52e223d..f8883b0 100644 --- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java +++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java @@ -18,11 +18,9 @@ package org.apache.tajo.storage; -import com.google.common.base.Optional; import org.apache.hadoop.fs.Path; import org.apache.tajo.ExecutionBlockId; import org.apache.tajo.OverridableConf; -import org.apache.tajo.QueryVars; import org.apache.tajo.TaskAttemptId; import org.apache.tajo.catalog.Schema; import org.apache.tajo.catalog.SortSpec; @@ -30,9 +28,9 @@ import org.apache.tajo.catalog.TableDesc; import org.apache.tajo.catalog.TableMeta; import org.apache.tajo.catalog.proto.CatalogProtos.FragmentProto; import org.apache.tajo.conf.TajoConf; +import org.apache.tajo.exception.TajoException; import org.apache.tajo.exception.UnsupportedException; import org.apache.tajo.plan.LogicalPlan; -import org.apache.tajo.plan.PlanningException; import org.apache.tajo.plan.logical.LogicalNode; import org.apache.tajo.plan.logical.ScanNode; import org.apache.tajo.storage.fragment.Fragment; @@ -338,7 +336,7 @@ public abstract class Tablespace { /** * Rewrite the logical plan. It is assumed that the final plan will be given in this method. */ - public void rewritePlan(OverridableConf context, LogicalPlan plan) throws PlanningException { + public void rewritePlan(OverridableConf context, LogicalPlan plan) throws TajoException { // nothing to do by default } http://git-wip-us.apache.org/repos/asf/tajo/blob/4841c656/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java ---------------------------------------------------------------------- diff --git a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java b/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java index 18bb7ed..00cac77 100644 --- a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java +++ b/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java @@ -42,8 +42,8 @@ import org.apache.tajo.common.TajoDataTypes.Type; import org.apache.tajo.conf.TajoConf; import org.apache.tajo.datum.Datum; import org.apache.tajo.datum.TextDatum; +import org.apache.tajo.exception.TajoException; import org.apache.tajo.plan.LogicalPlan; -import org.apache.tajo.plan.PlanningException; import org.apache.tajo.plan.expr.*; import org.apache.tajo.plan.logical.CreateTableNode; import org.apache.tajo.plan.logical.LogicalNode; @@ -1090,7 +1090,7 @@ public class HBaseTablespace extends Tablespace { } @Override - public void rewritePlan(OverridableConf context, LogicalPlan plan) throws PlanningException { + public void rewritePlan(OverridableConf context, LogicalPlan plan) throws TajoException { if (REWRITE_RULE.isEligible(context, plan)) { REWRITE_RULE.rewrite(context, plan); }
