You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "davidlghellin (via GitHub)" <gi...@apache.org> on 2025/09/06 18:54:03 UTC

[I] [datafusion-spark] [SQL] [TEST] IntervalMonthDayNano(0,0,0) give line blank [datafusion]

davidlghellin opened a new issue, #17455:
URL: https://github.com/apache/datafusion/issues/17455

   ### Describe the bug
   
   When de IntervalMonthDayNano(0,0,0) , the test is line blank
   <img width="307" height="241" alt="Image" src="https://github.com/user-attachments/assets/8fedecfe-1459-4191-ac48-e4008404f209" />
   
   
   
   ### To Reproduce
   
   In one file tests for spark
   execute
   ```sh
   cargo test --test sqllogictests -- file --complete
   ```
   
   ```sql
   query
   SELECT INTERVAL '0' SECOND AS iv;
   ```
   
   ### Expected behavior
   
   some value like this (1 sec is => `1.000000000 secs` see previous picture):
   ```
   query ?
   SELECT INTERVAL '0' SECOND AS iv;
   ----
   0.000000000 secs
   ```
   In Apache Spark
   
   <img width="467" height="107" alt="Image" src="https://github.com/user-attachments/assets/23d7a415-eee5-4ef6-bba9-57f098e90b5f" />
   
   ### Additional context
   
   development [PR](https://github.com/apache/datafusion/pull/17424)


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

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


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


Re: [I] [datafusion-spark] [SQL] [TEST] IntervalMonthDayNano(0,0,0) give line blank [datafusion]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
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-unsubscribe@datafusion.apache.org

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


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


Re: [I] [datafusion-spark] [SQL] [TEST] IntervalMonthDayNano(0,0,0) give line blank [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #17455: [datafusion-spark] [SQL] [TEST] IntervalMonthDayNano(0,0,0) give line blank
URL: https://github.com/apache/datafusion/issues/17455


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

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


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