@Override public List<TablePartitionProto> getAllPartitions() { Connection conn = null; Statement stmt = null; ResultSet resultSet = null; List<TablePartitionProto> partitions = new ArrayList<TablePartitionProto>(); try { String sql = "SELECT " + COL_PARTITIONS_PK + ", " + COL_TABLES_PK + ", PARTITION_NAME, " + " PATH FROM " + TB_PARTTIONS; conn = getConnection(); stmt = conn.createStatement(); resultSet = stmt.executeQuery(sql); while (resultSet.next()) { TablePartitionProto.Builder builder = TablePartitionProto.newBuilder(); builder.setPartitionId(resultSet.getInt(COL_PARTITIONS_PK)); builder.setTid(resultSet.getInt(COL_TABLES_PK)); builder.setPartitionName(resultSet.getString("PARTITION_NAME")); builder.setPath(resultSet.getString("PATH")); partitions.add(builder.build()); } } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(stmt, resultSet); } return partitions; }
public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_;
public Builder mergeFrom(org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto other) { if (other == org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto.getDefaultInstance()) return this; if (other.hasPartitionId()) { setPartitionId(other.getPartitionId()); } if (other.hasTid()) { setTid(other.getTid()); } if (other.hasPartitionName()) { bitField0_ |= 0x00000004; partitionName_ = other.partitionName_; onChanged(); } if (other.hasPath()) { bitField0_ |= 0x00000008; path_ = other.path_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
@Override public List<TablePartitionProto> getAllPartitions() { List<TablePartitionProto> partitions = new ArrayList<>(); String sql = "SELECT " + COL_PARTITIONS_PK + ", " + COL_TABLES_PK + ", PARTITION_NAME, " + " PATH FROM " + TB_PARTTIONS; try (Statement stmt = getConnection().createStatement(); ResultSet resultSet = stmt.executeQuery(sql)) { while (resultSet.next()) { TablePartitionProto.Builder builder = TablePartitionProto.newBuilder(); builder.setPartitionId(resultSet.getInt(COL_PARTITIONS_PK)); builder.setTid(resultSet.getInt(COL_TABLES_PK)); builder.setPartitionName(resultSet.getString("PARTITION_NAME")); builder.setPath(resultSet.getString("PATH")); partitions.add(builder.build()); } } catch (SQLException se) { throw new TajoInternalError(se); } return partitions; }
/** * <code>repeated .TablePartitionProto part = 2;</code> */ public Builder addPart( org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto.Builder builderForValue) { if (partBuilder_ == null) { ensurePartIsMutable(); part_.add(builderForValue.build()); onChanged(); } else { partBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * <code>repeated .TablePartitionProto part = 2;</code> */ public Builder addPart( int index, org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto.Builder builderForValue) { if (partBuilder_ == null) { ensurePartIsMutable(); part_.add(index, builderForValue.build()); onChanged(); } else { partBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .TablePartitionProto part = 2;</code> */ public Builder addPart( int index, org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto.Builder builderForValue) { if (partBuilder_ == null) { ensurePartIsMutable(); part_.add(index, builderForValue.build()); onChanged(); } else { partBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .TablePartitionProto part = 2;</code> */ public Builder addPart( org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto.Builder builderForValue) { if (partBuilder_ == null) { ensurePartIsMutable(); part_.add(builderForValue.build()); onChanged(); } else { partBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * <code>repeated .TablePartitionProto part = 2;</code> */ public Builder setPart( int index, org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto.Builder builderForValue) { if (partBuilder_ == null) { ensurePartIsMutable(); part_.set(index, builderForValue.build()); onChanged(); } else { partBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .TablePartitionProto part = 2;</code> */ public Builder setPart( int index, org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto.Builder builderForValue) { if (partBuilder_ == null) { ensurePartIsMutable(); part_.set(index, builderForValue.build()); onChanged(); } else { partBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
public static Builder newBuilder(org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }
private Builder() { maybeForceBuilderInitialization(); }
private static Builder create() { return new Builder(); }
public Builder clone() { return create().mergeFrom(buildPartial()); }
@java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /**
public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto) { return mergeFrom((org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto)other); } else { super.mergeFrom(other); return this; } }
public final boolean isInitialized() { if (!hasPartitionId()) { return false; } if (!hasTid()) { return false; } return true; }
private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() {
public org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto build() { org.apache.tajo.catalog.proto.CatalogProtos.TablePartitionProto result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }