deniskuzZ commented on code in PR #6413:
URL: https://github.com/apache/hive/pull/6413#discussion_r3380341142
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsAutoGatherContext.java:
##########
@@ -274,50 +276,71 @@ private void replaceSelectOperatorProcess(SelectOperator
operator, Operator<? ex
columnExprMap.put(internalName, exprNodeDesc);
signature.add(selRSSig.get(selRSIdx));
}
+ int dynPartsCount=0;
+ if (partSpec != null) {
+ for (Map.Entry<String, String> entry : partSpec.entrySet()) {
+ if (entry.getValue() == null) {
+ dynPartsCount++;
+ }
+ }
+ }
+ boolean inputRRHasStaticParts = (this.columns.size() + dynPartsCount <
columns.size());
// if there is any partition column (in static partition or dynamic
// partition or mixed case)
- int dynamicPartBegin = -1;
+ int dynamicPartBegin = 0;
for (int i = 0; i < partitionColumns.size(); i++) {
ExprNodeDesc exprNodeDesc;
TypeInfo srcType;
String partColName = partitionColumns.get(i).getName();
+ int index = tbl.getColumnIndexByName(partColName);
+ ColumnInfo col;
+
// 2. deal with static partition columns
if (partSpec != null && partSpec.containsKey(partColName)
&& partSpec.get(partColName) != null) {
if (dynamicPartBegin > 0) {
throw new SemanticException(
"Dynamic partition columns should not come before static
partition columns.");
}
- exprNodeDesc = new ExprNodeConstantDesc(partSpec.get(partColName));
+ if (inputRRHasStaticParts) {
+ col = columns.get(index + dynamicPartBegin);
+ exprNodeDesc = new ExprNodeColumnDesc(col);
+ } else {
+ exprNodeDesc = new ExprNodeConstantDesc(partSpec.get(partColName));
+ }
srcType = exprNodeDesc.getTypeInfo();
+ if (!inputRRHasStaticParts) {
+ dynamicPartBegin--;
Review Comment:
````
if (dynamicPartBegin > 0) {
throw new SemanticException("Dynamic partition columns should not come
before static partition columns.");
}
````
is a dead code now and never fires
--
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]