Skip to content

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

Closed

Description

@davidlghellin

Describe the bug

When de IntervalMonthDayNano(0,0,0) , the test is line blank
Image

To Reproduce

In one file tests for spark
execute

cargo test --test sqllogictests -- file --complete
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

Image

Additional context

development PR

Activity

  1. Jefffrey commented on Sep 17, 2025

    @Jefffrey
    Contributor

    In DataFusion itself, it seems an empty MonthDayNano interval is displayed as an empty string.

    e.g. this code generates this output:

        let a = ctx.sql("select make_interval()").await?.collect().await?;
        dbg!(a);
        ctx.sql("select make_interval()").await?.show().await?;

    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

    I'll assume this is an arrow-rs issue and mark as waiting upstream, unless the SLT tests do output formatting of values elsewhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwaiting-on-upstreamPR is waiting on an upstream dependency to be updated

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions