Jefffrey commented on issue #17455:
URL: https://github.com/apache/datafusion/issues/17455#issuecomment-3301244069

   In DataFusion itself, it seems an empty `MonthDayNano` interval is displayed 
as an empty string.
   
   e.g. this code generates this output:
   
   ```rust
       let a = ctx.sql("select make_interval()").await?.collect().await?;
       dbg!(a);
       ctx.sql("select make_interval()").await?.show().await?;
   ```
   
   - Using this PR branch #17424 to get an empty `MonthDayNano` interval
   
   Output:
   
   ```
   [datafusion-examples/examples/regexp.rs:42:5] a = [
       RecordBatch {
           schema: Schema {
               fields: [
                   Field {
                       name: "make_interval()",
                       data_type: Interval(
                           MonthDayNano,
                       ),
                       nullable: false,
                       dict_id: 0,
                       dict_is_ordered: false,
                       metadata: {},
                   },
               ],
               metadata: {},
           },
           columns: [
               PrimitiveArray<Interval(MonthDayNano)>
               [
                 IntervalMonthDayNano {
                   months: 0,
                   days: 0,
                   nanoseconds: 0,
               },
               ],
           ],
           row_count: 1,
       },
   ]
   +-----------------+
   | make_interval() |
   +-----------------+
   |                 |
   +-----------------+
   ```
   
   
   This seems to be because in arrow-rs, if all values are 0 then nothing is 
written, see:
   
   
https://github.com/apache/arrow-rs/blob/2ec77b548d9242bc85ca36f04761d116ceab8963/arrow-cast/src/display.rs#L733-L758
   
   - Related issue: https://github.com/apache/arrow-rs/issues/5914


-- 
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...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to