Fast UTF-8 validation when reading StringViewArray from Parquet #5995
Labels
enhancement
Any new improvement worthy of a entry in the changelog
parquet
Changes to the parquet crate
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Now that #5973 is merged, we have a very fast implementation for loading BinaryViewArray from Parquet. As shown in the benchmark below:
However, reading StringViewArray is similar to (sometimes slower than) reading StringArray.
After many investigations, I believe the slow down comes from the fact that validating utf-8 for StringViewArray is much slower than that for StringArray.
Why
StringArray has one continuous buffer, all the strings are packed one after another. This means that if the entire underlying buffer is utf-8, then all strings in the buffer are utf-8. Validating large string chunk is much much faster than validating small strings one by one. (I believe this is because the compiler is smart enough to do auto-vectorization, which only benefits long strings)
The buffer from string view, unfortunately, is not continuous because parquet encodes string length in between the strings, string length, unfortunately, may or may not be utf-8. This forces us to validate strings one by one (need to skip the string lengths) instead of validating the entire string buffer.
Describe the solution you'd like
The goal is to make string view array utf-8 validation as fast as string array.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: