SourabhBadhya commented on code in PR #4571: URL: https://github.com/apache/hive/pull/4571#discussion_r1299727290
########## ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java: ########## @@ -8595,6 +8634,94 @@ These props are now enabled elsewhere (see commit diffs). It would be better in SessionState.get().getConf().set(AcidUtils.CONF_ACID_KEY, "true"); } + private Operator genConversionSelectOperatorByAddPartition(String dest, QB qb, Operator input, + Deserializer deserializer, Table table, Map<String, String> partitionSpec) throws SemanticException { + StructObjectInspector oi = null; + try { + oi = (StructObjectInspector) deserializer.getObjectInspector(); + } catch (Exception e) { + throw new SemanticException(e); + } + + // Check column number + List<? extends StructField> tableFields = oi.getAllStructFieldRefs(); + List<ColumnInfo> rowFields = opParseCtx.get(input).getRowResolver().getColumnInfos(); + int inColumnCnt = rowFields.size(); + int outColumnCnt = tableFields.size(); + List<ExprNodeDesc> expressions = new ArrayList<>(outColumnCnt); + + // if target table is always unpartitioned, then the output object inspector will already contain the partition cols + // too, therefore we shouldn't add the partition col num to the output col num + boolean alreadyContainsPartCols = Optional.ofNullable(table) + .map(Table::getStorageHandler) + .map(HiveStorageHandler::alwaysUnpartitioned) + .orElse(Boolean.FALSE); Review Comment: Added a `destinationTable != null` clause. Done. -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org