sb.append("Partitions: \n"); sb.append("type:").append(partition.getPartitionType().name()).append("\n");
@Override public boolean equals(Object object) { if(object instanceof PartitionMethodDesc) { PartitionMethodDesc other = (PartitionMethodDesc) object; boolean eq = tableName.equals(other.tableName); eq = eq && partitionType.equals(other.partitionType); eq = eq && expression.equals(other.expression); eq = eq && TUtil.checkEquals(expressionSchema, other.expressionSchema); return eq; } return false; }
public static PartitionType valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { throw new java.lang.IllegalArgumentException( "EnumValueDescriptor is not for this type."); } return VALUES[desc.getIndex()]; }
pstmt.setString(2, table.getPartition().getPartitionType().name()); pstmt.setString(3, table.getPartition().getExpression()); pstmt.setBytes(4, table.getPartition().getExpressionSchema().toByteArray());
if (tableDesc.hasPartition() && tableDesc.getPartitionMethod().getPartitionType().equals(PartitionType.COLUMN)) { List<FieldSchema> partitionKeys = new ArrayList<>(); for (Column eachPartitionKey : tableDesc.getPartitionMethod().getExpressionSchema().getRootColumns()) {
pstmt.setString(2, table.getPartition().getPartitionType().name()); pstmt.setString(3, table.getPartition().getExpression()); pstmt.setBytes(4, table.getPartition().getExpressionSchema().toByteArray());
org.apache.tajo.catalog.proto.CatalogProtos.PartitionType value = org.apache.tajo.catalog.proto.CatalogProtos.PartitionType.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(2, rawValue);
sb.append("Partitions: \n"); sb.append("type:").append(partition.getPartitionType().name()).append("\n");
if(origPartMethod.getPartitionType().equals(newPartMethod.getPartitionType()) == false) { fail("Partition type of input tables do not match"); return false;
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, tableIdentifier_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(2, partitionType_.getNumber()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getExpressionBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, expressionSchema_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }
/** * It builds a distributed execution block for CTAS, InsertNode, and StoreTableNode. */ private ExecutionBlock buildStorePlan(GlobalPlanContext context, ExecutionBlock lastBlock, StoreTableNode currentNode) throws TajoException { 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 NotImplementedException("partition type '" + partitionMethod.getPartitionType().name() + "'"); } if (hasUnionChild(currentNode)) { // if it has union children return buildShuffleAndStorePlanToPartitionedTableWithUnion(context, currentNode, lastBlock); } else { // otherwise return buildShuffleAndStorePlanToPartitionedTable(context, currentNode, lastBlock); } } else { // if result table is not a partitioned table, directly store it return buildNoPartitionedStorePlan(context, currentNode, lastBlock); } }
/** * It builds a distributed execution block for CTAS, InsertNode, and StoreTableNode. */ private ExecutionBlock buildStorePlan(GlobalPlanContext context, ExecutionBlock lastBlock, StoreTableNode currentNode) throws TajoException { 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 NotImplementedException("partition type '" + partitionMethod.getPartitionType().name() + "'"); } if (hasUnionChild(currentNode)) { // if it has union children return buildShuffleAndStorePlanToPartitionedTableWithUnion(context, currentNode, lastBlock); } else { // otherwise return buildShuffleAndStorePlanToPartitionedTable(context, currentNode, lastBlock); } } else { // if result table is not a partitioned table, directly store it return buildNoPartitionedStorePlan(context, currentNode, lastBlock); } }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeMessage(1, tableIdentifier_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeEnum(2, partitionType_.getNumber()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getExpressionBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeMessage(4, expressionSchema_); } getUnknownFields().writeTo(output); }
private CatalogProtos.PartitionMethodProto resultToPartitionMethodProto(final String databaseName, final String tableName, final ResultSet res) throws SQLException { CatalogProtos.PartitionMethodProto.Builder partBuilder; try { partBuilder = CatalogProtos.PartitionMethodProto.newBuilder(); partBuilder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName)); partBuilder.setPartitionType(CatalogProtos.PartitionType.valueOf(res.getString("partition_type"))); partBuilder.setExpression(res.getString("expression")); partBuilder.setExpressionSchema(SchemaProto.parseFrom(res.getBytes("expression_schema"))); } catch (InvalidProtocolBufferException e) { throw new TajoInternalError(e); } return partBuilder.build(); }
private CatalogProtos.PartitionMethodProto resultToPartitionMethodProto(final String databaseName, final String tableName, final ResultSet res) throws SQLException { CatalogProtos.PartitionMethodProto.Builder partBuilder; try { partBuilder = CatalogProtos.PartitionMethodProto.newBuilder(); partBuilder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName)); partBuilder.setPartitionType(CatalogProtos.PartitionType.valueOf(res.getString("partition_type"))); partBuilder.setExpression(res.getString("expression")); partBuilder.setExpressionSchema(SchemaProto.parseFrom(res.getBytes("expression_schema"))); } catch (InvalidProtocolBufferException e) { throw new TajoInternalError(e); } return partBuilder.build(); }
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(")"); }
public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(index); } public final com.google.protobuf.Descriptors.EnumDescriptor
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(")"); }
public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } public static final com.google.protobuf.Descriptors.EnumDescriptor
@Override public boolean equals(Object object) { if(object instanceof PartitionMethodDesc) { PartitionMethodDesc other = (PartitionMethodDesc) object; boolean eq = tableName.equals(other.tableName); eq = eq && partitionType.equals(other.partitionType); eq = eq && expression.equals(other.expression); eq = eq && TUtil.checkEquals(expressionSchema, other.expressionSchema); return eq; } return false; }