tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [6/8] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into index_support
Date Sat, 18 Apr 2015 03:41:12 GMT
http://git-wip-us.apache.org/repos/asf/tajo/blob/882297e7/tajo-plan/src/main/java/org/apache/tajo/plan/serder/LogicalNodeDeserializer.java
----------------------------------------------------------------------
diff --cc tajo-plan/src/main/java/org/apache/tajo/plan/serder/LogicalNodeDeserializer.java
index 71a47c3,84991bb..e97918e
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/serder/LogicalNodeDeserializer.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/serder/LogicalNodeDeserializer.java
@@@ -31,12 -32,8 +32,9 @@@ import org.apache.tajo.catalog.partitio
  import org.apache.tajo.catalog.proto.CatalogProtos;
  import org.apache.tajo.exception.UnimplementedException;
  import org.apache.tajo.plan.Target;
- import org.apache.tajo.plan.expr.AggregationFunctionCallEval;
- import org.apache.tajo.plan.expr.EvalNode;
- import org.apache.tajo.plan.expr.FieldEval;
- import org.apache.tajo.plan.expr.WindowFunctionEval;
+ import org.apache.tajo.plan.expr.*;
  import org.apache.tajo.plan.logical.*;
 +import org.apache.tajo.plan.rewrite.rules.IndexScanInfo.SimplePredicate;
  import org.apache.tajo.util.KeyValueSet;
  import org.apache.tajo.util.TUtil;
  
@@@ -127,14 -123,11 +126,14 @@@ public class LogicalNodeDeserializer 
          current = convertUnion(nodeMap, protoNode);
          break;
        case PARTITIONS_SCAN:
-         current = convertPartitionScan(context, protoNode);
+         current = convertPartitionScan(context, evalContext, protoNode);
          break;
        case SCAN:
-         current = convertScan(context, protoNode);
+         current = convertScan(context, evalContext, protoNode);
          break;
 +      case INDEX_SCAN:
-         current = convertIndexScan(context, protoNode);
++        current = convertIndexScan(context, evalContext, protoNode);
 +        break;
  
        case CREATE_TABLE:
          current = convertCreateTable(nodeMap, protoNode);
@@@ -436,26 -431,10 +444,27 @@@
      scan.setOutSchema(convertSchema(protoNode.getOutSchema()));
    }
  
-   private static IndexScanNode convertIndexScan(OverridableConf context, PlanProto.LogicalNode
protoNode) {
++  private static IndexScanNode convertIndexScan(OverridableConf context, EvalContext evalContext,
++                                                PlanProto.LogicalNode protoNode) {
 +    IndexScanNode indexScan = new IndexScanNode(protoNode.getNodeId());
-     fillScanNode(context, protoNode, indexScan);
++    fillScanNode(context, evalContext, protoNode, indexScan);
 +
 +    PlanProto.IndexScanSpec indexScanSpec = protoNode.getIndexScan();
 +    SimplePredicate[] predicates = new SimplePredicate[indexScanSpec.getPredicatesCount()];
 +    for (int i = 0; i < predicates.length; i++) {
 +      predicates[i] = new SimplePredicate(indexScanSpec.getPredicates(i));
 +    }
 +
 +    indexScan.set(new Schema(indexScanSpec.getKeySchema()), predicates,
 +        TUtil.stringToURI(indexScanSpec.getIndexPath()));
 +
 +    return indexScan;
 +  }
 +
-   private static PartitionedTableScanNode convertPartitionScan(OverridableConf context,
+   private static PartitionedTableScanNode convertPartitionScan(OverridableConf context,
EvalContext evalContext,
                                                                 PlanProto.LogicalNode protoNode)
{
      PartitionedTableScanNode partitionedScan = new PartitionedTableScanNode(protoNode.getNodeId());
-     fillScanNode(context, protoNode, partitionedScan);
+     fillScanNode(context, evalContext, protoNode, partitionedScan);
  
      PlanProto.PartitionScanSpec partitionScanProto = protoNode.getPartitionScan();
      Path [] paths = new Path[partitionScanProto.getPathsCount()];
@@@ -632,47 -611,7 +641,47 @@@
      return truncateTable;
    }
  
 +  private static CreateIndexNode convertCreateIndex(Map<Integer, LogicalNode> nodeMap,
 +                                                    PlanProto.LogicalNode protoNode) {
 +    CreateIndexNode createIndex = new CreateIndexNode(protoNode.getNodeId());
 +
 +    PlanProto.CreateIndexNode createIndexProto = protoNode.getCreateIndex();
 +    createIndex.setIndexName(createIndexProto.getIndexName());
 +    createIndex.setIndexMethod(createIndexProto.getIndexMethod());
 +    try {
 +      createIndex.setIndexPath(new URI(createIndexProto.getIndexPath()));
 +    } catch (URISyntaxException e) {
 +      e.printStackTrace();
 +    }
 +    SortSpec[] keySortSpecs = new SortSpec[createIndexProto.getKeySortSpecsCount()];
 +    for (int i = 0; i < keySortSpecs.length; i++) {
 +      keySortSpecs[i] = new SortSpec(createIndexProto.getKeySortSpecs(i));
 +    }
 +    createIndex.setKeySortSpecs(new Schema(createIndexProto.getTargetRelationSchema()),
 +        keySortSpecs);
 +    createIndex.setUnique(createIndexProto.getIsUnique());
 +    createIndex.setClustered(createIndexProto.getIsClustered());
 +    if (createIndexProto.hasIndexProperties()) {
 +      createIndex.setOptions(new KeyValueSet(createIndexProto.getIndexProperties()));
 +    }
 +    createIndex.setChild(nodeMap.get(createIndexProto.getChildSeq()));
 +    createIndex.setInSchema(convertSchema(protoNode.getInSchema()));
 +    createIndex.setOutSchema(convertSchema(protoNode.getOutSchema()));
 +    createIndex.setExternal(createIndexProto.getIsExternal());
 +
 +    return createIndex;
 +  }
 +
 +  private static DropIndexNode convertDropIndex(PlanProto.LogicalNode protoNode) {
 +    DropIndexNode dropIndex = new DropIndexNode(protoNode.getNodeId());
 +
 +    PlanProto.DropIndexNode dropIndexProto = protoNode.getDropIndex();
 +    dropIndex.setIndexName(dropIndexProto.getIndexName());
 +
 +    return dropIndex;
 +  }
 +
-   private static AggregationFunctionCallEval [] convertAggFuncCallEvals(OverridableConf
context,
+   private static AggregationFunctionCallEval [] convertAggFuncCallEvals(OverridableConf
context, EvalContext evalContext,
                                                                         List<PlanProto.EvalNodeTree>
evalTrees) {
      AggregationFunctionCallEval [] aggFuncs = new AggregationFunctionCallEval[evalTrees.size()];
      for (int i = 0; i < aggFuncs.length; i++) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/882297e7/tajo-plan/src/main/proto/Plan.proto
----------------------------------------------------------------------


Mime
View raw message