[
https://issues.apache.org/jira/browse/HIVE-24503?focusedWorklogId=521963&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-521963
]
ASF GitHub Bot logged work on HIVE-24503:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 09/Dec/20 00:45
Start Date: 09/Dec/20 00:45
Worklog Time Spent: 10m
Work Description: rbalamohan commented on a change in pull request #1753:
URL: https://github.com/apache/hive/pull/1753#discussion_r538916121
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorSerializeRow.java
##########
@@ -61,27 +61,16 @@
private Field root;
private static class Field {
- Field[] children;
-
- boolean isPrimitive;
- Category category;
- PrimitiveCategory primitiveCategory;
- TypeInfo typeInfo;
-
- int count;
-
- ObjectInspector objectInspector;
- int outputColumnNum;
-
+ Field[] children = null;
+ boolean isPrimitive = false;
+ Category category = null;
+ PrimitiveCategory primitiveCategory = null;
+ TypeInfo typeInfo = null;
+ int count = 0;
+ ObjectInspector objectInspector = null;
+ int outputColumnNum = -1;
+ VectorSerializeWriter writer = null;
Field() {
Review comment:
Can be removed.
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorDeserializeRow.java
##########
@@ -933,12 +1207,20 @@ private void storeUnionRowColumn(ColumnVector colVector,
unionColVector.isNull[batchIndex] = false;
unionColVector.tags[batchIndex] = tag;
- storeComplexFieldRowColumn(
+ deserializer.storeComplexFieldRowColumn(
colVectorFields[tag],
unionHelper.getFields()[tag],
batchIndex,
canRetainByteRef);
- deserializeRead.finishComplexVariableFieldsType();
+ deserializer.deserializeRead.finishComplexVariableFieldsType();
+ }
+
+ abstract static class VectorBatchDeserializer {
+ abstract void store(ColumnVector colVector, Field field, int batchIndex,
boolean canRetainByteRef,
+ VectorDeserializeRow deserializer) throws
IOException;
Review comment:
Why VectorDeserializerRow needs be passed here again? ("this" references
in other places as well). If you remove "static" class declaration in
VectorBatchDeserializer children, you may not need to pass this. And the patch
would become lot lesser changes?
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorSerializeRow.java
##########
@@ -274,44 +315,25 @@ private void serializeWrite(
return;
}
isAllNulls = false;
+ field.writer.serialize(colVector, field, adjustedBatchIndex, this);
+ }
- if (field.isPrimitive) {
- serializePrimitiveWrite(colVector, field, adjustedBatchIndex);
- return;
- }
- final Category category = field.category;
- switch (category) {
- case LIST:
- serializeListWrite(
- (ListColumnVector) colVector,
- field,
- adjustedBatchIndex);
- break;
- case MAP:
- serializeMapWrite(
- (MapColumnVector) colVector,
- field,
- adjustedBatchIndex);
- break;
- case STRUCT:
- serializeStructWrite(
- (StructColumnVector) colVector,
- field,
- adjustedBatchIndex);
- break;
- case UNION:
- serializeUnionWrite(
- (UnionColumnVector) colVector,
- field,
- adjustedBatchIndex);
- break;
- default:
- throw new RuntimeException("Unexpected category " + category);
+ abstract static class VectorSerializeWriter {
+ abstract void serialize(Object colVector, Field field, int
adjustedBatchIndex,
+ VectorSerializeRow serializeRow) throws
IOException;
Review comment:
Same as earlier. VectorSerializeRow need not be passed here. Patch may
need lesser changes if you remove static declaration on children.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 521963)
Time Spent: 20m (was: 10m)
> Optimize vector row serde by avoiding type check at run time
> -------------------------------------------------------------
>
> Key: HIVE-24503
> URL: https://issues.apache.org/jira/browse/HIVE-24503
> Project: Hive
> Issue Type: Bug
> Components: Hive
> Reporter: mahesh kumar behera
> Assignee: mahesh kumar behera
> Priority: Major
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Serialization/Deserialization of vectorized batch done at VectorSerializeRow
> and VectorDeserializeRow does a type checking for each column of each row.
> This becomes very costly when there are billions of rows to read/write. This
> can be optimized if the type check is done during init time and specific
> reader/writer classes are created. This classes can be used directly stored
> in filed structure to avoid run time type check.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)