ndemir commented on issue #7273:
URL: https://github.com/apache/arrow-rs/issues/7273#issuecomment-2719525075

   I found the issue.
   The following code path is executed during serialization.
   ```
    TapeElement::I32(n) if coerce_primitive => { 
        builder.append_value(n.to_string()); 
    } 
    TapeElement::F32(n) if coerce_primitive => { 
        builder.append_value(n.to_string()); 
    } 
    TapeElement::F64(high) if coerce_primitive => match tape.get(p + 1) { 
        TapeElement::F32(low) => { 
            let val = f64::from_bits(((high as u64) << 32) | low as u64); 
            builder.append_value(val.to_string()); 
        } 
   ```
   
   And, the following is executed during reading.
   
   ```
                   TapeElement::Number(idx) if coerce_primitive => {
                       builder.append_value(tape.get_string(idx));
                   }
   ```
   
   I do not see a reason to optimize the previous code block 
(`TapeElement::Number(idx) if coerce_primitive => {`) because it is already 
writing as string as it is coming from Tape.
   
   But, with some quick tests, I saw that we can take the advantage of new 
approach during serialization. 
   Will write tests and send PR, when ready.
   


-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to