guluo2016 opened a new issue, #6767:
URL: https://github.com/apache/paimon/issues/6767

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   
   ### Paimon version
   
   master
   
   ### Compute Engine
   
   None
   
   ### Minimal reproduce step
   
   Description:
   In `ArrowFieldWriters.TimeWriter`, the `doWrite` method uses wrong index `i` 
instead of `row` when reading from the source columnVector.
   
   Impact:
   When `startIndex > 0`, the writer reads incorrect values from the source 
column vector, causing data corruption in the Arrow output.
   
   Reproduction:
   ```java
   public static void main(String[] args) {
           RowType rowType = new RowType(
                   Collections.singletonList(new DataField(0, "time_field", 
DataTypes.TIME())));
   
           int startIndex = 2;
           final int batchRows = 3;
   
           try (RootAllocator allocator = new RootAllocator();
                VectorSchemaRoot vsr = 
ArrowUtils.createVectorSchemaRoot(rowType, allocator)) {
   
               ArrowFieldWriter[] fieldWriters = 
ArrowUtils.createArrowFieldWriters(vsr, rowType);
   
               IntColumnVector timeVec = new IntColumnVector() {
                   final int[] values = new int[] {0, 1000, 2000, 3000, 4000};
                   @Override public int getInt(int i) { return values[i]; }
                   @Override public boolean isNullAt(int i) { return false; }
               };
   
               fieldWriters[0].write(timeVec, null, 2, batchRows);
               vsr.setRowCount(batchRows);
   
               TimeMilliVector timeMilliVector = (TimeMilliVector) 
vsr.getVector("time_field");
   
               for (int i = 0; i < batchRows; i++) {
                   System.out.printf("paimonValue: %s, <--> arrowValue: %s%n",
                           timeVec.getInt(i + startIndex), 
timeMilliVector.get(i));
               }
           } catch (Exception e) {
               e.printStackTrace();
           }
       }
   ```
   Print output:  
   ```bash
   paimonValue: 2000, <--> arrowValue: 0
   paimonValue: 3000, <--> arrowValue: 1000
   paimonValue: 4000, <--> arrowValue: 2000
   ```
   
   
   ### What doesn't meet your expectations?
   
   None
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


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

Reply via email to