You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/18 01:51:41 UTC
[GitHub] [arrow-datafusion] Igosuki opened a new pull request #1860: Fix dict key size
Igosuki opened a new pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860
# Which issue does this PR close?
Closes #1859
# Rationale for this change
I have large numbers of partition values
# What changes are included in this PR?
Default data type of dictionary values for partitions is now Dictionary<Uint16Type>
# Are there any user-facing changes?
Getting partition values from the RecordBatch now changes to using Uint16
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1860: Increase default partition column type from Dict(UInt8) to Dict(UInt16)
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1058110737
> I think this PR proposes to use 16 bits rather than 64 to allow more than 256 distinct partition values. One example usecase might be when there are more than 256 distinct postal codes in the United States)
I am not challenging that you can have partitions keys with billions of different values 🙂. But I think that this isn't the best place to bump the dictionary index size as it is correct to say that at the file level, you cannot have more than one different value in a partition column for one record batch. It would be nicer to upcast this type downstream, when the record batches are manipulated in a way that implies that this uniqueness doesn't hold anymore (like after a `concat` op).
If we find that it is too complex to do it downstream, I am not firmly opposed to upcast the type here, but then I agree with @yjshen that u16 isn't really enough. Also, making it customizable introduces some tuning complexity that isn't really ideal either.
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #1860: Increase default partition column type from Dict(UInt8) to Dict(UInt16)
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1058131410
@rdettai what would you think about merging this PR as a temporary workaround for common cases (like days of the year) and filing a ticket (I am happy to do so) to track the more optimal behavior?
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #1860: Increase default partition column type from Dict(UInt8) to Dict(UInt16)
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1057127097
I think (though I did not check) that the way the concat kernel in arrow works now is that the output type is always the same as the input type. Having the concat kernel upcast the index type (e.g. from UInt8 to UInt16) if the concatenated dictionary required it would be nice for sure
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #1860: Increase default partition column type from Dict(UInt8) to Dict(UInt16)
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1059834753
In order to unstick this PR I plan to file a follow on ticket to add a more sophisticated handling of dictionaries and then merge this PR in as a workaround until it is done
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] Igosuki commented on pull request #1860: Increase default partition column type from Dict(UInt8) to Dict(UInt16)
Posted by GitBox <gi...@apache.org>.
Igosuki commented on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1057291497
The simple way to test this is to have a test with more than 256 partition values in listing::helpers
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb merged pull request #1860: Increase default partition column type from Dict(UInt8) to Dict(UInt16)
Posted by GitBox <gi...@apache.org>.
alamb merged pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] Igosuki commented on pull request #1860: Increase default partition column type from Dict(UInt8) to Dict(UInt16)
Posted by GitBox <gi...@apache.org>.
Igosuki commented on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1058338946
I mean I can change it to u32 if that floats your boat.
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1860: Increase default partition column type from Dict(UInt8) to Dict(UInt16)
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1056764995
The idea behind using UInt8 is that the values of a given partition column within a file will be all identical. If I have to materialize a large array with only zeros, I would rather not encode each 0 on 64 bits 😄. To actually have a record batch with multiple partition values, you would need to go through something like the `concat` kernel first. Wouldn't it make sense to rely on that kernel to re-cast the index type appropriately? I think that it would be a safer approach in general to avoid overflowing when merging dictionaries.
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] Igosuki commented on pull request #1860: Fix dict key size
Posted by GitBox <gi...@apache.org>.
Igosuki commented on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1044344140
That is a possibility, on a very large machine
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #1860: Increase default partition column type from Dict(UInt8) to Dict(UInt16)
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1059837724
Filed https://github.com/apache/arrow-datafusion/issues/1931 for follow on work ; Thanks again @Igosuki and @rdettai
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] Igosuki commented on pull request #1860: Increase default partition column type from Dict(UInt8) to Dict(UInt16)
Posted by GitBox <gi...@apache.org>.
Igosuki commented on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1057289559
Just to be clear, I came across this with date partitions :) a year of dates = 365 partition values
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] yjshen commented on pull request #1860: Fix dict key size
Posted by GitBox <gi...@apache.org>.
yjshen commented on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1043844955
What do you think if we make it a type parameter for the write partition dict? There are chances we may write to more than `u16::Max` partitions as well?
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #1860: Increase default partition column type from Dict(UInt8) to Dict(UInt16)
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1057125192
> The idea behind using UInt8 is that the values of a given partition column within a file will be all identical. If I have to materialize a large array with only zeros, I would rather not encode each 0 on 64 bits 😄.
I think this PR proposes to use 16 bits rather than 64 to allow more than 256 distinct partition values. One example usecase might be when there are more than 256 distinct postal codes in the United States)
> To actually have a record batch with multiple partition values, you would need to go through something like the concat kernel first. Wouldn't it make sense to rely on that kernel to re-cast the index type appropriately? I think that it would be a safer approach in general to avoid overflowing when merging dictionaries.
Having some way to dynamically pick the size of the dictionary keys certainly seems like a nice feature -- I am not sure how large of a change it would be though.
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai edited a comment on pull request #1860: Increase default partition column type from Dict(UInt8) to Dict(UInt16)
Posted by GitBox <gi...@apache.org>.
rdettai edited a comment on pull request #1860:
URL: https://github.com/apache/arrow-datafusion/pull/1860#issuecomment-1058110737
> I think this PR proposes to use 16 bits rather than 64 to allow more than 256 distinct partition values. One example usecase might be when there are more than 256 distinct postal codes in the United States)
I am not challenging that you can have partitions keys with billions of different values 🙂. But I think that this isn't the best place to bump the dictionary index size as it is correct to say that at the file level, you cannot have more than one different value in a partition column for one record batch. It would be nicer to upcast this type downstream, when the record batches are manipulated in a way that implies that this uniqueness doesn't hold anymore (like after a `concat` op). Also, it would be even nicer if we had https://github.com/apache/arrow-datafusion/issues/1248 instead 😄
If we find that it is too complex to do it downstream, I am not firmly opposed to upcast the type here, but then I agree with @yjshen that u16 isn't really enough. Also, making it customizable introduces some tuning complexity that isn't really ideal either.
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org