Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIVE-26892: Backport HIVE-25243 to 3.2.0: Handle nested values in null struct. #3898

Merged
merged 1 commit into from Jan 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions ql/src/java/org/apache/hadoop/hive/ql/io/arrow/Serializer.java
Expand Up @@ -267,6 +267,21 @@ private void writeStruct(MapVector arrowVector, StructColumnVector hiveVector,
final ColumnVector[] hiveFieldVectors = hiveVector.fields;
final int fieldSize = fieldTypeInfos.size();

// This is to handle following scenario -
// if any struct value itself is NULL, we get structVector.isNull[i]=true
// but we don't get the same for it's child fields which later causes exceptions while setting to arrow vectors
// see - https://issues.apache.org/jira/browse/HIVE-25243
if (hiveVector != null && hiveFieldVectors != null) {
for (int i = 0; i < size; i++) {
if (hiveVector.isNull[i]) {
for (ColumnVector fieldVector : hiveFieldVectors) {
fieldVector.isNull[i] = true;
fieldVector.noNulls = false;
}
}
}
}

for (int fieldIndex = 0; fieldIndex < fieldSize; fieldIndex++) {
final TypeInfo fieldTypeInfo = fieldTypeInfos.get(fieldIndex);
final ColumnVector hiveFieldVector = hiveFieldVectors[fieldIndex];
Expand Down