Package org.apache.tajo.catalog

Examples of org.apache.tajo.catalog.Schema


    return projectable;
  }

  @Override
  public void setTarget(Column[] targets) {
    this.target = new Schema(targets);
  }
View Full Code Here


    this.start = start;
    this.end = end;
  }

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

    return schema;
  }
View Full Code Here

      Bytes.readFully(indexIn, schemaBytes, 0, schemaByteSize);

      SchemaProto.Builder builder = SchemaProto.newBuilder();
      builder.mergeFrom(schemaBytes);
      SchemaProto proto = builder.build();
      this.keySchema = new Schema(proto);
      this.rowStoreDecoder = RowStoreUtil.createDecoder(keySchema);

      // comparator
      int compByteSize = indexIn.readInt();
      byte [] compBytes = new byte[compByteSize];
View Full Code Here

    }
  }
 
  public static Schema getSchemaByTargets(Schema inputSchema, Target [] targets)
      throws InternalException {
    Schema schema = new Schema();
    for (Target target : targets) {
      schema.addColumn(
          target.hasAlias() ? target.getAlias() : target.getEvalTree().getName(),
          getDomainByExpr(inputSchema, target.getEvalTree()));
    }
   
    return schema;
View Full Code Here

          }
        }

        if (node instanceof ScanNode || node instanceof JoinNode) {

          Schema baseSchema = null;
          if (node instanceof ScanNode) {
            baseSchema = ((ScanNode)node).getTableSchema();
          } else if (node instanceof JoinNode) {
            baseSchema = node.getInSchema(); // composite schema
          }

          if (newEvaluatedTargetIds.size() > 0) {
            // fill addedTargets with output columns and new expression columns (e.g., aliased column or expressions)
            Target[] addedTargets = new Target[baseSchema.getColumnNum() + newEvaluatedTargetIds.size()];
            PlannerUtil.schemaToTargets(baseSchema, addedTargets);
            int baseIdx = baseSchema.getColumnNum();
            for (int i = 0; i < newEvaluatedTargetIds.size(); i++) {
              addedTargets[baseIdx + i] = getTarget(newEvaluatedTargetIds.get(i));
            }

            // set targets to ScanNode because it needs to evaluate expressions
View Full Code Here

    assertEquals(4,i);
  }

  @Test
  public final void testPartitionFile() throws IOException {
    Schema schema = new Schema();
    schema.addColumn("key", TajoDataTypes.Type.TEXT);
    schema.addColumn("age", TajoDataTypes.Type.INT4);
    schema.addColumn("name", TajoDataTypes.Type.TEXT);

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


    Path path = StorageUtil.concatPath(testDir, "testPartitionFile", "table.csv");
View Full Code Here

      // Set the candidate to a inner relation and remove from the relation set.
      JoinNode lastJoinNode = new JoinNode(plan.newPID(), chosen.getJoinType());
      lastJoinNode.setLeftChild(lastOne); // Set the first candidate to a left relation of the first join
      lastJoinNode.setRightChild(chosen.getRelation());

      Schema merged = SchemaUtil.merge(lastJoinNode.getLeftChild().getOutSchema(),
          lastJoinNode.getRightChild().getOutSchema());
      lastJoinNode.setInSchema(merged);
      lastJoinNode.setOutSchema(merged);

      if (chosen.hasJoinQual()) {
View Full Code Here

      qualCtx = this.qual.newContext();
    }
  }

  public void init() throws IOException {
    Schema projected;
    if (plan.hasTargets()) {
      projected = new Schema();
      Set<Column> columnSet = new HashSet<Column>();

      if (plan.hasQual()) {
        columnSet.addAll(EvalTreeUtil.findDistinctRefColumns(qual));
      }

      for (Target t : plan.getTargets()) {
        columnSet.addAll(EvalTreeUtil.findDistinctRefColumns(t.getEvalTree()));
      }

      for (Column column : inSchema.getColumns()) {
        if (columnSet.contains(column)) {
          projected.addColumn(column);
        }
      }
    } else {
      projected = outSchema;
    }
View Full Code Here

                                      boolean last) throws IOException {
    BSTIndex index = new BSTIndex(new TajoConf());
    BSTIndex.BSTIndexReader idxReader =
        index.getIndexReader(new Path(outDir, "index"));
    idxReader.open();
    Schema keySchema = idxReader.getKeySchema();
    TupleComparator comparator = idxReader.getComparator();

    LOG.info("BSTIndex is loaded from disk (" + idxReader.getFirstKey() + ", "
        + idxReader.getLastKey());
View Full Code Here

  }
   
  @Test
  public void testSplitable() throws IOException {
    if (splitable) {
      Schema schema = new Schema();
      schema.addColumn("id", Type.INT4);
      schema.addColumn("age", Type.INT8);

      TableMeta meta = CatalogUtil.newTableMeta(schema, storeType);
      Path tablePath = new Path(testDir, "Splitable.data");
      Appender appender = StorageManagerFactory.getStorageManager(conf).getAppender(meta, tablePath);
      appender.enableStats();
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.