Package org.apache.tajo.catalog

Examples of org.apache.tajo.catalog.Schema


      // This part is required because some node does not have any targets,
      // if the node has the same input and output schemas.

      Target[] checkingTargets;
      if (!projectable.hasTargets()) {
        Schema outSchema = node.getOutSchema();
        checkingTargets = new Target[outSchema.getColumnNum() + newEvaluatedTargetIds.size()];
        PlannerUtil.schemaToTargets(outSchema, checkingTargets);
        int baseIdx = outSchema.getColumnNum();
        for (int i = 0; i < newEvaluatedTargetIds.size(); i++) {
          checkingTargets[baseIdx + i] = targetListManager.getTarget(newEvaluatedTargetIds.get(i));
        }
      } else {
        checkingTargets = projectable.getTargets();
View Full Code Here


      }
    }
    if(maxIndex == null) {
      return null;
    } else {
      Schema keySchema = new Schema();
      for(int i = 0 ; i < maxIndex.length ; i ++ ) {
        keySchema.addColumn(maxIndex[i].getSortKey());
      }
      Datum[] datum = new Datum[nodeList.size()];
      for(int i = 0 ; i < nodeList.size() ; i ++ ) {
        datum[i] = ((ConstEval)(nodeList.get(i).getRightExpr())).getValue();
      }
View Full Code Here

        }
      }

      // Getting new target list and updating input/output schema from the new target list.
      Target[] targetArray = firstStepTargets.toArray(new Target[firstStepTargets.size()]);
      Schema targetSchema = PlannerUtil.targetToSchema(targetArray);
      List<Target> newTarget = Lists.newArrayList();
      for (Column column : groupBy.getGroupingColumns()) {
        if (!targetSchema.contains(column.getQualifiedName())) {
          newTarget.add(new Target(new FieldEval(column)));
        }
      }
      targetArray = ObjectArrays.concat(targetArray, newTarget.toArray(new Target[newTarget.size()]), Target.class);
View Full Code Here

    return specs;
  }

  public static Schema sortSpecsToSchema(SortSpec[] sortSpecs) {
    Schema schema = new Schema();
    for (SortSpec spec : sortSpecs) {
      schema.addColumn(spec.getSortKey());
    }

    return schema;
  }
View Full Code Here

      return this.pairs;
    }
  }

  public static Schema targetToSchema(Target[] targets) {
    Schema schema = new Schema();
    for(Target t : targets) {
      DataType type = t.getEvalTree().getValueType();
      String name;
      if (t.hasAlias()) {
        name = t.getAlias();
      } else {
        name = t.getEvalTree().getName();
      }
      schema.addColumn(name, type);
    }

    return schema;
  }
View Full Code Here

    this.srcId = new ExecutionBlockId(proto.getSrcId());
    this.targetId = new ExecutionBlockId(proto.getTargetId());
    this.transmitType = proto.getTransmitType();
    this.partitionType = proto.getPartitionType();
    if (proto.hasSchema()) {
      this.setSchema(new Schema(proto.getSchema()));
    }
    if (proto.getPartitionKeyCount() > 0) {
      key = new Column[proto.getPartitionKeyCount()];
      for (int i = 0; i < proto.getPartitionKeyCount(); i++) {
        key[i] = new Column(proto.getPartitionKey(i));
View Full Code Here

      if (relationOp == null) {
        throw new NoSuchColumnException(columnRef.getCanonicalName());
      }

      Schema schema = relationOp.getTableSchema();

      Column column = schema.getColumnByFQN(columnRef.getCanonicalName());
      if (column == null) {
        throw new VerifyException("ERROR: no such a column '"+ columnRef.getCanonicalName() + "'");
      }

      return column;
View Full Code Here

  public void teardown() throws Exception {
  }

  @Test
  public void test() throws IOException {
    Schema schema = new Schema();
    schema.addColumn("id", Type.INT4);
    schema.addColumn("age", Type.INT8);
    schema.addColumn("description", Type.TEXT);

    TableMeta meta = CatalogUtil.newTableMeta(schema, StoreType.ROWFILE);

    AbstractStorageManager sm = StorageManagerFactory.getStorageManager(conf, new Path(conf.getVar(ConfVars.ROOT_DIR)));
View Full Code Here

  private TableMeta meta1;
  private Path path;
 
  @Before
  public final void setUp() throws Exception {
    schema1 = new Schema();
    schema1.addColumn("id", Type.INT4);
    schema1.addColumn("name", Type.TEXT);
    meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
    path = CommonTestingUtil.getTestDir();
  }
View Full Code Here

import org.apache.tajo.catalog.Schema;
import org.apache.tajo.common.TajoDataTypes.DataType;

public class SchemaUtil {
  public static Schema merge(Schema left, Schema right) {
    Schema merged = new Schema();
    for(Column col : left.getColumns()) {
      if (!merged.contains(col.getQualifiedName())) {
        merged.addColumn(col);
      }
    }
    for(Column col : right.getColumns()) {
      if (!merged.contains(col.getQualifiedName())) {
        merged.addColumn(col);
      }
    }
   
    return merged;
  }
View Full Code Here

TOP

Related Classes of org.apache.tajo.catalog.Schema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.