pstmt = conn.prepareStatement(existColumnSql); pstmt.setInt(1, tableId); pstmt.setString(2, extractSimpleName(columnProto.getName())); resultSet = pstmt.executeQuery(); throw new DuplicateColumnException(columnProto.getName()); pstmt.setString(2, extractSimpleName(columnProto.getName())); pstmt.setInt(3, position + 1); pstmt.setString(4, TypeStringEncoder.encode(type));
sb.append(index.getIndexMethod()).append(" ("); for (SortSpecProto key : index.getKeySortSpecsList()) { sb.append(CatalogUtil.extractSimpleName(key.getColumn().getName())); sb.append(key.getAscending() ? " ASC" : " DESC"); sb.append(key.getNullFirst() ? " NULLS FIRST, " : " NULLS LAST, ");
sb.append(index.getIndexMethod()).append(" ("); for (SortSpecProto key : index.getKeySortSpecsList()) { sb.append(IdentifierUtil.extractSimpleName(key.getColumn().getName())); sb.append(key.getAscending() ? " ASC" : " DESC"); sb.append(key.getNullFirst() ? " NULLS FIRST, " : " NULLS LAST, ");
pstmt.setString(2, extractSimpleName(col.getName())); pstmt.setInt(3, i); pstmt.setString(4, TypeStringEncoder.encode(type));
sb.append(", "); sb.append(sortSpec.getColumn().getName()); sb.append(" (").append(sortSpec.getAscending() ? "asc":"desc").append(")"); String delim = ""; for (CatalogProtos.SortSpecProto sortSpec: sortSpecArray.getSortSpecsList()) { sb.append(delim).append(sortSpec.getColumn().getName()); delim = ",";
sb.append(", "); sb.append(sortSpec.getColumn().getName()); sb.append(" (").append(sortSpec.getAscending() ? "asc":"desc").append(")"); String delim = ""; for (CatalogProtos.SortSpecProto sortSpec: sortSpecArray.getSortSpecsList()) { sb.append(delim).append(sortSpec.getColumn().getName()); delim = ",";
partitionName.append(File.separator); partitionName.append(IdentifierUtil.extractSimpleName(parititonColumns.get(i).getName())); partitionName.append("="); partitionName.append(hivePartition.getValues().get(i));
pstmt = conn.prepareStatement(existColumnSql); pstmt.setInt(1, tableId); pstmt.setString(2, CatalogUtil.extractSimpleName(columnProto.getName())); resultSet = pstmt.executeQuery(); throw new DuplicateColumnException(columnProto.getName()); pstmt.setString(2, CatalogUtil.extractSimpleName(columnProto.getName())); pstmt.setInt(3, position + 1); pstmt.setInt(4, dataType.hasNumNestedFields() ? dataType.getNumNestedFields() : 0);
aTuple.put(fieldId, DatumFactory.createText(column.getName())); } else if ("ordinal_position".equalsIgnoreCase(colObj.getSimpleName())) { aTuple.put(fieldId, DatumFactory.createInt4(columnId));
aTuple.put(fieldId, DatumFactory.createText(column.getName())); } else if ("ordinal_position".equalsIgnoreCase(colObj.getSimpleName())) { aTuple.put(fieldId, DatumFactory.createInt4(columnId));
/** * This method transforms a list of ColumnProtos into a schema tree. * It assumes that <code>protos</code> contains a list of ColumnProtos in the depth-first order. * * @param tobeAdded * @param protos * @param serializedColumnIndex */ private static void deserializeColumn(List<Column> tobeAdded, List<ColumnProto> protos, int serializedColumnIndex) { ColumnProto columnProto = protos.get(serializedColumnIndex); if (columnProto.getDataType().getType() == Type.RECORD) { // Get the number of child fields int childNum = columnProto.getDataType().getNumNestedFields(); // where is start index of nested fields? int childStartIndex = tobeAdded.size() - childNum; // Extract nested fields List<Column> nestedColumns = TUtil.newList(tobeAdded.subList(childStartIndex, childStartIndex + childNum)); // Remove nested fields from the the current level for (int i = 0; i < childNum; i++) { tobeAdded.remove(tobeAdded.size() - 1); } // Add the nested fields to the list as a single record column tobeAdded.add(new Column(columnProto.getName(), new TypeDesc(new Schema(nestedColumns)))); } else { tobeAdded.add(new Column(protos.get(serializedColumnIndex))); } }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.tajo.catalog.proto.CatalogProtos.ColumnProto)) { return super.equals(obj); } org.apache.tajo.catalog.proto.CatalogProtos.ColumnProto other = (org.apache.tajo.catalog.proto.CatalogProtos.ColumnProto) obj; boolean result = true; result = result && (hasName() == other.hasName()); if (hasName()) { result = result && getName() .equals(other.getName()); } result = result && (hasTid() == other.hasTid()); if (hasTid()) { result = result && (getTid() == other.getTid()); } result = result && (hasDataType() == other.hasDataType()); if (hasDataType()) { result = result && getDataType() .equals(other.getDataType()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); } if (hasTid()) { hash = (37 * hash) + TID_FIELD_NUMBER; hash = (53 * hash) + getTid(); } if (hasDataType()) { hash = (37 * hash) + DATATYPE_FIELD_NUMBER; hash = (53 * hash) + getDataType().hashCode(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; }
private void addNewColumn(String databaseName, String tableName, CatalogProtos.ColumnProto columnProto) { HiveCatalogStoreClientPool.HiveCatalogStoreClient client = null; try { client = clientPool.getClient(); Table table = client.getHiveClient().getTable(databaseName, tableName); List<FieldSchema> columns = table.getSd().getCols(); columns.add(new FieldSchema(columnProto.getName(), HiveCatalogUtil.getHiveFieldType(TypeProtobufEncoder.decode(columnProto.getType())), "")); client.getHiveClient().alter_table(databaseName, tableName, table); } catch (NoSuchObjectException nsoe) { } catch (Exception e) { throw new TajoInternalError(e); } finally { if (client != null) { client.release(); } } }
public Column(ColumnProto proto) { name = proto.getName(); type = TypeProtobufEncoder.decode(proto.getType()); }
public Column(ColumnProto proto) { name = proto.getName(); typeDesc = new TypeDesc(proto.getDataType()); }
/** * <code>required string name = 1;</code> */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); onChanged(); return this; } /**