deniskuzZ commented on code in PR #6600:
URL: https://github.com/apache/hive/pull/6600#discussion_r3658214661
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java:
##########
@@ -2984,50 +2985,57 @@ private RelNode genTableLogicalPlan(String tableAlias,
QB qb) throws SemanticExc
// NOTE: Table logical schema = Non Partition Cols + Partition Cols +
// Virtual Cols
- // 3.1 Add Column info for non partion cols (Object Inspector fields)
+ // 3.1 Add Column info for cols (Object Inspector fields)
final Deserializer deserializer = tabMetaData.getDeserializer();
StructObjectInspector rowObjectInspector = (StructObjectInspector)
deserializer
.getObjectInspector();
deserializer.handleJobLevelConfiguration(conf);
List<? extends StructField> fields =
rowObjectInspector.getAllStructFieldRefs();
- ColumnInfo colInfo;
- String colName;
- ArrayList<ColumnInfo> cInfoLst = new ArrayList<>();
-
final NotNullConstraint nnc = tabMetaData.getNotNullConstraint();
final PrimaryKeyInfo pkc = tabMetaData.getPrimaryKeyInfo();
+ int allColCount = tabMetaData.getAllCols().size();
+ List<ColumnInfo> colInfoList = new
ArrayList<>(Collections.nCopies(allColCount, null));
+ Set<String> partColNames = new
HashSet<>(tabMetaData.getPartColNames());
+ ArrayList<ColumnInfo> nonPartitionColumns = new
ArrayList<>(fields.size());
+
for (StructField structField : fields) {
- colName = structField.getFieldName();
- colInfo = new ColumnInfo(
+ String colName = structField.getFieldName();
+ if (partColNames.contains(colName)) {
+ continue;
+ }
+
+ ColumnInfo colInfo = new ColumnInfo(
structField.getFieldName(),
TypeInfoUtils.getTypeInfoFromObjectInspector(structField.getFieldObjectInspector()),
isNullable(colName, nnc, pkc), tableAlias, false);
colInfo.setSkewedCol(isSkewedCol(tableAlias, qb, colName));
- rr.put(tableAlias, colName, colInfo);
- cInfoLst.add(colInfo);
+ colInfoList.set(tabMetaData.getColumnIndexByName(colName), colInfo);
+ nonPartitionColumns.add(colInfo);
}
- // TODO: Fix this
- ArrayList<ColumnInfo> nonPartitionColumns = new
ArrayList<ColumnInfo>(cInfoLst);
- ArrayList<ColumnInfo> partitionColumns = new ArrayList<ColumnInfo>();
// 3.2 Add column info corresponding to partition columns
+ // Normally, the column names in a schema should be unique, but in the
case of Iceberg v1 tables,
+ // updating the partition spec doesn't remove the existing partition
keys, so we can end up with a
+ // partition spec containing multiple columns with the same name.
Review Comment:
can you elaborate? shouldn't the type be void in case column is dropped as
part of schema evolution?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]