tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject [28/28] git commit: TAJO-1125: Separate logical plan and optimizer into a maven module.
Date Sat, 25 Oct 2014 18:18:17 GMT
TAJO-1125: Separate logical plan and optimizer into a maven module.

Closes #210


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

Branch: refs/heads/master
Commit: b143f991242b79fa8479148cd79fad7d4f8f2146
Parents: b636e8b
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Sat Oct 25 10:54:12 2014 -0700
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Sat Oct 25 10:55:15 2014 -0700

----------------------------------------------------------------------
 CHANGES                                         |    3 +
 pom.xml                                         |    1 +
 .../org/apache/tajo/catalog/CatalogService.java |  184 --
 .../org/apache/tajo/catalog/CatalogService.java |  184 ++
 .../org/apache/tajo/catalog/CatalogUtil.java    |   29 +
 .../apache/tajo/storage/StorageConstants.java   |   70 +
 .../java/org/apache/tajo/storage/Tuple.java     |   75 +
 .../java/org/apache/tajo/storage/VTuple.java    |  233 ++
 .../apache/tajo/util/graph/DirectedGraph.java   |   64 +
 .../tajo/util/graph/DirectedGraphCursor.java    |   65 +
 .../tajo/util/graph/DirectedGraphVisitor.java   |   25 +
 .../java/org/apache/tajo/util/graph/Graph.java  |   45 +
 .../tajo/util/graph/SimpleDirectedGraph.java    |  270 +++
 .../tajo/util/graph/SimpleUndirectedGraph.java  |  102 +
 .../apache/tajo/util/graph/UndirectedGraph.java |   30 +
 .../util/graph/TestSimpleDirectedGraph.java     |   79 +
 .../util/graph/TestSimpleUndirectedGraph.java   |   96 +
 tajo-core/pom.xml                               |    6 +-
 .../tajo/engine/codegen/CaseWhenEmitter.java    |    8 +-
 .../engine/codegen/CaseWhenSwitchGenerator.java |    2 +-
 .../tajo/engine/codegen/CompilationError.java   |    2 +-
 .../tajo/engine/codegen/EvalCodeEmitter.java    |    2 +-
 .../tajo/engine/codegen/EvalCodeGenContext.java |    2 +-
 .../tajo/engine/codegen/EvalCodeGenerator.java  |    6 +-
 .../engine/codegen/ExecutorPreCompiler.java     |   12 +-
 .../codegen/LegacyFunctionBindingEmitter.java   |    4 +-
 .../codegen/ScalarFunctionBindingEmitter.java   |    4 +-
 .../engine/codegen/TajoGeneratorAdapter.java    |    8 +-
 .../engine/codegen/VariablesPreBuilder.java     |    2 +-
 .../eval/AggregationFunctionCallEval.java       |  123 --
 .../tajo/engine/eval/AlgebraicException.java    |   41 -
 .../apache/tajo/engine/eval/AlgebraicUtil.java  |  417 ----
 .../tajo/engine/eval/BasicEvalNodeVisitor.java  |  345 ---
 .../tajo/engine/eval/BetweenPredicateEval.java  |  268 ---
 .../org/apache/tajo/engine/eval/BinaryEval.java |  217 --
 .../apache/tajo/engine/eval/CaseWhenEval.java   |  284 ---
 .../org/apache/tajo/engine/eval/CastEval.java   |   74 -
 .../org/apache/tajo/engine/eval/ConstEval.java  |  109 -
 .../org/apache/tajo/engine/eval/EvalNode.java   |   74 -
 .../tajo/engine/eval/EvalNodeVisitor.java       |   24 -
 .../tajo/engine/eval/EvalNodeVisitor2.java      |   72 -
 .../tajo/engine/eval/EvalTreeFactory.java       |   32 -
 .../apache/tajo/engine/eval/EvalTreeUtil.java   |  520 -----
 .../org/apache/tajo/engine/eval/EvalType.java   |  172 --
 .../org/apache/tajo/engine/eval/FieldEval.java  |  129 --
 .../apache/tajo/engine/eval/FunctionEval.java   |  175 --
 .../tajo/engine/eval/GeneralFunctionEval.java   |   81 -
 .../org/apache/tajo/engine/eval/InEval.java     |   86 -
 .../tajo/engine/eval/InvalidEvalException.java  |   36 -
 .../org/apache/tajo/engine/eval/IsNullEval.java |   84 -
 .../tajo/engine/eval/LikePredicateEval.java     |   54 -
 .../org/apache/tajo/engine/eval/NotEval.java    |   56 -
 .../tajo/engine/eval/PartialBinaryExpr.java     |   73 -
 .../engine/eval/PatternMatchPredicateEval.java  |   90 -
 .../tajo/engine/eval/RegexPredicateEval.java    |   53 -
 .../tajo/engine/eval/RowConstantEval.java       |   99 -
 .../org/apache/tajo/engine/eval/SignedEval.java |   86 -
 .../engine/eval/SimilarToPredicateEval.java     |   48 -
 .../tajo/engine/eval/SimpleEvalNodeVisitor.java |  172 --
 .../org/apache/tajo/engine/eval/UnaryEval.java  |  107 -
 .../tajo/engine/eval/WindowFunctionEval.java    |  117 -
 .../exception/AmbiguousFieldException.java      |   30 -
 .../exception/IllegalQueryStatusException.java  |   38 -
 .../engine/exception/InvalidQueryException.java |   35 -
 .../engine/exception/NoSuchColumnException.java |   25 -
 .../tajo/engine/exception/VerifyException.java  |   27 -
 .../tajo/engine/function/AggFunction.java       |   59 -
 .../tajo/engine/function/FunctionContext.java   |   22 -
 .../tajo/engine/function/GeneralFunction.java   |   57 -
 .../tajo/engine/function/WindowAggFunc.java     |   62 -
 .../tajo/engine/function/builtin/AvgDouble.java |    4 +-
 .../tajo/engine/function/builtin/AvgFloat.java  |    2 +-
 .../tajo/engine/function/builtin/AvgInt.java    |    2 +-
 .../tajo/engine/function/builtin/AvgLong.java   |    4 +-
 .../tajo/engine/function/builtin/Coalesce.java  |    2 +-
 .../tajo/engine/function/builtin/CountRows.java |    4 +-
 .../engine/function/builtin/CountValue.java     |    2 +-
 .../function/builtin/CountValueDistinct.java    |    2 +-
 .../tajo/engine/function/builtin/Date.java      |    2 +-
 .../tajo/engine/function/builtin/MaxDouble.java |    4 +-
 .../tajo/engine/function/builtin/MaxFloat.java  |    4 +-
 .../tajo/engine/function/builtin/MaxInt.java    |    4 +-
 .../tajo/engine/function/builtin/MaxLong.java   |    4 +-
 .../tajo/engine/function/builtin/MaxString.java |    4 +-
 .../tajo/engine/function/builtin/MinDouble.java |    4 +-
 .../tajo/engine/function/builtin/MinFloat.java  |    4 +-
 .../tajo/engine/function/builtin/MinInt.java    |    4 +-
 .../tajo/engine/function/builtin/MinLong.java   |    4 +-
 .../tajo/engine/function/builtin/MinString.java |    4 +-
 .../tajo/engine/function/builtin/RandomInt.java |    2 +-
 .../tajo/engine/function/builtin/Sleep.java     |    2 +-
 .../tajo/engine/function/builtin/SumDouble.java |    4 +-
 .../function/builtin/SumDoubleDistinct.java     |    4 +-
 .../tajo/engine/function/builtin/SumFloat.java  |    4 +-
 .../function/builtin/SumFloatDistinct.java      |    4 +-
 .../tajo/engine/function/builtin/SumInt.java    |    4 +-
 .../engine/function/builtin/SumIntDistinct.java |    4 +-
 .../tajo/engine/function/builtin/SumLong.java   |    4 +-
 .../function/builtin/SumLongDistinct.java       |    4 +-
 .../tajo/engine/function/datetime/AddDays.java  |    2 +-
 .../engine/function/datetime/AddMonths.java     |    2 +-
 .../engine/function/datetime/CurrentDate.java   |    2 +-
 .../engine/function/datetime/CurrentTime.java   |    2 +-
 .../function/datetime/DatePartFromDate.java     |    2 +-
 .../function/datetime/DatePartFromTime.java     |    2 +-
 .../datetime/DatePartFromTimestamp.java         |    2 +-
 .../datetime/DateTimePartFromUnixTimestamp.java |    2 +-
 .../engine/function/datetime/NowTimestamp.java  |    2 +-
 .../function/datetime/ToCharTimestamp.java      |    4 +-
 .../tajo/engine/function/datetime/ToDate.java   |    2 +-
 .../function/datetime/ToTimestampInt.java       |    2 +-
 .../function/datetime/ToTimestampText.java      |    2 +-
 .../function/geoip/GeoIPCountryInet4.java       |    2 +-
 .../engine/function/geoip/GeoIPCountryText.java |    2 +-
 .../function/geoip/GeoIPInCountryInet4.java     |    2 +-
 .../function/geoip/GeoIPInCountryText.java      |    2 +-
 .../tajo/engine/function/math/AbsDouble.java    |    2 +-
 .../tajo/engine/function/math/AbsFloat.java     |    2 +-
 .../tajo/engine/function/math/AbsInt.java       |    2 +-
 .../tajo/engine/function/math/AbsLong.java      |    2 +-
 .../apache/tajo/engine/function/math/Acos.java  |    2 +-
 .../apache/tajo/engine/function/math/Asin.java  |    2 +-
 .../apache/tajo/engine/function/math/Atan.java  |    2 +-
 .../apache/tajo/engine/function/math/Atan2.java |    2 +-
 .../apache/tajo/engine/function/math/Cbrt.java  |    2 +-
 .../apache/tajo/engine/function/math/Ceil.java  |    2 +-
 .../apache/tajo/engine/function/math/Cos.java   |    2 +-
 .../tajo/engine/function/math/Degrees.java      |    2 +-
 .../apache/tajo/engine/function/math/Div.java   |    2 +-
 .../apache/tajo/engine/function/math/Exp.java   |    2 +-
 .../apache/tajo/engine/function/math/Floor.java |    2 +-
 .../apache/tajo/engine/function/math/Mod.java   |    2 +-
 .../apache/tajo/engine/function/math/Pi.java    |    2 +-
 .../apache/tajo/engine/function/math/Pow.java   |    3 +-
 .../tajo/engine/function/math/Radians.java      |    2 +-
 .../apache/tajo/engine/function/math/Round.java |    2 +-
 .../tajo/engine/function/math/RoundFloat8.java  |    2 +-
 .../apache/tajo/engine/function/math/Sign.java  |    2 +-
 .../apache/tajo/engine/function/math/Sin.java   |    2 +-
 .../apache/tajo/engine/function/math/Sqrt.java  |    2 +-
 .../apache/tajo/engine/function/math/Tan.java   |    2 +-
 .../tajo/engine/function/string/Ascii.java      |    2 +-
 .../tajo/engine/function/string/BTrim.java      |    4 +-
 .../tajo/engine/function/string/BitLength.java  |    2 +-
 .../tajo/engine/function/string/CharLength.java |    2 +-
 .../apache/tajo/engine/function/string/Chr.java |    2 +-
 .../tajo/engine/function/string/Concat.java     |    2 +-
 .../tajo/engine/function/string/Concat_ws.java  |    2 +-
 .../tajo/engine/function/string/Decode.java     |    2 +-
 .../tajo/engine/function/string/Digest.java     |    2 +-
 .../tajo/engine/function/string/Encode.java     |    2 +-
 .../tajo/engine/function/string/FindInSet.java  |    2 +-
 .../tajo/engine/function/string/InitCap.java    |    2 +-
 .../tajo/engine/function/string/LTrim.java      |    4 +-
 .../tajo/engine/function/string/Left.java       |    2 +-
 .../tajo/engine/function/string/Length.java     |    2 +-
 .../tajo/engine/function/string/Locate.java     |    2 +-
 .../tajo/engine/function/string/Lower.java      |    2 +-
 .../tajo/engine/function/string/Lpad.java       |    4 +-
 .../apache/tajo/engine/function/string/Md5.java |    2 +-
 .../engine/function/string/OctetLength.java     |    2 +-
 .../tajo/engine/function/string/QuoteIdent.java |    2 +-
 .../tajo/engine/function/string/RTrim.java      |    4 +-
 .../engine/function/string/RegexpReplace.java   |   11 +-
 .../tajo/engine/function/string/Repeat.java     |    2 +-
 .../tajo/engine/function/string/Reverse.java    |    2 +-
 .../tajo/engine/function/string/Right.java      |    2 +-
 .../tajo/engine/function/string/Rpad.java       |    4 +-
 .../tajo/engine/function/string/SplitPart.java  |    2 +-
 .../tajo/engine/function/string/StrPos.java     |    2 +-
 .../tajo/engine/function/string/StrPosb.java    |    2 +-
 .../tajo/engine/function/string/Substr.java     |    2 +-
 .../tajo/engine/function/string/ToBin.java      |    2 +-
 .../tajo/engine/function/string/ToHex.java      |    2 +-
 .../tajo/engine/function/string/Upper.java      |    2 +-
 .../tajo/engine/function/window/Rank.java       |    4 +-
 .../tajo/engine/function/window/RowNumber.java  |    4 +-
 .../apache/tajo/engine/json/CoreGsonHelper.java |   12 +-
 .../tajo/engine/json/EvalNodeAdapter.java       |   50 -
 .../tajo/engine/json/LogicalNodeAdapter.java    |   50 -
 .../eval/EvalTreeOptimizationRule.java          |   27 -
 .../optimizer/eval/EvalTreeOptimizer.java       |   78 -
 .../tajo/engine/optimizer/eval/Prioritized.java |   30 -
 .../optimizer/eval/rules/ConstantFolding.java   |   92 -
 .../eval/rules/ConstantPropagation.java         |  112 -
 .../tajo/engine/parser/SQLSyntaxError.java      |    2 +-
 .../engine/plan/EvalTreeProtoDeserializer.java  |  218 --
 .../engine/plan/EvalTreeProtoSerializer.java    |  308 ---
 .../tajo/engine/planner/AlgebraVisitor.java     |  113 -
 .../engine/planner/AlterTablespaceNode.java     |  103 -
 .../tajo/engine/planner/BaseAlgebraVisitor.java |  789 -------
 .../engine/planner/BasicLogicalPlanVisitor.java |  351 ---
 .../BroadcastJoinMarkCandidateVisitor.java      |   11 +-
 .../planner/BroadcastJoinPlanVisitor.java       |   11 +-
 .../planner/ExplainLogicalPlanVisitor.java      |  247 ---
 .../tajo/engine/planner/ExprAnnotator.java      |  935 --------
 .../apache/tajo/engine/planner/ExprFinder.java  |   74 -
 .../tajo/engine/planner/ExprNormalizer.java     |  388 ----
 .../tajo/engine/planner/ExprsVerifier.java      |  251 ---
 .../tajo/engine/planner/GroupElement.java       |   64 -
 .../tajo/engine/planner/LogicalOptimizer.java   |  311 ---
 .../apache/tajo/engine/planner/LogicalPlan.java |  682 ------
 .../engine/planner/LogicalPlanPreprocessor.java |  501 -----
 .../engine/planner/LogicalPlanVerifier.java     |  263 ---
 .../tajo/engine/planner/LogicalPlanVisitor.java |   98 -
 .../tajo/engine/planner/LogicalPlanner.java     | 2002 -----------------
 .../tajo/engine/planner/NamedExprsManager.java  |  380 ----
 .../tajo/engine/planner/PhysicalPlanner.java    |    2 +-
 .../engine/planner/PhysicalPlannerImpl.java     |    5 +-
 .../apache/tajo/engine/planner/PlanString.java  |  119 --
 .../apache/tajo/engine/planner/PlannerUtil.java |  888 --------
 .../tajo/engine/planner/PlanningException.java  |   29 -
 .../engine/planner/PreLogicalPlanVerifier.java  |  290 ---
 .../apache/tajo/engine/planner/Projector.java   |    6 +-
 .../engine/planner/SimpleAlgebraVisitor.java    |  210 --
 .../org/apache/tajo/engine/planner/Target.java  |  129 --
 .../tajo/engine/planner/TypeDeterminant.java    |  321 ---
 .../tajo/engine/planner/VerificationState.java  |   44 -
 .../tajo/engine/planner/global/DataChannel.java |    4 +-
 .../engine/planner/global/ExecutionBlock.java   |    2 +-
 .../engine/planner/global/GlobalPlanner.java    |   22 +-
 .../tajo/engine/planner/global/MasterPlan.java  |   12 +-
 .../global/builder/DistinctGroupbyBuilder.java  |   27 +-
 .../engine/planner/graph/DirectedGraph.java     |   64 -
 .../planner/graph/DirectedGraphCursor.java      |   65 -
 .../planner/graph/DirectedGraphVisitor.java     |   25 -
 .../apache/tajo/engine/planner/graph/Graph.java |   45 -
 .../planner/graph/SimpleDirectedGraph.java      |  270 ---
 .../planner/graph/SimpleUndirectedGraph.java    |  102 -
 .../engine/planner/graph/UndirectedGraph.java   |   30 -
 .../engine/planner/logical/AlterTableNode.java  |  134 --
 .../tajo/engine/planner/logical/BinaryNode.java |   77 -
 .../planner/logical/CreateDatabaseNode.java     |   87 -
 .../engine/planner/logical/CreateTableNode.java |  145 --
 .../planner/logical/DistinctGroupbyNode.java    |  253 ---
 .../planner/logical/DropDatabaseNode.java       |   85 -
 .../engine/planner/logical/DropTableNode.java   |   95 -
 .../engine/planner/logical/EvalExprNode.java    |   85 -
 .../tajo/engine/planner/logical/ExceptNode.java |   45 -
 .../engine/planner/logical/GroupbyNode.java     |  254 ---
 .../tajo/engine/planner/logical/HavingNode.java |   72 -
 .../engine/planner/logical/IndexScanNode.java   |  122 --
 .../tajo/engine/planner/logical/InsertNode.java |  182 --
 .../engine/planner/logical/IntersectNode.java   |   44 -
 .../tajo/engine/planner/logical/JoinNode.java   |  163 --
 .../tajo/engine/planner/logical/LimitNode.java  |   65 -
 .../engine/planner/logical/LogicalNode.java     |  128 --
 .../planner/logical/LogicalNodeVisitor.java     |   27 -
 .../engine/planner/logical/LogicalRootNode.java |   41 -
 .../tajo/engine/planner/logical/NodeType.java   |   69 -
 .../logical/PartitionedTableScanNode.java       |  159 --
 .../planner/logical/PersistentStoreNode.java    |   90 -
 .../engine/planner/logical/Projectable.java     |   73 -
 .../engine/planner/logical/ProjectionNode.java  |  114 -
 .../engine/planner/logical/RelationNode.java    |   49 -
 .../tajo/engine/planner/logical/ScanNode.java   |  247 ---
 .../engine/planner/logical/SelectableNode.java  |   48 -
 .../engine/planner/logical/SelectionNode.java   |   74 -
 .../planner/logical/ShuffleFileWriteNode.java   |  104 -
 .../tajo/engine/planner/logical/SortNode.java   |   94 -
 .../engine/planner/logical/StoreTableNode.java  |  100 -
 .../planner/logical/TableSubQueryNode.java      |  180 --
 .../planner/logical/TruncateTableNode.java      |   62 -
 .../tajo/engine/planner/logical/UnaryNode.java  |   69 -
 .../tajo/engine/planner/logical/UnionNode.java  |   37 -
 .../engine/planner/logical/WindowAggNode.java   |  238 ---
 .../tajo/engine/planner/logical/WindowSpec.java |  208 --
 .../tajo/engine/planner/logical/join/Edge.java  |   50 -
 .../planner/logical/join/FoundJoinOrder.java    |   47 -
 .../join/GreedyHeuristicJoinOrderAlgorithm.java |  301 ---
 .../engine/planner/logical/join/JoinEdge.java   |   75 -
 .../engine/planner/logical/join/JoinGraph.java  |  154 --
 .../logical/join/JoinOrderAlgorithm.java        |   46 -
 .../planner/nameresolver/NameResolver.java      |  291 ---
 .../planner/nameresolver/NameResolvingMode.java |   80 -
 .../planner/nameresolver/ResolverByLegacy.java  |  126 --
 .../planner/nameresolver/ResolverByRels.java    |   38 -
 .../nameresolver/ResolverByRelsAndSubExprs.java |   42 -
 .../nameresolver/ResolverBySubExprsAndRels.java |   42 -
 .../planner/physical/AggregationExec.java       |    4 +-
 .../engine/planner/physical/BNLJoinExec.java    |    6 +-
 .../planner/physical/BSTIndexScanExec.java      |    4 +-
 .../planner/physical/ColPartitionStoreExec.java |    8 +-
 .../DistinctGroupbyFirstAggregationExec.java    |    8 +-
 .../DistinctGroupbyHashAggregationExec.java     |    8 +-
 .../DistinctGroupbySecondAggregationExec.java   |   32 +-
 .../DistinctGroupbySortAggregationExec.java     |    4 +-
 .../DistinctGroupbyThirdAggregationExec.java    |   11 +-
 .../engine/planner/physical/EvalExprExec.java   |    4 +-
 .../planner/physical/ExternalSortExec.java      |    2 +-
 .../planner/physical/HashAggregateExec.java     |    4 +-
 .../HashBasedColPartitionStoreExec.java         |    2 +-
 .../planner/physical/HashFullOuterJoinExec.java |    8 +-
 .../engine/planner/physical/HashJoinExec.java   |    8 +-
 .../planner/physical/HashLeftAntiJoinExec.java  |    2 +-
 .../planner/physical/HashLeftOuterJoinExec.java |   12 +-
 .../planner/physical/HashLeftSemiJoinExec.java  |    2 +-
 .../physical/HashShuffleFileWriteExec.java      |    2 +-
 .../engine/planner/physical/HavingExec.java     |    4 +-
 .../tajo/engine/planner/physical/LimitExec.java |    2 +-
 .../engine/planner/physical/MemSortExec.java    |    2 +-
 .../physical/MergeFullOuterJoinExec.java        |    7 +-
 .../engine/planner/physical/MergeJoinExec.java  |    7 +-
 .../engine/planner/physical/NLJoinExec.java     |    4 +-
 .../planner/physical/NLLeftOuterJoinExec.java   |    4 +-
 .../physical/PartitionMergeScanExec.java        |    4 +-
 .../planner/physical/PhysicalPlanUtil.java      |  123 +-
 .../engine/planner/physical/ProjectionExec.java |    2 +-
 .../physical/RangeShuffleFileWriteExec.java     |    2 +-
 .../physical/RightOuterMergeJoinExec.java       |    7 +-
 .../engine/planner/physical/SelectionExec.java  |    4 +-
 .../engine/planner/physical/SeqScanExec.java    |   19 +-
 .../planner/physical/SortAggregateExec.java     |    4 +-
 .../SortBasedColPartitionStoreExec.java         |    2 +-
 .../engine/planner/physical/StoreTableExec.java |    4 +-
 .../tajo/engine/planner/physical/UnionExec.java |    2 +-
 .../engine/planner/physical/WindowAggExec.java  |    8 +-
 .../rewrite/BasicQueryRewriteEngine.java        |   72 -
 .../planner/rewrite/FilterPushDownRule.java     |  910 --------
 .../rewrite/PartitionedTableRewriter.java       |  361 ----
 .../planner/rewrite/ProjectionPushDownRule.java | 1145 ----------
 .../planner/rewrite/QueryRewriteEngine.java     |   32 -
 .../engine/planner/rewrite/RewriteRule.java     |   56 -
 .../apache/tajo/engine/query/QueryContext.java  |   16 +-
 .../apache/tajo/engine/utils/SchemaUtil.java    |   88 -
 .../org/apache/tajo/engine/utils/TupleUtil.java |   66 +-
 .../utils/test/ErrorInjectionRewriter.java      |    6 +-
 .../org/apache/tajo/master/GlobalEngine.java    |   24 +-
 .../master/NonForwardQueryResultScanner.java    |    7 +-
 .../apache/tajo/master/querymaster/Query.java   |    6 +-
 .../master/querymaster/QueryInProgress.java     |    2 +-
 .../master/querymaster/QueryJobManager.java     |    2 +-
 .../master/querymaster/QueryMasterTask.java     |   14 +-
 .../tajo/master/querymaster/QueryUnit.java      |    2 +-
 .../tajo/master/querymaster/Repartitioner.java  |   20 +-
 .../tajo/master/querymaster/SubQuery.java       |    7 +-
 .../java/org/apache/tajo/util/IndexUtil.java    |    8 +-
 .../worker/ExecutionBlockSharedResource.java    |    6 +-
 .../java/org/apache/tajo/worker/FetchImpl.java  |   15 +-
 .../org/apache/tajo/worker/TajoQueryEngine.java |    2 +-
 .../main/java/org/apache/tajo/worker/Task.java  |    5 +-
 .../apache/tajo/worker/TaskAttemptContext.java  |    2 +-
 tajo-core/src/main/proto/Plan.proto             |  209 --
 .../src/main/proto/TajoWorkerProtocol.proto     |   14 +-
 .../resources/webapps/worker/querytasks.jsp     |    2 +-
 .../java/org/apache/tajo/QueryTestCaseBase.java |    5 +-
 .../apache/tajo/engine/eval/ExprTestBase.java   |   14 +-
 .../apache/tajo/engine/eval/TestEvalTree.java   |    1 +
 .../tajo/engine/eval/TestEvalTreeUtil.java      |   24 +-
 .../tajo/engine/function/TestAggFunction.java   |    1 +
 .../tajo/engine/planner/TestExprAnnotator.java  |   46 -
 .../tajo/engine/planner/TestLogicalNode.java    |   74 -
 .../engine/planner/TestLogicalOptimizer.java    |   24 +-
 .../tajo/engine/planner/TestLogicalPlan.java    |   15 +-
 .../tajo/engine/planner/TestLogicalPlanner.java |   32 +-
 .../tajo/engine/planner/TestPlannerUtil.java    |   24 +-
 .../engine/planner/TestQueryValidation.java     |    1 +
 .../engine/planner/TestSimpleDirectedGraph.java |   79 -
 .../planner/TestSimpleUndirectedGraph.java      |   96 -
 .../planner/TestUniformRangePartition.java      |    1 +
 .../planner/global/TestBroadcastJoinPlan.java   |   11 +-
 .../engine/planner/global/TestMasterPlan.java   |    6 +-
 .../planner/physical/TestBNLJoinExec.java       |    9 +-
 .../planner/physical/TestBSTIndexExec.java      |   10 +-
 .../planner/physical/TestExternalSortExec.java  |    5 +-
 .../physical/TestFullOuterHashJoinExec.java     |    9 +-
 .../physical/TestFullOuterMergeJoinExec.java    |    9 +-
 .../planner/physical/TestHashAntiJoinExec.java  |    6 +-
 .../planner/physical/TestHashJoinExec.java      |    9 +-
 .../planner/physical/TestHashSemiJoinExec.java  |    6 +-
 .../physical/TestLeftOuterHashJoinExec.java     |    9 +-
 .../physical/TestLeftOuterNLJoinExec.java       |    6 +-
 .../planner/physical/TestMergeJoinExec.java     |   10 +-
 .../engine/planner/physical/TestNLJoinExec.java |    6 +-
 .../planner/physical/TestPhysicalPlanner.java   |   15 +-
 .../physical/TestProgressExternalSortExec.java  |    6 +-
 .../physical/TestRightOuterHashJoinExec.java    |    6 +-
 .../physical/TestRightOuterMergeJoinExec.java   |    9 +-
 .../engine/planner/physical/TestSortExec.java   |    4 +-
 .../tajo/engine/query/TestJoinBroadcast.java    |    2 +-
 .../tajo/engine/query/TestTablePartitions.java  |   14 +-
 .../apache/tajo/engine/util/TestTupleUtil.java  |   24 +-
 .../tajo/master/TestExecutionBlockCursor.java   |    6 +-
 .../apache/tajo/master/TestGlobalPlanner.java   |   10 +-
 .../apache/tajo/master/TestRepartitioner.java   |   13 +-
 .../tajo/master/querymaster/TestKillQuery.java  |    6 +-
 .../tajo/worker/TestRangeRetrieverHandler.java  |    6 +-
 tajo-plan/pom.xml                               |  288 +++
 .../org/apache/tajo/plan/ExprAnnotator.java     |  934 ++++++++
 .../org/apache/tajo/plan/ExprNormalizer.java    |  389 ++++
 .../tajo/plan/IllegalQueryStatusException.java  |   38 +
 .../apache/tajo/plan/InvalidQueryException.java |   35 +
 .../org/apache/tajo/plan/LogicalOptimizer.java  |  316 +++
 .../java/org/apache/tajo/plan/LogicalPlan.java  |  683 ++++++
 .../tajo/plan/LogicalPlanPreprocessor.java      |  507 +++++
 .../org/apache/tajo/plan/LogicalPlanner.java    | 2004 ++++++++++++++++++
 .../org/apache/tajo/plan/NamedExprsManager.java |  380 ++++
 .../java/org/apache/tajo/plan/PlanString.java   |  119 ++
 .../org/apache/tajo/plan/PlanningException.java |   29 +
 .../main/java/org/apache/tajo/plan/Target.java  |  130 ++
 .../org/apache/tajo/plan/TypeDeterminant.java   |  322 +++
 .../tajo/plan/algebra/AlgebraVisitor.java       |  114 +
 .../plan/algebra/AmbiguousFieldException.java   |   32 +
 .../tajo/plan/algebra/BaseAlgebraVisitor.java   |  790 +++++++
 .../apache/tajo/plan/annotator/Prioritized.java |   30 +
 .../plan/expr/AggregationFunctionCallEval.java  |  123 ++
 .../tajo/plan/expr/AlgebraicException.java      |   41 +
 .../apache/tajo/plan/expr/AlgebraicUtil.java    |  417 ++++
 .../tajo/plan/expr/BasicEvalNodeVisitor.java    |  345 +++
 .../tajo/plan/expr/BetweenPredicateEval.java    |  268 +++
 .../org/apache/tajo/plan/expr/BinaryEval.java   |  217 ++
 .../org/apache/tajo/plan/expr/CaseWhenEval.java |  284 +++
 .../org/apache/tajo/plan/expr/CastEval.java     |   74 +
 .../org/apache/tajo/plan/expr/ConstEval.java    |  109 +
 .../org/apache/tajo/plan/expr/EvalNode.java     |   74 +
 .../apache/tajo/plan/expr/EvalNodeVisitor.java  |   24 +
 .../apache/tajo/plan/expr/EvalNodeVisitor2.java |   72 +
 .../apache/tajo/plan/expr/EvalTreeFactory.java  |   32 +
 .../org/apache/tajo/plan/expr/EvalTreeUtil.java |  520 +++++
 .../org/apache/tajo/plan/expr/EvalType.java     |  172 ++
 .../org/apache/tajo/plan/expr/FieldEval.java    |  129 ++
 .../org/apache/tajo/plan/expr/FunctionEval.java |  175 ++
 .../tajo/plan/expr/GeneralFunctionEval.java     |   81 +
 .../java/org/apache/tajo/plan/expr/InEval.java  |   86 +
 .../tajo/plan/expr/InvalidEvalException.java    |   36 +
 .../org/apache/tajo/plan/expr/IsNullEval.java   |   84 +
 .../tajo/plan/expr/LikePredicateEval.java       |   54 +
 .../java/org/apache/tajo/plan/expr/NotEval.java |   56 +
 .../tajo/plan/expr/PartialBinaryExpr.java       |   73 +
 .../plan/expr/PatternMatchPredicateEval.java    |   90 +
 .../tajo/plan/expr/RegexPredicateEval.java      |   53 +
 .../apache/tajo/plan/expr/RowConstantEval.java  |   99 +
 .../org/apache/tajo/plan/expr/SignedEval.java   |   86 +
 .../tajo/plan/expr/SimilarToPredicateEval.java  |   48 +
 .../tajo/plan/expr/SimpleEvalNodeVisitor.java   |  172 ++
 .../org/apache/tajo/plan/expr/UnaryEval.java    |  107 +
 .../tajo/plan/expr/WindowFunctionEval.java      |  117 +
 .../exprrewrite/EvalTreeOptimizationRule.java   |   28 +
 .../plan/exprrewrite/EvalTreeOptimizer.java     |   79 +
 .../plan/exprrewrite/rules/ConstantFolding.java |   92 +
 .../exprrewrite/rules/ConstantPropagation.java  |  112 +
 .../apache/tajo/plan/function/AggFunction.java  |   59 +
 .../tajo/plan/function/FunctionContext.java     |   22 +
 .../tajo/plan/function/GeneralFunction.java     |   57 +
 .../tajo/plan/function/WindowAggFunc.java       |   62 +
 .../org/apache/tajo/plan/joinorder/Edge.java    |   50 +
 .../tajo/plan/joinorder/FoundJoinOrder.java     |   47 +
 .../GreedyHeuristicJoinOrderAlgorithm.java      |  304 +++
 .../apache/tajo/plan/joinorder/JoinEdge.java    |   75 +
 .../apache/tajo/plan/joinorder/JoinGraph.java   |  154 ++
 .../tajo/plan/joinorder/JoinOrderAlgorithm.java |   48 +
 .../tajo/plan/logical/AlterTableNode.java       |  134 ++
 .../tajo/plan/logical/AlterTablespaceNode.java  |  104 +
 .../apache/tajo/plan/logical/BinaryNode.java    |   77 +
 .../tajo/plan/logical/CreateDatabaseNode.java   |   87 +
 .../tajo/plan/logical/CreateTableNode.java      |  145 ++
 .../tajo/plan/logical/DistinctGroupbyNode.java  |  251 +++
 .../tajo/plan/logical/DropDatabaseNode.java     |   85 +
 .../apache/tajo/plan/logical/DropTableNode.java |   95 +
 .../apache/tajo/plan/logical/EvalExprNode.java  |   85 +
 .../apache/tajo/plan/logical/ExceptNode.java    |   45 +
 .../apache/tajo/plan/logical/GroupElement.java  |   64 +
 .../apache/tajo/plan/logical/GroupbyNode.java   |  254 +++
 .../apache/tajo/plan/logical/HavingNode.java    |   72 +
 .../apache/tajo/plan/logical/IndexScanNode.java |  122 ++
 .../apache/tajo/plan/logical/InsertNode.java    |  182 ++
 .../apache/tajo/plan/logical/IntersectNode.java |   44 +
 .../org/apache/tajo/plan/logical/JoinNode.java  |  163 ++
 .../org/apache/tajo/plan/logical/LimitNode.java |   65 +
 .../apache/tajo/plan/logical/LogicalNode.java   |  128 ++
 .../tajo/plan/logical/LogicalNodeVisitor.java   |   27 +
 .../tajo/plan/logical/LogicalRootNode.java      |   41 +
 .../plan/logical/NoSuchColumnException.java     |   34 +
 .../org/apache/tajo/plan/logical/NodeType.java  |   67 +
 .../plan/logical/PartitionedTableScanNode.java  |  159 ++
 .../tajo/plan/logical/PersistentStoreNode.java  |   90 +
 .../apache/tajo/plan/logical/Projectable.java   |   73 +
 .../tajo/plan/logical/ProjectionNode.java       |  114 +
 .../apache/tajo/plan/logical/RelationNode.java  |   49 +
 .../org/apache/tajo/plan/logical/ScanNode.java  |  247 +++
 .../tajo/plan/logical/SelectableNode.java       |   48 +
 .../apache/tajo/plan/logical/SelectionNode.java |   74 +
 .../tajo/plan/logical/ShuffleFileWriteNode.java |  103 +
 .../org/apache/tajo/plan/logical/SortNode.java  |   94 +
 .../tajo/plan/logical/StoreTableNode.java       |  100 +
 .../tajo/plan/logical/TableSubQueryNode.java    |  180 ++
 .../tajo/plan/logical/TruncateTableNode.java    |   62 +
 .../org/apache/tajo/plan/logical/UnaryNode.java |   69 +
 .../org/apache/tajo/plan/logical/UnionNode.java |   37 +
 .../apache/tajo/plan/logical/WindowAggNode.java |  239 +++
 .../apache/tajo/plan/logical/WindowSpec.java    |  208 ++
 .../tajo/plan/nameresolver/NameResolver.java    |  291 +++
 .../plan/nameresolver/NameResolvingMode.java    |   80 +
 .../plan/nameresolver/ResolverByLegacy.java     |  126 ++
 .../tajo/plan/nameresolver/ResolverByRels.java  |   38 +
 .../nameresolver/ResolverByRelsAndSubExprs.java |   42 +
 .../nameresolver/ResolverBySubExprsAndRels.java |   42 +
 .../plan/rewrite/BasicQueryRewriteEngine.java   |   72 +
 .../tajo/plan/rewrite/QueryRewriteEngine.java   |   32 +
 .../apache/tajo/plan/rewrite/RewriteRule.java   |   56 +
 .../plan/rewrite/rules/FilterPushDownRule.java  |  912 ++++++++
 .../rewrite/rules/PartitionedTableRewriter.java |  428 ++++
 .../rewrite/rules/ProjectionPushDownRule.java   | 1148 ++++++++++
 .../tajo/plan/serder/EvalNodeAdapter.java       |   50 +
 .../plan/serder/EvalTreeProtoDeserializer.java  |  217 ++
 .../plan/serder/EvalTreeProtoSerializer.java    |  307 +++
 .../tajo/plan/serder/LogicalNodeAdapter.java    |   50 +
 .../apache/tajo/plan/serder/PlanGsonHelper.java |   90 +
 .../org/apache/tajo/plan/util/ExprFinder.java   |   76 +
 .../org/apache/tajo/plan/util/PlannerUtil.java  |  778 +++++++
 .../org/apache/tajo/plan/util/SchemaUtil.java   |   88 +
 .../tajo/plan/verifier/ExprsVerifier.java       |  252 +++
 .../tajo/plan/verifier/LogicalPlanVerifier.java |  269 +++
 .../plan/verifier/PreLogicalPlanVerifier.java   |  295 +++
 .../tajo/plan/verifier/VerificationState.java   |   44 +
 .../tajo/plan/verifier/VerifyException.java     |   27 +
 .../plan/visitor/BasicLogicalPlanVisitor.java   |  353 +++
 .../plan/visitor/ExplainLogicalPlanVisitor.java |  250 +++
 .../tajo/plan/visitor/LogicalPlanVisitor.java   |  100 +
 .../tajo/plan/visitor/SimpleAlgebraVisitor.java |  212 ++
 tajo-plan/src/main/proto/Plan.proto             |  220 ++
 .../org/apache/tajo/plan/TestExprAnnotator.java |   46 +
 .../org/apache/tajo/plan/TestLogicalNode.java   |   70 +
 tajo-project/pom.xml                            |    5 +
 .../apache/tajo/storage/StorageConstants.java   |   73 -
 .../org/apache/tajo/storage/StorageUtil.java    |   20 -
 .../java/org/apache/tajo/storage/Tuple.java     |   75 -
 .../java/org/apache/tajo/storage/VTuple.java    |  233 --
 .../apache/tajo/storage/TestMergeScanner.java   |    2 +-
 .../org/apache/tajo/storage/TestStorages.java   |    6 +-
 .../java/org/apache/tajo/storage/Tuple.java     |   83 -
 531 files changed, 26171 insertions(+), 25704 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index e498d9e..a9a3127 100644
--- a/CHANGES
+++ b/CHANGES
@@ -11,6 +11,9 @@ Release 0.9.1 - unreleased
 
   IMPROVEMENT
 
+    TAJO-1125: Separate logical plan and optimizer into a maven module.
+    (hyunsik)
+
     TAJO-1092: Improve the function system to allow other function 
     implementation types. (hyunsik)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a3bcf20..3dca9c0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -82,6 +82,7 @@
     <module>tajo-project</module>
     <module>tajo-common</module>
     <module>tajo-algebra</module>
+    <module>tajo-plan</module>
     <module>tajo-core</module>
     <module>tajo-rpc</module>
     <module>tajo-catalog</module>

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/CatalogService.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/CatalogService.java b/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/CatalogService.java
deleted file mode 100644
index 667ee88..0000000
--- a/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/CatalogService.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- * Licensed 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.catalog;
-
-import org.apache.tajo.catalog.partition.PartitionMethodDesc;
-import org.apache.tajo.catalog.proto.CatalogProtos;
-import org.apache.tajo.common.TajoDataTypes.DataType;
-
-import java.util.Collection;
-
-import static org.apache.tajo.catalog.proto.CatalogProtos.AlterTablespaceProto;
-import static org.apache.tajo.catalog.proto.CatalogProtos.FunctionType;
-import static org.apache.tajo.catalog.proto.CatalogProtos.TablespaceProto;
-
-public interface CatalogService {
-
-  /**
-   *
-   * @param tableSpaceName Tablespace name to be created
-   * @return True if tablespace is created successfully. Otherwise, it will return FALSE.
-   */
-  Boolean createTablespace(String tableSpaceName, String uri);
-
-  /**
-   *
-   * @param tableSpaceName Tablespace name to be created
-   * @return True if tablespace is created successfully. Otherwise, it will return FALSE.
-   */
-  Boolean existTablespace(String tableSpaceName);
-
-  /**
-   *
-   * @param tableSpaceName Tablespace name to be created
-   * @return True if tablespace is created successfully. Otherwise, it will return FALSE.
-   */
-  Boolean dropTablespace(String tableSpaceName);
-
-  /**
-   *
-   * @return All tablespace names
-   */
-  Collection<String> getAllTablespaceNames();
-
-  /**
-   *
-   * @param tablespaceName Tablespace name to get
-   * @return Tablespace description
-   */
-  TablespaceProto getTablespace(String tablespaceName);
-
-  /**
-   *
-   * @param alterTablespace AlterTablespace
-   * @return True if update is successfully.
-   */
-  Boolean alterTablespace(AlterTablespaceProto alterTablespace);
-
-  /**
-   *
-   * @param databaseName Database name to be created
-   * @return True if database is created successfully. Otherwise, it will return FALSE.
-   */
-  Boolean createDatabase(String databaseName, String tablespaceName);
-
-  /**
-   *
-   * @param databaseName Database name to be dropped
-   * @return True if database is dropped sucessfully. Otherwise, it will return FALSE.
-   */
-  Boolean dropDatabase(String databaseName);
-
-  /**
-   *
-   * @param databaseName Database name to be checked
-   * @return True if database exists. Otherwise, it will return FALSE.
-   */
-  Boolean existDatabase(String databaseName);
-
-  /**
-   *
-   * @return All database names
-   */
-  Collection<String> getAllDatabaseNames();
-
-  /**
-   * Get a table description by name
-   * @param tableName table name
-   * @return a table description
-   * @see TableDesc
-   * @throws Throwable
-   */
-  TableDesc getTableDesc(String databaseName, String tableName);
-
-  /**
-   * Get a table description by name
-   * @return a table description
-   * @see TableDesc
-   * @throws Throwable
-   */
-  TableDesc getTableDesc(String qualifiedName);
-
-  /**
-   *
-   * @return All table names which belong to a given database.
-   */
-  Collection<String> getAllTableNames(String databaseName);
-
-  /**
-   *
-   * @return All FunctionDescs
-   */
-  Collection<FunctionDesc> getFunctions();
-
-  /**
-   * Add a table via table description
-   * @see TableDesc
-   * @throws Throwable
-   */
-  boolean createTable(TableDesc desc);
-
-
-  /**
-   * Drop a table by name
-   *
-   * @param tableName table name
-   * @throws Throwable
-   */
-  boolean dropTable(String tableName);
-
-  boolean existsTable(String databaseName, String tableName);
-
-  boolean existsTable(String tableName);
-
-  PartitionMethodDesc getPartitionMethod(String databaseName, String tableName);
-
-  boolean existPartitionMethod(String databaseName, String tableName);
-
-  boolean createIndex(IndexDesc index);
-
-  boolean existIndexByName(String databaseName, String indexName);
-
-  boolean existIndexByColumn(String databaseName, String tableName, String columnName);
-
-  IndexDesc getIndexByName(String databaseName, String indexName);
-
-  IndexDesc getIndexByColumn(String databaseName, String tableName, String columnName);
-
-  boolean dropIndex(String databaseName, String indexName);
-
-  boolean createFunction(FunctionDesc funcDesc);
-
-  boolean dropFunction(String signature);
-
-  FunctionDesc getFunction(String signature, DataType... paramTypes);
-
-  FunctionDesc getFunction(String signature, FunctionType funcType, DataType... paramTypes);
-
-  boolean containFunction(String signature, DataType... paramTypes);
-
-  boolean containFunction(String signature, FunctionType funcType, DataType... paramTypes);
-
-  /**
-  * Add a table via table description
-  * @see AlterTableDesc
-  * @throws Throwable
-  */
-  boolean alterTable(AlterTableDesc desc);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogService.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogService.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogService.java
new file mode 100644
index 0000000..667ee88
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogService.java
@@ -0,0 +1,184 @@
+/**
+ * Licensed 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.catalog;
+
+import org.apache.tajo.catalog.partition.PartitionMethodDesc;
+import org.apache.tajo.catalog.proto.CatalogProtos;
+import org.apache.tajo.common.TajoDataTypes.DataType;
+
+import java.util.Collection;
+
+import static org.apache.tajo.catalog.proto.CatalogProtos.AlterTablespaceProto;
+import static org.apache.tajo.catalog.proto.CatalogProtos.FunctionType;
+import static org.apache.tajo.catalog.proto.CatalogProtos.TablespaceProto;
+
+public interface CatalogService {
+
+  /**
+   *
+   * @param tableSpaceName Tablespace name to be created
+   * @return True if tablespace is created successfully. Otherwise, it will return FALSE.
+   */
+  Boolean createTablespace(String tableSpaceName, String uri);
+
+  /**
+   *
+   * @param tableSpaceName Tablespace name to be created
+   * @return True if tablespace is created successfully. Otherwise, it will return FALSE.
+   */
+  Boolean existTablespace(String tableSpaceName);
+
+  /**
+   *
+   * @param tableSpaceName Tablespace name to be created
+   * @return True if tablespace is created successfully. Otherwise, it will return FALSE.
+   */
+  Boolean dropTablespace(String tableSpaceName);
+
+  /**
+   *
+   * @return All tablespace names
+   */
+  Collection<String> getAllTablespaceNames();
+
+  /**
+   *
+   * @param tablespaceName Tablespace name to get
+   * @return Tablespace description
+   */
+  TablespaceProto getTablespace(String tablespaceName);
+
+  /**
+   *
+   * @param alterTablespace AlterTablespace
+   * @return True if update is successfully.
+   */
+  Boolean alterTablespace(AlterTablespaceProto alterTablespace);
+
+  /**
+   *
+   * @param databaseName Database name to be created
+   * @return True if database is created successfully. Otherwise, it will return FALSE.
+   */
+  Boolean createDatabase(String databaseName, String tablespaceName);
+
+  /**
+   *
+   * @param databaseName Database name to be dropped
+   * @return True if database is dropped sucessfully. Otherwise, it will return FALSE.
+   */
+  Boolean dropDatabase(String databaseName);
+
+  /**
+   *
+   * @param databaseName Database name to be checked
+   * @return True if database exists. Otherwise, it will return FALSE.
+   */
+  Boolean existDatabase(String databaseName);
+
+  /**
+   *
+   * @return All database names
+   */
+  Collection<String> getAllDatabaseNames();
+
+  /**
+   * Get a table description by name
+   * @param tableName table name
+   * @return a table description
+   * @see TableDesc
+   * @throws Throwable
+   */
+  TableDesc getTableDesc(String databaseName, String tableName);
+
+  /**
+   * Get a table description by name
+   * @return a table description
+   * @see TableDesc
+   * @throws Throwable
+   */
+  TableDesc getTableDesc(String qualifiedName);
+
+  /**
+   *
+   * @return All table names which belong to a given database.
+   */
+  Collection<String> getAllTableNames(String databaseName);
+
+  /**
+   *
+   * @return All FunctionDescs
+   */
+  Collection<FunctionDesc> getFunctions();
+
+  /**
+   * Add a table via table description
+   * @see TableDesc
+   * @throws Throwable
+   */
+  boolean createTable(TableDesc desc);
+
+
+  /**
+   * Drop a table by name
+   *
+   * @param tableName table name
+   * @throws Throwable
+   */
+  boolean dropTable(String tableName);
+
+  boolean existsTable(String databaseName, String tableName);
+
+  boolean existsTable(String tableName);
+
+  PartitionMethodDesc getPartitionMethod(String databaseName, String tableName);
+
+  boolean existPartitionMethod(String databaseName, String tableName);
+
+  boolean createIndex(IndexDesc index);
+
+  boolean existIndexByName(String databaseName, String indexName);
+
+  boolean existIndexByColumn(String databaseName, String tableName, String columnName);
+
+  IndexDesc getIndexByName(String databaseName, String indexName);
+
+  IndexDesc getIndexByColumn(String databaseName, String tableName, String columnName);
+
+  boolean dropIndex(String databaseName, String indexName);
+
+  boolean createFunction(FunctionDesc funcDesc);
+
+  boolean dropFunction(String signature);
+
+  FunctionDesc getFunction(String signature, DataType... paramTypes);
+
+  FunctionDesc getFunction(String signature, FunctionType funcType, DataType... paramTypes);
+
+  boolean containFunction(String signature, DataType... paramTypes);
+
+  boolean containFunction(String signature, FunctionType funcType, DataType... paramTypes);
+
+  /**
+  * Add a table via table description
+  * @see AlterTableDesc
+  * @throws Throwable
+  */
+  boolean alterTable(AlterTableDesc desc);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
index 7486eff..8be4a8d 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
@@ -30,6 +30,8 @@ import org.apache.tajo.catalog.proto.CatalogProtos.TableDescProto;
 import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.common.TajoDataTypes.DataType;
 import org.apache.tajo.exception.InvalidOperationException;
+import org.apache.tajo.storage.StorageConstants;
+import org.apache.tajo.unit.StorageUnit;
 import org.apache.tajo.util.KeyValueSet;
 import org.apache.tajo.util.StringUtils;
 import org.apache.tajo.util.TUtil;
@@ -805,4 +807,31 @@ public class CatalogUtil {
 
     TUtil.putToNestedMap(OPERATION_CASTING_MAP, Type.INET4, Type.INET4, Type.INET4);
   }
+
+  // table default properties
+  public static final String BLOCK_SIZE           = "parquet.block.size";
+  public static final String PAGE_SIZE            = "parquet.page.size";
+  public static final String COMPRESSION          = "parquet.compression";
+  public static final String ENABLE_DICTIONARY    = "parquet.enable.dictionary";
+  public static final String VALIDATION           = "parquet.validation";
+
+  public static KeyValueSet newPhysicalProperties(StoreType type) {
+    KeyValueSet options = new KeyValueSet();
+    if (StoreType.CSV == type) {
+      options.set(StorageConstants.CSVFILE_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
+    } else if (StoreType.RCFILE == type) {
+      options.set(StorageConstants.RCFILE_SERDE, StorageConstants.DEFAULT_BINARY_SERDE);
+    } else if (StoreType.SEQUENCEFILE == type) {
+      options.set(StorageConstants.SEQUENCEFILE_SERDE, StorageConstants.DEFAULT_TEXT_SERDE);
+      options.set(StorageConstants.SEQUENCEFILE_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
+    } else if (type == StoreType.PARQUET) {
+      options.set(BLOCK_SIZE, StorageConstants.PARQUET_DEFAULT_BLOCK_SIZE);
+      options.set(PAGE_SIZE, StorageConstants.PARQUET_DEFAULT_PAGE_SIZE);
+      options.set(COMPRESSION, StorageConstants.PARQUET_DEFAULT_COMPRESSION_CODEC_NAME);
+      options.set(ENABLE_DICTIONARY, StorageConstants.PARQUET_DEFAULT_IS_DICTIONARY_ENABLED);
+      options.set(VALIDATION, StorageConstants.PARQUET_DEFAULT_IS_VALIDATION_ENABLED);
+    }
+
+    return options;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-common/src/main/java/org/apache/tajo/storage/StorageConstants.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/storage/StorageConstants.java b/tajo-common/src/main/java/org/apache/tajo/storage/StorageConstants.java
new file mode 100644
index 0000000..a76e9ef
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/storage/StorageConstants.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed 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.storage;
+
+public class StorageConstants {
+  // table properties
+  public static final String COMPRESSION_CODEC = "compression.codec";
+  public static final String COMPRESSION_TYPE = "compression.type";
+
+  public static final String CSVFILE_DELIMITER = "csvfile.delimiter";
+  public static final String CSVFILE_NULL = "csvfile.null";
+  public static final String CSVFILE_SERDE = "csvfile.serde";
+
+
+  public static final String SEQUENCEFILE_DELIMITER = "sequencefile.delimiter";
+  public static final String SEQUENCEFILE_NULL = "sequencefile.null";
+  public static final String SEQUENCEFILE_SERDE = "sequencefile.serde";
+
+  public static final String RCFILE_NULL = "rcfile.null";
+  public static final String RCFILE_SERDE = "rcfile.serde";
+
+  public static final String DEFAULT_FIELD_DELIMITER = "|";
+  public static final String DEFAULT_BINARY_SERDE = "org.apache.tajo.storage.BinarySerializerDeserializer";
+  public static final String DEFAULT_TEXT_SERDE = "org.apache.tajo.storage.TextSerializerDeserializer";
+
+  public static final String PARQUET_DEFAULT_BLOCK_SIZE;
+  public static final String PARQUET_DEFAULT_PAGE_SIZE;
+  public static final String PARQUET_DEFAULT_COMPRESSION_CODEC_NAME;
+  public static final String PARQUET_DEFAULT_IS_DICTIONARY_ENABLED;
+  public static final String PARQUET_DEFAULT_IS_VALIDATION_ENABLED;
+
+  public static final String AVRO_SCHEMA_LITERAL = "avro.schema.literal";
+  public static final String AVRO_SCHEMA_URL = "avro.schema.url";
+
+  public static final int DEFAULT_BLOCK_SIZE = 128 * 1024 * 1024;
+  public static final int DEFAULT_PAGE_SIZE = 1 * 1024 * 1024;
+  static {
+    PARQUET_DEFAULT_BLOCK_SIZE = Integer.toString(DEFAULT_BLOCK_SIZE);
+    PARQUET_DEFAULT_PAGE_SIZE = Integer.toString(DEFAULT_PAGE_SIZE);
+
+    // When parquet-hadoop 1.3.3 is available, this should be changed to
+    // ParquetWriter.DEFAULT_COMPRESSION_CODEC_NAME.
+    PARQUET_DEFAULT_COMPRESSION_CODEC_NAME = "uncompressed";
+        // CompressionCodecName.UNCOMPRESSED.name().toLowerCase();
+
+    // When parquet-hadoop 1.3.3 is available, this should be changed to
+    // ParquetWriter.DEFAULT_IS_DICTIONARY_ENABLED.
+    PARQUET_DEFAULT_IS_DICTIONARY_ENABLED = "true";
+
+    // When parquet-hadoop 1.3.3 is available, this should be changed to
+    // ParquetWriter.DEFAULT_IS_VALIDATING_ENABLED.
+    PARQUET_DEFAULT_IS_VALIDATION_ENABLED = "false";
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-common/src/main/java/org/apache/tajo/storage/Tuple.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/storage/Tuple.java b/tajo-common/src/main/java/org/apache/tajo/storage/Tuple.java
new file mode 100644
index 0000000..c183171
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/storage/Tuple.java
@@ -0,0 +1,75 @@
+/**
+ * Licensed 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.storage;
+
+import org.apache.tajo.datum.Datum;
+import org.apache.tajo.datum.ProtobufDatum;
+
+public interface Tuple extends Cloneable {
+  
+	public int size();
+	
+	public boolean contains(int fieldid);
+
+  public boolean isNull(int fieldid);
+	
+	public void clear();
+	
+	public void put(int fieldId, Datum value);
+
+  public void put(int fieldId, Datum [] values);
+
+  public void put(int fieldId, Tuple tuple);
+	
+	public void put(Datum [] values);
+	
+	public Datum get(int fieldId);
+	
+	public void setOffset(long offset);
+	
+	public long getOffset();
+
+	public boolean getBool(int fieldId);
+
+	public byte getByte(int fieldId);
+
+  public char getChar(int fieldId);
+	
+	public byte [] getBytes(int fieldId);
+	
+	public short getInt2(int fieldId);
+	
+	public int getInt4(int fieldId);
+	
+	public long getInt8(int fieldId);
+	
+	public float getFloat4(int fieldId);
+	
+	public double getFloat8(int fieldId);
+	
+	public String getText(int fieldId);
+
+  public ProtobufDatum getProtobufDatum(int fieldId);
+
+  public char [] getUnicodeChars(int fieldId);
+
+  public Tuple clone() throws CloneNotSupportedException;
+
+  public Datum[] getValues();
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java b/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java
new file mode 100644
index 0000000..4fb35f9
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java
@@ -0,0 +1,233 @@
+/**
+ * Licensed 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.storage;
+
+import com.google.gson.annotations.Expose;
+import org.apache.tajo.datum.Datum;
+import org.apache.tajo.datum.Inet4Datum;
+import org.apache.tajo.datum.NullDatum;
+import org.apache.tajo.datum.ProtobufDatum;
+import org.apache.tajo.exception.UnimplementedException;
+
+import java.net.InetAddress;
+import java.util.Arrays;
+
+public class VTuple implements Tuple, Cloneable {
+	@Expose public Datum [] values;
+	@Expose private long offset;
+	
+	public VTuple(int size) {
+		values = new Datum[size];
+	}
+
+  public VTuple(Tuple tuple) {
+    this.values = tuple.getValues().clone();
+    this.offset = ((VTuple)tuple).offset;
+  }
+
+  public VTuple(Datum [] datum) {
+    this(datum.length);
+    put(datum);
+  }
+
+	@Override
+	public int size() {	
+		return values.length;
+	}
+	
+	public boolean contains(int fieldId) {
+		return values[fieldId] != null;
+	}
+
+  @Override
+  public boolean isNull(int fieldid) {
+    return values[fieldid] instanceof NullDatum;
+  }
+
+  @Override
+  public void clear() {   
+    for (int i=0; i < values.length; i++) {
+      values[i] = null;
+    }
+  }
+	
+	//////////////////////////////////////////////////////
+	// Setter
+	//////////////////////////////////////////////////////	
+	public void put(int fieldId, Datum value) {
+		values[fieldId] = value;
+	}
+
+  @Override
+  public void put(int fieldId, Datum[] values) {
+    for (int i = fieldId, j = 0; j < values.length; i++, j++) {
+      values[i] = values[j];
+    }
+  }
+
+  @Override
+  public void put(int fieldId, Tuple tuple) {
+    for (int i = fieldId, j = 0; j < tuple.size(); i++, j++) {
+      values[i] = tuple.get(j);
+    }
+  }
+
+  public void put(Datum [] values) {
+    System.arraycopy(values, 0, this.values, 0, size());
+	}
+	
+	//////////////////////////////////////////////////////
+	// Getter
+	//////////////////////////////////////////////////////
+	public Datum get(int fieldId) {
+		return this.values[fieldId];
+	}
+	
+	public void setOffset(long offset) {
+	  this.offset = offset;
+	}
+	
+	public long getOffset() {
+	  return this.offset;
+	}
+	
+	@Override
+	public boolean getBool(int fieldId) {
+		return values[fieldId].asBool();
+	}
+
+  @Override
+	public byte getByte(int fieldId) {
+		return values[fieldId].asByte();
+	}
+
+  @Override
+  public char getChar(int fieldId) {
+    return values[fieldId].asChar();
+  }
+
+  @Override
+	public byte [] getBytes(int fieldId) {
+		return values[fieldId].asByteArray();
+	}
+
+  @Override
+	public short getInt2(int fieldId) {
+		return values[fieldId].asInt2();
+	}
+
+  @Override
+	public int getInt4(int fieldId) {
+		return values[fieldId].asInt4();
+	}
+
+  @Override
+	public long getInt8(int fieldId) {
+		return values[fieldId].asInt8();
+	}
+
+  @Override
+	public float getFloat4(int fieldId) {
+		return values[fieldId].asFloat4();
+	}
+
+  @Override
+	public double getFloat8(int fieldId) {
+		return values[fieldId].asFloat8();
+	}
+
+	public Inet4Datum getIPv4(int fieldId) {
+		return (Inet4Datum) values[fieldId];
+	}
+
+	public byte [] getIPv4Bytes(int fieldId) {
+		return values[fieldId].asByteArray();
+	}
+
+	public InetAddress getIPv6(int fieldId) {
+		throw new UnimplementedException("IPv6 is unsupported yet");
+	}
+
+	public byte[] getIPv6Bytes(int fieldId) {
+	  throw new UnimplementedException("IPv6 is unsupported yet");
+	}
+
+  @Override
+	public String getText(int fieldId) {
+		return values[fieldId].asChars();
+	}
+
+  @Override
+  public ProtobufDatum getProtobufDatum(int fieldId) {
+    return (ProtobufDatum) values[fieldId];
+  }
+
+  @Override
+  public char[] getUnicodeChars(int fieldId) {
+    return values[fieldId].asUnicodeChars();
+  }
+
+  @Override
+  public Tuple clone() throws CloneNotSupportedException {
+    VTuple tuple = (VTuple) super.clone();
+
+    tuple.values = new Datum[size()];
+    System.arraycopy(values, 0, tuple.values, 0, size()); //shallow copy
+    return tuple;
+  }
+
+  public String toString() {
+		boolean first = true;
+		StringBuilder str = new StringBuilder();
+		str.append("(");
+		for(int i=0; i < values.length; i++) {			
+			if(values[i] != null) {
+				if(first) {
+					first = false;
+				} else {
+					str.append(", ");
+				}
+				str.append(i)
+				.append("=>")
+				.append(values[i]);
+			}
+		}
+		str.append(")");
+		return str.toString();
+	}
+
+	@Override
+	public int hashCode() {
+	  return Arrays.hashCode(values);
+	}
+
+  @Override
+  public Datum[] getValues() {
+    return values;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj instanceof Tuple) {
+      Tuple other = (Tuple) obj;
+      return Arrays.equals(getValues(), other.getValues());
+    }
+    return false;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-common/src/main/java/org/apache/tajo/util/graph/DirectedGraph.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/graph/DirectedGraph.java b/tajo-common/src/main/java/org/apache/tajo/util/graph/DirectedGraph.java
new file mode 100644
index 0000000..5433ef5
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/util/graph/DirectedGraph.java
@@ -0,0 +1,64 @@
+/**
+ * Licensed 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.util.graph;
+
+import org.apache.tajo.annotation.Nullable;
+
+import java.util.List;
+
+/**
+ * This represents a directed graph.
+ *
+ * @param <V> The vertex class type
+ * @param <E> The edge class type
+ */
+public interface DirectedGraph<V, E> extends Graph<V, E> {
+
+  boolean hasReversedEdge(V head, V tail);
+
+  E getReverseEdge(V head, V tail);
+
+  List<E> getIncomingEdges(V head);
+
+  List<E> getOutgoingEdges(V tail);
+
+  /////////////////////////////////
+  // belows are tree features
+  /////////////////////////////////
+  boolean isRoot(V v);
+
+  boolean isLeaf(V v);
+
+  int getParentCount(V block);
+
+  @Nullable V getParent(V block, int idx);
+
+  List<V> getParents(V block);
+
+  int getChildCount(V block);
+
+  @Nullable V getChild(V block, int idx);
+
+  List<V> getChilds(V block);
+
+  /**
+   * It visits all vertices in a post-order traverse way.
+   */
+  void accept(V src, DirectedGraphVisitor<V> visitor);
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-common/src/main/java/org/apache/tajo/util/graph/DirectedGraphCursor.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/graph/DirectedGraphCursor.java b/tajo-common/src/main/java/org/apache/tajo/util/graph/DirectedGraphCursor.java
new file mode 100644
index 0000000..9b15cfe
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/util/graph/DirectedGraphCursor.java
@@ -0,0 +1,65 @@
+/**
+ * Licensed 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.util.graph;
+
+import java.util.ArrayList;
+
+public class DirectedGraphCursor<V,E> {
+  private DirectedGraph<V,E> graph;
+  private ArrayList<V> orderedVertices = new ArrayList<V>();
+  private int cursor = 0;
+
+  public DirectedGraphCursor(DirectedGraph<V, E> graph, V startVertex) {
+    this.graph = graph;
+    buildOrder(startVertex);
+  }
+
+  public int size() {
+    return orderedVertices.size();
+  }
+
+  private void buildOrder(V current) {
+    if (!graph.isLeaf(current)) {
+      for (V child : graph.getChilds(current)) {
+        buildOrder(child);
+      }
+    }
+    orderedVertices.add(current);
+  }
+
+  public boolean hasNext() {
+    return cursor < orderedVertices.size();
+  }
+
+  public V nextBlock() {
+    return orderedVertices.get(cursor++);
+  }
+
+  public V peek() {
+    return orderedVertices.get(cursor);
+  }
+
+  public V peek(int skip) {
+    return orderedVertices.get(cursor + skip);
+  }
+
+  public void reset() {
+    cursor = 0;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-common/src/main/java/org/apache/tajo/util/graph/DirectedGraphVisitor.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/graph/DirectedGraphVisitor.java b/tajo-common/src/main/java/org/apache/tajo/util/graph/DirectedGraphVisitor.java
new file mode 100644
index 0000000..139c2b4
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/util/graph/DirectedGraphVisitor.java
@@ -0,0 +1,25 @@
+/**
+ * Licensed 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.util.graph;
+
+import java.util.Stack;
+
+public interface DirectedGraphVisitor<V> {
+  void visit(Stack<V> stack, V v);
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-common/src/main/java/org/apache/tajo/util/graph/Graph.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/graph/Graph.java b/tajo-common/src/main/java/org/apache/tajo/util/graph/Graph.java
new file mode 100644
index 0000000..886b09d
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/util/graph/Graph.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed 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.util.graph;
+
+import org.apache.tajo.annotation.Nullable;
+
+import java.util.Collection;
+
+/**
+ * This is the topmost graph interface. It only provides essential graph features.
+ * @param <V> Vertex class
+ * @param <E> Edge Class
+ */
+
+public interface Graph<V, E> {
+  int getVertexSize();
+
+  int getEdgeNum();
+
+  void addEdge(V tail, V head, E edge);
+
+  void removeEdge(V tail, V head);
+
+  boolean hasEdge(V tail, V head);
+
+  @Nullable E getEdge(V tail, V head);
+
+  Collection<E> getEdgesAll();
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-common/src/main/java/org/apache/tajo/util/graph/SimpleDirectedGraph.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/graph/SimpleDirectedGraph.java b/tajo-common/src/main/java/org/apache/tajo/util/graph/SimpleDirectedGraph.java
new file mode 100644
index 0000000..d72a2dd
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/util/graph/SimpleDirectedGraph.java
@@ -0,0 +1,270 @@
+/**
+ * Licensed 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.util.graph;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import org.apache.tajo.annotation.Nullable;
+import org.apache.tajo.util.TUtil;
+
+import java.util.*;
+
+/**
+ * This represents a simple directed graph. It does not support multiple edges between both vertices.
+ *
+ * @param <V> The vertex class type
+ * @param <E> The edge class type
+ */
+public class SimpleDirectedGraph<V, E> implements DirectedGraph<V,E> {
+  /** map: child -> parent */
+  protected Map<V, Map<V, E>> directedEdges = TUtil.newLinkedHashMap();
+  /** map: parent -> child */
+  protected Map<V, Map<V, E>> reversedEdges = TUtil.newLinkedHashMap();
+
+  @Override
+  public int getVertexSize() {
+    return directedEdges.size();
+  }
+
+  @Override
+  public int getEdgeNum() {
+    int edgeNum = 0;
+    for (Map<V, E> map : directedEdges.values()) {
+      edgeNum += map.values().size();
+    }
+
+    return edgeNum;
+  }
+
+  @Override
+  public void addEdge(V tail, V head, E edge) {
+    TUtil.putToNestedMap(directedEdges, tail, head, edge);
+    TUtil.putToNestedMap(reversedEdges, head, tail, edge);
+  }
+
+  @Override
+  public void removeEdge(V tail, V head) {
+    if (directedEdges.containsKey(tail)) {
+      directedEdges.get(tail).remove(head);
+      if (directedEdges.get(tail).isEmpty()) {
+        directedEdges.remove(tail);
+      }
+
+      reversedEdges.get(head).remove(tail);
+      if (reversedEdges.get(head).isEmpty()) {
+        reversedEdges.remove(head);
+      }
+    } else {
+      throw new RuntimeException("Not connected channel: " + tail + " -> " + head);
+    }
+  }
+
+  @Override
+  public boolean hasEdge(V tail, V head) {
+    return directedEdges.containsKey(tail) && directedEdges.get(tail).containsKey(head);
+  }
+
+  @Override
+  public boolean hasReversedEdge(V head, V tail) {
+    return reversedEdges.containsKey(head) && reversedEdges.get(head).containsKey(tail);
+  }
+
+  @Override
+  public @Nullable E getEdge(V tail, V head) {
+    if (hasEdge(tail, head)) {
+      return directedEdges.get(tail).get(head);
+    } else {
+      return null;
+    }
+  }
+
+  @Override
+  public @Nullable
+  E getReverseEdge(V head, V tail) {
+    if (hasReversedEdge(head, tail)) {
+      return reversedEdges.get(head).get(tail);
+    } else {
+      return null;
+    }
+  }
+
+  @Override
+  public Collection<E> getEdgesAll() {
+    List<E> edges = Lists.newArrayList();
+    for (Map<V, E> map : directedEdges.values()) {
+      edges.addAll(map.values());
+    }
+    return edges;
+  }
+
+  @Override
+  public int getChildCount(V v) {
+    if (reversedEdges.containsKey(v)) {
+      return reversedEdges.get(v).size();
+    } else {
+      return 0;
+    }
+  }
+
+  @Override
+  public List<E> getIncomingEdges(V head) {
+    if (reversedEdges.containsKey(head)) {
+      return ImmutableList.copyOf(reversedEdges.get(head).values());
+    } else {
+      return null;
+    }
+  }
+
+  @Override
+  public List<E> getOutgoingEdges(V tail) {
+    if (directedEdges.containsKey(tail)) {
+      return ImmutableList.copyOf(directedEdges.get(tail).values());
+    } else {
+      return null;
+    }
+  }
+
+  @Override
+  public List<V> getChilds(V v) {
+    List<V> childBlocks = new ArrayList<V>();
+    if (reversedEdges.containsKey(v)) {
+      for (Map.Entry<V, E> entry: reversedEdges.get(v).entrySet()) {
+        childBlocks.add(entry.getKey());
+      }
+    }
+    return childBlocks;
+  }
+
+  @Override
+  public V getChild(V block, int idx) {
+    if (reversedEdges.containsKey(block)) {
+      int i = 0;
+      for (Map.Entry<V, E> entry: reversedEdges.get(block).entrySet()) {
+        if (idx == i++) {
+          return entry.getKey();
+        }
+      }
+    }
+    return null;
+  }
+
+  @Override
+  public @Nullable V getParent(V block, int idx) {
+    if (directedEdges.containsKey(block)) {
+      int i = 0;
+      for (Map.Entry<V, E> entry: directedEdges.get(block).entrySet()) {
+        if (idx == i++) {
+          return entry.getKey();
+        }
+      }
+    }
+    return null;
+  }
+
+  @Override
+  public List<V> getParents(V block) {
+    List<V> childBlocks = new ArrayList<V>();
+    if (directedEdges.containsKey(block)) {
+      for (Map.Entry<V, E> entry: directedEdges.get(block).entrySet()) {
+        childBlocks.add(entry.getKey());
+      }
+    }
+    return childBlocks;
+  }
+
+  @Override
+  public boolean isRoot(V v) {
+    return !directedEdges.containsKey(v);
+  }
+
+  @Override
+  public boolean isLeaf(V v) {
+    return !reversedEdges.containsKey(v);
+  }
+
+  @Override
+  public int getParentCount(V block) {
+    if (directedEdges.containsKey(block)) {
+      return directedEdges.get(block).size();
+    } else {
+      return -1;
+    }
+  }
+
+  @Override
+  public void accept(V source, DirectedGraphVisitor<V> visitor) {
+    Stack<V> stack = new Stack<V>();
+    visitRecursive(stack, source, visitor);
+  }
+
+  private void visitRecursive(Stack<V> stack, V current, DirectedGraphVisitor<V> visitor) {
+    stack.push(current);
+    for (V child : getChilds(current)) {
+      visitRecursive(stack, child, visitor);
+    }
+    stack.pop();
+    visitor.visit(stack, current);
+  }
+
+  public String toString() {
+    return "G (|v| = " + directedEdges.size() +")";
+  }
+
+  public String printDepthString(DepthString planStr) {
+    StringBuilder output = new StringBuilder();
+    String pad = new String(new char[planStr.depth * 3]).replace('\0', ' ');
+    output.append(pad + "|-" + planStr.vertexStr).append("\n");
+
+    return output.toString();
+  }
+
+  public String toStringGraph(V vertex) {
+    StringBuilder sb = new StringBuilder();
+    QueryGraphTopologyStringBuilder visitor = new QueryGraphTopologyStringBuilder();
+    accept(vertex, visitor);
+    Stack<DepthString> depthStrings = visitor.getDepthStrings();
+    while(!depthStrings.isEmpty()) {
+      sb.append(printDepthString(depthStrings.pop()));
+    }
+    return sb.toString();
+  }
+
+  private class DepthString {
+    int depth;
+    String vertexStr;
+
+    DepthString(int depth, String vertexStr) {
+      this.depth = depth;
+      this.vertexStr = vertexStr;
+    }
+  }
+
+  private class QueryGraphTopologyStringBuilder implements DirectedGraphVisitor<V> {
+    Stack<DepthString> depthString = new Stack<DepthString>();
+
+    @Override
+    public void visit(Stack<V> stack, V vertex) {
+      depthString.push(new DepthString(stack.size(), vertex.toString()));
+    }
+
+    public Stack<DepthString> getDepthStrings() {
+      return depthString;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-common/src/main/java/org/apache/tajo/util/graph/SimpleUndirectedGraph.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/graph/SimpleUndirectedGraph.java b/tajo-common/src/main/java/org/apache/tajo/util/graph/SimpleUndirectedGraph.java
new file mode 100644
index 0000000..4ac12c1
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/util/graph/SimpleUndirectedGraph.java
@@ -0,0 +1,102 @@
+/**
+ * Licensed 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.util.graph;
+
+import com.google.common.collect.Lists;
+import org.apache.tajo.annotation.Nullable;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * This implementation is based on a directed graph implementation. Each edge is connected in bidirection
+ * between two vertices.
+ *
+ * @param <V> Vertex Class
+ * @param <E> Edge Class
+ */
+public class SimpleUndirectedGraph<V, E> extends SimpleDirectedGraph<V, E> implements UndirectedGraph<V, E> {
+
+  @Override
+  public @Nullable E getEdge(V tail, V head) {
+    E edge = super.getEdge(tail, head);
+    if (edge != null) {
+      return edge;
+    }
+    edge = super.getEdge(head, tail);
+    if (edge != null) {
+      return edge;
+    }
+    return null;
+  }
+
+  @Override
+  public Collection<E> getEdges(V v) {
+    List<E> edges = Lists.newArrayList();
+    List<E> outgoingEdges = getOutgoingEdges(v);
+    if (outgoingEdges != null) {
+      edges.addAll(outgoingEdges);
+    }
+    List<E> incomingEdges = getIncomingEdges(v);
+    if (incomingEdges != null) {
+      edges.addAll(incomingEdges);
+    }
+    return edges;
+  }
+
+  @Override
+  public int getDegree(V v) {
+    return getEdges(v).size();
+  }
+
+  @Override
+  public Collection<E> getEdgesAll() {
+    List<E> edges = Lists.newArrayList();
+    for (Map<V, E> map : directedEdges.values()) {
+      edges.addAll(map.values());
+    }
+    return edges;
+  }
+
+  @Override
+  public V getParent(V v, int idx) {
+    throw new UnsupportedOperationException("Cannot support getParent(V v) in UndirectedGraph");
+  }
+
+  @Override
+  public int getParentCount(V v) {
+    throw new UnsupportedOperationException("Cannot support getParent(V v) in UndirectedGraph");
+  }
+
+  @Override
+  public List<V> getParents(V v) {
+    throw new UnsupportedOperationException("Cannot support getParent(V v) in UndirectedGraph");
+  }
+
+  @Override
+  public boolean isRoot(V v) {
+    throw new UnsupportedOperationException("Cannot support isRoot(V v) in UndirectedGraph");
+  }
+
+  @Override
+  public boolean isLeaf(V v) {
+    throw new UnsupportedOperationException("Cannot support isLeaf(V v) in UndirectedGraph");
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-common/src/main/java/org/apache/tajo/util/graph/UndirectedGraph.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/graph/UndirectedGraph.java b/tajo-common/src/main/java/org/apache/tajo/util/graph/UndirectedGraph.java
new file mode 100644
index 0000000..454e9e9
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/util/graph/UndirectedGraph.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed 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.util.graph;
+
+
+import org.apache.tajo.annotation.NotNull;
+
+import java.util.Collection;
+
+public interface UndirectedGraph<V, E> extends Graph<V, E> {
+  Collection<E> getEdges(@NotNull V v);
+
+  int getDegree(@NotNull V v);
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-common/src/test/java/org/apache/tajo/util/graph/TestSimpleDirectedGraph.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/util/graph/TestSimpleDirectedGraph.java b/tajo-common/src/test/java/org/apache/tajo/util/graph/TestSimpleDirectedGraph.java
new file mode 100644
index 0000000..a3b10a4
--- /dev/null
+++ b/tajo-common/src/test/java/org/apache/tajo/util/graph/TestSimpleDirectedGraph.java
@@ -0,0 +1,79 @@
+/**
+ * Licensed 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.util.graph;
+
+import org.apache.tajo.util.graph.DirectedGraphVisitor;
+import org.apache.tajo.util.graph.SimpleDirectedGraph;
+import org.junit.Test;
+
+import java.util.Stack;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class TestSimpleDirectedGraph {
+
+  @Test
+  public final void test() {
+    SimpleDirectedGraph<String, Integer> graph = new SimpleDirectedGraph<String, Integer>();
+
+    //     root
+    //     /  \
+    // (1)/    \ (2)
+    //   /      \
+    // child1  child2
+    //           / \
+    //       (3)/   \(4)
+    //         /     \
+    //    child3   child4
+    //
+    String root = "root";
+    String child1 = "child1";
+    String child2 = "child2";
+    String child3 = "child3";
+    String child4 = "child4";
+
+    graph.addEdge(child1, root, 1);
+    graph.addEdge(child2, root, 2);
+    graph.addEdge(child3, child2, 3);
+    graph.addEdge(child4, child2, 4);
+
+    assertEquals(4, graph.getEdgeNum());
+    assertEquals(4, graph.getEdgesAll().size());
+
+    // tree features
+    assertTrue(graph.isRoot(root));
+    assertFalse(graph.isLeaf(root));
+
+    assertEquals(2, graph.getChildCount(root));
+    assertEquals(2, graph.getChildCount(child2));
+
+    // visitor
+    graph.accept(root, new Visitor());
+  }
+
+  private class Visitor implements DirectedGraphVisitor<String> {
+
+    @Override
+    public void visit(Stack<String> stack, String s) {
+      System.out.println("===> " + s);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-common/src/test/java/org/apache/tajo/util/graph/TestSimpleUndirectedGraph.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/util/graph/TestSimpleUndirectedGraph.java b/tajo-common/src/test/java/org/apache/tajo/util/graph/TestSimpleUndirectedGraph.java
new file mode 100644
index 0000000..6fdb138
--- /dev/null
+++ b/tajo-common/src/test/java/org/apache/tajo/util/graph/TestSimpleUndirectedGraph.java
@@ -0,0 +1,96 @@
+/**
+ * Licensed 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.util.graph;
+
+import com.google.common.collect.Sets;
+import org.apache.tajo.util.graph.SimpleUndirectedGraph;
+import org.apache.tajo.util.graph.UndirectedGraph;
+import org.junit.Test;
+
+import java.util.Set;
+
+import static org.junit.Assert.*;
+
+public class TestSimpleUndirectedGraph {
+
+  @Test
+  public final void test() {
+    UndirectedGraph<String, Integer> graph = new SimpleUndirectedGraph<String, Integer>();
+
+    //     root
+    //     /  \
+    // (1)/    \ (2)
+    //   /      \
+    // child1  child2
+    //           / \
+    //       (3)/   \(4)
+    //         /     \
+    //    child3   child4
+    //
+    String root = "root";
+    String child1 = "child1";
+    String child2 = "child2";
+    String child3 = "child3";
+    String child4 = "child4";
+
+    graph.addEdge(child1, root, 1);
+    graph.addEdge(child2, root, 2);
+    graph.addEdge(child3, child2, 3);
+    graph.addEdge(child4, child2, 4);
+
+    // for connected edges
+    assertNotNull(graph.getEdge(child1, root));
+    assertNotNull(graph.getEdge(root, child1));
+
+    assertNotNull(graph.getEdge(root, child2));
+    assertNotNull(graph.getEdge(child2, root));
+
+    assertNotNull(graph.getEdge(child2, child3));
+    assertNotNull(graph.getEdge(child3, child2));
+
+    assertNotNull(graph.getEdge(child2, child4));
+    assertNotNull(graph.getEdge(child4, child2));
+
+    // for not-connected edges
+    assertNull(graph.getEdge(root, child4));
+    assertNull(graph.getEdge(child4, root));
+
+    assertNull(graph.getEdge(root, child3));
+    assertNull(graph.getEdge(child3, root));
+
+    assertNull(graph.getEdge(child1, child2));
+    assertNull(graph.getEdge(child2, child1));
+
+    assertNull(graph.getEdge(child3, child4));
+    assertNull(graph.getEdge(child4, child3));
+
+    // number
+    assertEquals(4, graph.getEdgeNum());
+    assertEquals(4, graph.getEdgesAll().size());
+
+    assertEquals(2, graph.getDegree(root));
+    assertEquals(1, graph.getDegree(child1));
+    assertEquals(3, graph.getDegree(child2));
+    assertEquals(1, graph.getDegree(child3));
+    assertEquals(1, graph.getDegree(child4));
+
+    Set<Integer> edges = Sets.newHashSet(2, 3, 4);
+    assertEquals(edges, Sets.newHashSet(graph.getEdges(child2)));
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/b143f991/tajo-core/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-core/pom.xml b/tajo-core/pom.xml
index ca30266..fce96e4 100644
--- a/tajo-core/pom.xml
+++ b/tajo-core/pom.xml
@@ -160,13 +160,13 @@
                 <argument>--proto_path=../tajo-common/src/main/proto</argument>
                 <argument>--proto_path=../tajo-catalog/tajo-catalog-common/src/main/proto</argument>
                 <argument>--proto_path=../tajo-client/src/main/proto</argument>
+                <argument>--proto_path=../tajo-plan/src/main/proto</argument>
                 <argument>--java_out=target/generated-sources/proto</argument>
                 <argument>src/main/proto/ResourceTrackerProtocol.proto</argument>
                 <argument>src/main/proto/QueryMasterProtocol.proto</argument>
                 <argument>src/main/proto/TajoMasterProtocol.proto</argument>
                 <argument>src/main/proto/TajoWorkerProtocol.proto</argument>
                 <argument>src/main/proto/InternalTypes.proto</argument>
-                <argument>src/main/proto/Plan.proto</argument>
               </arguments>
             </configuration>
             <goals>
@@ -233,6 +233,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-plan</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
       <artifactId>tajo-catalog-client</artifactId>
     </dependency>
     <dependency>


Mime
View raw message