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

UInt8 isn't enough for partitioning values #1859

Closed
Igosuki opened this issue Feb 18, 2022 · 1 comment · Fixed by #1860
Closed

UInt8 isn't enough for partitioning values #1859

Igosuki opened this issue Feb 18, 2022 · 1 comment · Fixed by #1860
Labels
bug Something isn't working

Comments

@Igosuki
Copy link
Contributor

Igosuki commented Feb 18, 2022

Describe the bug
I hit a limitation in the PartitionColumnProjector, when there are too many partition values. Changing dictionary keys to UInt16 made it work.

To Reproduce
Steps to reproduce the behavior:
For instance, I modified the test in parquet_multiple_partitions in module path_partitions like this :

#[tokio::test]
async fn parquet_multiple_partitions() -> Result<()> {
    let mut ctx = ExecutionContext::new();
    let store_paths = (0..200)
        .into_iter()
        .map(|i| {
            format!(
                "first=what/second=ok/year=2021/month={}/day={}/file.parquet",
                i, i
            )
        })
        .collect::<Vec<String>>();
    let store_paths_refs = store_paths
        .iter()
        .map(|s| s.as_str())
        .collect::<Vec<&str>>();
    register_partitioned_alltypes_parquet(
        &mut ctx,
        &store_paths_refs,
        &["first", "second", "year", "month", "day"],
        "",
        "alltypes_plain.parquet",
    )
    .await;

    let result = ctx
        .sql("SELECT id, day FROM t WHERE day=month and first='what' and second='ok' and year='2021' ORDER BY id")
        .await?
        .collect()
        .await?;
    Ok(())
}

At 200 it runs, at 2000 it fails.

Expected behavior
Datafusion shouldn't crash, even for thousands of partition values.

Additional context
I'm using prepartitioned parquet-files to speed up iterating in notebooks

@Igosuki
Copy link
Contributor Author

Igosuki commented Feb 18, 2022

P.S. : this is only a fix for 7.0.0, as listing partitions is broken for me on master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant