Csaba Ringhofer has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/19507 )

Change subject: IMPALA-11854: ImpalaStringWritable's underlying array can't be 
changed in UDFs
......................................................................


Patch Set 12:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/19507/12/fe/src/main/java/org/apache/impala/hive/executor/ImpalaStringWritable.java
File fe/src/main/java/org/apache/impala/hive/executor/ImpalaStringWritable.java:

http://gerrit.cloudera.org:8080/#/c/19507/12/fe/src/main/java/org/apache/impala/hive/executor/ImpalaStringWritable.java@89
PS12, Line 89:     if (newCap <= array_.length) {
The original Hadoop version has different semantics for setCapacity:
https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BytesWritable.java#L157

I think that we can keep the current logic, as it is similar to the old Impala 
logic, but a TODO could be added.


http://gerrit.cloudera.org:8080/#/c/19507/12/fe/src/main/java/org/apache/impala/hive/executor/ImpalaStringWritable.java@104
PS12, Line 104:   // Updates the underlying array's size
              :   public void setSize(int s) {
              :     setCapacity(s);
              :   }
Shouldn't this truncate the array if the new size is smaller?
The old logic did this by setting the underlying string's length.

I think that we need a separate size member similarly to the Hadoop 
implementation to be able to handle capacity and size separately - so the 
capacity would be the size of the array, but it is possible that the size is 
less than that.

It would be also nice to have a test for this.



--
To view, visit http://gerrit.cloudera.org:8080/19507
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb28bd0dce7b0482c7abe1f61f245691fcbfe212
Gerrit-Change-Number: 19507
Gerrit-PatchSet: 12
Gerrit-Owner: Peter Rozsa <[email protected]>
Gerrit-Reviewer: Csaba Ringhofer <[email protected]>
Gerrit-Reviewer: Daniel Becker <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Peter Rozsa <[email protected]>
Gerrit-Comment-Date: Tue, 28 Feb 2023 12:56:58 +0000
Gerrit-HasComments: Yes

Reply via email to