ramitg254 commented on code in PR #6413:
URL: https://github.com/apache/hive/pull/6413#discussion_r3391198808
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:
##########
@@ -11999,47 +12007,45 @@ private Operator genTablePlan(String alias, QB qb)
throws SemanticException {
// Determine row schema for TSOP.
// Include column names from SerDe, the partition and virtual columns.
rwsch = new RowResolver();
- try {
- // Including parameters passed in the query
- if (properties != null) {
- for (Entry<String, String> prop : properties.entrySet()) {
- if (tab.getSerdeParam(prop.getKey()) != null) {
- LOG.warn("SerDe property in input query overrides stored SerDe
property");
- }
- tab.setSerdeParam(prop.getKey(), prop.getValue());
+ // Including parameters passed in the query
+ if (properties != null) {
+ for (Entry<String, String> prop : properties.entrySet()) {
+ if (tab.getSerdeParam(prop.getKey()) != null) {
+ LOG.warn("SerDe property in input query overrides stored SerDe
property");
}
+ tab.setSerdeParam(prop.getKey(), prop.getValue());
}
- // Obtain inspector for schema
- final Deserializer deserializer = tab.getDeserializer();
- StructObjectInspector rowObjectInspector = (StructObjectInspector)
deserializer.getObjectInspector();
+ }
+ final Deserializer deserializer = tab.getDeserializer();
- deserializer.handleJobLevelConfiguration(conf);
- List<? extends StructField> fields = rowObjectInspector
- .getAllStructFieldRefs();
- Set<String> partCols = tab.hasNonNativePartitionSupport() ?
- Sets.newHashSet(tab.getPartColNames()) : Collections.emptySet();
- for (int i = 0; i < fields.size(); i++) {
- /**
- * if the column is a skewed column, use ColumnInfo accordingly
- */
- ColumnInfo colInfo = new ColumnInfo(fields.get(i).getFieldName(),
- TypeInfoUtils.getTypeInfoFromObjectInspector(fields.get(i)
- .getFieldObjectInspector()), alias, false);
- if (partCols.contains(colInfo.getInternalName())) {
- colInfo.setHiddenPartitionCol(true);
- }
- colInfo.setSkewedCol(isSkewedCol(alias, qb,
fields.get(i).getFieldName()));
- rwsch.put(alias, fields.get(i).getFieldName(), colInfo);
+ deserializer.handleJobLevelConfiguration(conf);
+
+ int colCount = tab.getAllCols().size();
+ List<ColumnInfo> colInfoList = new
ArrayList<>(Collections.nCopies(colCount, null));
+ List<String> colNameList = new ArrayList<>(Collections.nCopies(colCount,
null));
+
+ for (FieldSchema field : tab.getCols()) {
Review Comment:
yes this should work, done
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/RewriteSemanticAnalyzer.java:
##########
@@ -117,18 +117,24 @@ protected void analyzeRewrittenTree(ASTNode
rewrittenTree, Context rewrittenCtx)
*/
protected void checkValidSetClauseTarget(ASTNode colName, Table targetTable)
throws SemanticException {
String columnName = normalizeColName(colName.getText());
-
// Make sure this isn't one of the partitioning columns, that's not
supported.
+ boolean foundColumnInTargetTable = false;
for (FieldSchema fschema : targetTable.getPartCols()) {
if (fschema.getName().equalsIgnoreCase(columnName)) {
+ if (targetTable.hasNonNativePartitionSupport()) {
+ foundColumnInTargetTable = true;
+ break;
+ }
throw new
SemanticException(ErrorMsg.UPDATE_CANNOT_UPDATE_PART_VALUE.getMsg());
}
}
//updating bucket column should move row from one file to another - not
supported
if (targetTable.getBucketCols() != null &&
targetTable.getBucketCols().contains(columnName)) {
throw new SemanticException(ErrorMsg.UPDATE_CANNOT_UPDATE_BUCKET_VALUE,
columnName);
}
- boolean foundColumnInTargetTable = false;
+ if (foundColumnInTargetTable) {
+ return;
+ }
for (FieldSchema col : targetTable.getCols()) {
Review Comment:
done
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/RewriteSemanticAnalyzer.java:
##########
@@ -117,18 +117,24 @@ protected void analyzeRewrittenTree(ASTNode
rewrittenTree, Context rewrittenCtx)
*/
protected void checkValidSetClauseTarget(ASTNode colName, Table targetTable)
throws SemanticException {
String columnName = normalizeColName(colName.getText());
-
// Make sure this isn't one of the partitioning columns, that's not
supported.
+ boolean foundColumnInTargetTable = false;
for (FieldSchema fschema : targetTable.getPartCols()) {
if (fschema.getName().equalsIgnoreCase(columnName)) {
+ if (targetTable.hasNonNativePartitionSupport()) {
+ foundColumnInTargetTable = true;
+ break;
+ }
throw new
SemanticException(ErrorMsg.UPDATE_CANNOT_UPDATE_PART_VALUE.getMsg());
}
}
//updating bucket column should move row from one file to another - not
supported
if (targetTable.getBucketCols() != null &&
targetTable.getBucketCols().contains(columnName)) {
throw new SemanticException(ErrorMsg.UPDATE_CANNOT_UPDATE_BUCKET_VALUE,
columnName);
}
- boolean foundColumnInTargetTable = false;
+ if (foundColumnInTargetTable) {
Review Comment:
done
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/RewriteSemanticAnalyzer.java:
##########
@@ -117,18 +117,24 @@ protected void analyzeRewrittenTree(ASTNode
rewrittenTree, Context rewrittenCtx)
*/
protected void checkValidSetClauseTarget(ASTNode colName, Table targetTable)
throws SemanticException {
String columnName = normalizeColName(colName.getText());
-
// Make sure this isn't one of the partitioning columns, that's not
supported.
+ boolean foundColumnInTargetTable = false;
Review Comment:
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: [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]