razajafri commented on a change in pull request #31284:
URL: https://github.com/apache/spark/pull/31284#discussion_r564863081



##########
File path: 
sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java
##########
@@ -351,25 +351,43 @@ public void readLongs(
       WritableColumnVector c,
       int rowId,
       int level,
-      VectorizedValuesReader data) throws IOException {
+      VectorizedValuesReader data,
+      boolean downCastLongToInt) throws IOException {
     int left = total;
     while (left > 0) {
       if (this.currentCount == 0) this.readNextGroup();
       int n = Math.min(left, this.currentCount);
       switch (mode) {
         case RLE:
           if (currentValue == level) {
-            data.readLongs(n, c, rowId);
+            if (downCastLongToInt) {
+              for (int i = 0; i < n; ++i) {
+                c.putInt(rowId + i, (int) data.readLong());

Review comment:
       `readLongs` is handling arrays in a way specific to the underlying 
vector i.e. `OnHeapColumnVector/OffHeapColumnVector` to optimize the operation 
by doing a memcpy. In our case we can't copy memory chunks because we will have 
to downcast each value before putting it back.




----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to