Examples of PartitionMethodDesc


Examples of org.apache.tajo.catalog.partition.PartitionMethodDesc

      sb.append("\n");
    }

    sb.append("\n");
    if (desc.getPartitionMethod() != null) {
      PartitionMethodDesc partition = desc.getPartitionMethod();
      sb.append("Partitions: \n");

      sb.append("type:").append(partition.getPartitionType().name()).append("\n");

      sb.append("columns:").append(":");
      sb.append(TUtil.arrayToString(partition.getExpressionSchema().toArray()));
    }

    return sb.toString();
  }
View Full Code Here

Examples of org.apache.tajo.catalog.partition.PartitionMethodDesc

  private static void buildLocationClause(StringBuilder sb, TableDesc desc) {
    sb.append(" LOCATION '").append(desc.getPath()).append("'");
  }

  private static void buildPartitionClause(StringBuilder sb, TableDesc desc) {
    PartitionMethodDesc partitionDesc = desc.getPartitionMethod();

    sb.append(" PARTITION BY ");
    sb.append(partitionDesc.getPartitionType().name());

    // columns
    sb.append("(");
    String prefix = "";
    for (Column column : partitionDesc.getExpressionSchema().toArray()) {
      sb.append(prefix).append(CatalogUtil.columnToDDLString(column));
      prefix = ", ";
    }
    sb.append(")");
  }
View Full Code Here

Examples of org.apache.tajo.catalog.partition.PartitionMethodDesc

    return paths;
  }

  private Path [] findFilteredPartitionPaths(ScanNode scanNode) throws IOException {
    TableDesc table = scanNode.getTableDesc();
    PartitionMethodDesc partitionDesc = scanNode.getTableDesc().getPartitionMethod();

    Schema paritionValuesSchema = new Schema();
    for (Column column : partitionDesc.getExpressionSchema().getColumns()) {
      paritionValuesSchema.addColumn(column);
    }

    Set<EvalNode> indexablePredicateSet = Sets.newHashSet();
View Full Code Here

Examples of org.apache.tajo.catalog.partition.PartitionMethodDesc

   * TODO - This implementation assumes that a fragment is always FileFragment.
   * In the column partitioned table, a path has an important role to
   * indicate partition keys. In this time, it is right. Later, we have to fix it.
   */
  private void rewriteColumnPartitionedTableSchema() throws IOException {
    PartitionMethodDesc partitionDesc = plan.getTableDesc().getPartitionMethod();
    Schema columnPartitionSchema = SchemaUtil.clone(partitionDesc.getExpressionSchema());
    String qualifier = inSchema.getColumn(0).getQualifier();
    columnPartitionSchema.setQualifier(qualifier);

    // Remove partition key columns from an input schema.
    this.inSchema = plan.getTableDesc().getSchema();
View Full Code Here

Examples of org.apache.tajo.catalog.partition.PartitionMethodDesc


    if(currentNode.hasPartition()) { // if a target table is a partitioned table

      // Verify supported partition types
      PartitionMethodDesc partitionMethod = currentNode.getPartitionMethod();
      if (partitionMethod.getPartitionType() != CatalogProtos.PartitionType.COLUMN) {
        throw new PlanningException(String.format("Not supported partitionsType :%s",
            partitionMethod.getPartitionType()));
      }

      if (hasUnionChild(currentNode)) { // if it has union children
        return buildShuffleAndStorePlanToPartitionedTableWithUnion(context, currentNode, lastBlock);
      } else { // otherwise
View Full Code Here

Examples of org.apache.tajo.catalog.partition.PartitionMethodDesc

    }
  }

  private void setShuffleKeysFromPartitionedTableStore(StoreTableNode node, DataChannel channel) {
    Preconditions.checkState(node.hasTargetTable(), "A target table must be a partitioned table.");
    PartitionMethodDesc partitionMethod = node.getPartitionMethod();

    if (node.getType() == NodeType.INSERT) {
      InsertNode insertNode = (InsertNode) node;
      channel.setSchema(((InsertNode)node).getProjectedSchema());
      Column [] shuffleKeys = new Column[partitionMethod.getExpressionSchema().size()];
      int i = 0;
      for (Column column : partitionMethod.getExpressionSchema().getColumns()) {
        int id = insertNode.getTableSchema().getColumnId(column.getQualifiedName());
        shuffleKeys[i++] = insertNode.getProjectedSchema().getColumn(id);
      }
      channel.setShuffleKeys(shuffleKeys);
    } else {
      channel.setShuffleKeys(partitionMethod.getExpressionSchema().toArray());
    }
    channel.setShuffleType(HASH_SHUFFLE);
    channel.setShuffleOutputNum(32);
  }
View Full Code Here

Examples of org.apache.tajo.catalog.partition.PartitionMethodDesc

      } else {
        // if no table definition, the select clause's output schema will be used.
        // ex) CREATE TABLE tbl AS SELECT ...

        if (expr.hasPartition()) {
          PartitionMethodDesc partitionMethod = createTableNode.getPartitionMethod();

          Schema queryOutputSchema = subQuery.getOutSchema();
          Schema partitionExpressionSchema = partitionMethod.getExpressionSchema();
          if (partitionMethod.getPartitionType() == CatalogProtos.PartitionType.COLUMN &&
              queryOutputSchema.size() < partitionExpressionSchema.size()) {
            throw new VerifyException("Partition columns cannot be more than table columns.");
          }
          Schema tableSchema = new Schema();
          for (int i = 0; i < queryOutputSchema.size() - partitionExpressionSchema.size(); i++) {
View Full Code Here

Examples of org.apache.tajo.catalog.partition.PartitionMethodDesc

  }

  private PartitionMethodDesc getPartitionMethod(PlanContext context,
                                                 String tableName,
                                                 CreateTable.PartitionMethodDescExpr expr) throws PlanningException {
    PartitionMethodDesc partitionMethodDesc;

    if(expr.getPartitionType() == PartitionType.COLUMN) {
      CreateTable.ColumnPartition partition = (CreateTable.ColumnPartition) expr;
      String partitionExpression = Joiner.on(',').join(partition.getColumns());

      partitionMethodDesc = new PartitionMethodDesc(context.session.getCurrentDatabase(), tableName,
          CatalogProtos.PartitionType.COLUMN, partitionExpression, convertColumnsToSchema(partition.getColumns()));
    } else {
      throw new PlanningException(String.format("Not supported PartitonType: %s", expr.getPartitionType()));
    }
    return partitionMethodDesc;
View Full Code Here

Examples of org.apache.tajo.catalog.partition.PartitionMethodDesc


    Schema partSchema = new Schema();
    partSchema.addColumn("id", Type.INT4);

    PartitionMethodDesc partitionDesc =
        new PartitionMethodDesc(DEFAULT_DATABASE_NAME, tableName,
            CatalogProtos.PartitionType.HASH, "id", partSchema);

    TableDesc desc =
        new TableDesc(tableName, schema, meta,
            new Path(CommonTestingUtil.getTestDir(), "addedtable"));
View Full Code Here

Examples of org.apache.tajo.catalog.partition.PartitionMethodDesc

    opts.put("file.delimiter", ",");
    TableMeta meta = CatalogUtil.newTableMeta(StoreType.CSV, opts);

    Schema partSchema = new Schema();
    partSchema.addColumn("id", Type.INT4);
    PartitionMethodDesc partitionDesc =
        new PartitionMethodDesc(DEFAULT_DATABASE_NAME, tableName,
            CatalogProtos.PartitionType.HASH, "id", partSchema);

    TableDesc desc =
        new TableDesc(tableName, schema, meta,
            new Path(CommonTestingUtil.getTestDir(), "addedtable"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.