Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type is missing when constructing a list from struct with a datetime field #16098

Closed
2 tasks done
hustxiaoc opened this issue May 7, 2024 · 0 comments
Closed
2 tasks done
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer rust Related to Rust Polars

Comments

@hustxiaoc
Copy link

hustxiaoc commented May 7, 2024

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

use polars::prelude::*;

fn main() {
    let a = Series::new("a", vec![1715075144098_i64; 10]);
    let b = Series::new("b", vec!["1"; 10]);
    let aa = a.i64().cloned().unwrap().into_datetime(TimeUnit::Milliseconds, None).into_series();

    let s = StructChunked::new("s", &vec![aa, b]).unwrap().into_series();
    let mut aa = vec![];
    for i in 1..9 {
        aa.push(s.slice(0, i));
    }
    let ss = Series::new("name", aa);
    dbg!(&ss.dtype());
}

Log output

[src/main.rs:14] &ss.dtype() = List(
    Struct(
        [
            Field {
                name: "a",
                dtype: Int64,
            },
            Field {
                name: "b",
                dtype: String,
            },
        ],
    ),
)

Issue description

Type datetime is lost

Expected behavior

List(
    Struct(
        [
            Field {
                name: "a",
                dtype: Datetime(
                    Milliseconds,
                    None,
                ),
            },
            Field {
                name: "b",
                dtype: String,
            },
        ],
    ),
)

Installed versions

Replace this line with a list of feature gates

@hustxiaoc hustxiaoc added bug Something isn't working needs triage Awaiting prioritization by a maintainer rust Related to Rust Polars labels May 7, 2024
@hustxiaoc hustxiaoc closed this as not planned Won't fix, can't repro, duplicate, stale May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer rust Related to Rust Polars
Projects
None yet
Development

No branches or pull requests

1 participant