-
Notifications
You must be signed in to change notification settings - Fork 915
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
[BUG] Column type for fixed_width_column_wrapper should be restricted. #16092
Comments
I believe the scale is zero if you use a fixed-point type with |
Fixed-point types are considered fixed-width cudf/cpp/include/cudf/utilities/traits.hpp Lines 514 to 520 in cdfb550
Also, there are existing tests that take advantage of this. Here are a few: cudf/cpp/tests/streams/io/orc_test.cpp Line 63 in cdfb550
cudf/cpp/tests/streams/io/csv_test.cpp Line 55 in cdfb550
As well as other tests that use the cudf/cpp/include/cudf_test/type_lists.hpp Line 304 in cdfb550
|
The problem is the scale being zero, even if you construct it with fixed_point data with a different scale factor. E.g. in the example I posted, you are storing a decimal with scale -1 in a column with scale zero. Then whenever you do anything with the column it behaves unexpectedly. E.g in 24.04, this comparison fails, because the scale factor is effectively lost:
|
And it's even more dangerous, as you can have the column wrapper store a list of decimals that all have different scale factors. Then it's really not clear what the behavior even should be. The scale factor needs to solely be a property of the column, and not be allowed for the data stored within it. We should just have people use fixed_point_column_wrapper instead. |
Ok, that makes sense. The convenience of the I did some investigation and found there are several places in our gtests that are actually using this incorrectly as described in this issue so it is certainly worth fixing. They currently are not failing because they are not checking the scale-type value. I think we can continue to support this feature but only allow |
If someone creates a |
I'm not sure I'm following. The values are copied from host to device within the wrapper ctor so changing the original host values will not change the copied device values. Maybe I need to see an example of what you are asking. |
Ah I see, so maybe it isn't possible then. |
…16120) The `cudf::test::fixed_width_column_wrapper` supports all fixed-width type including fixed-point types. However, there is no mechanism to specify the fixed-point scale value which is common for the entire column and stored in the column's type. This fixes the case by throwing an error if a non-zero scale is specified for the input values in a fixed-point `fixed_width_column_wrapper` instance. Also fixed several tests that incorrectly specified a non-zero scale. Closes #16092 Authors: - David Wendt (https://github.com/davidwendt) Approvers: - Bradley Dice (https://github.com/bdice) - Paul Mattione (https://github.com/pmattione-nvidia) URL: #16120
Describe the bug
fixed_width_column_wrapper doesn't restrict the types allowed for the column. This can lead to unexpected behavior when a user chooses to use (e.g.) decimal32 for the "ElementTo" type, and the scale information is not embedded in the type. The desired behavior is that the user uses fixed_point_column_wrapper to wrap decimal data, so we should prevent the usage of fixed_width_column_wrapper for fixed-point.
Steps/Code to reproduce bug
cudf::test::fixed_width_column_wrapper<numeric::decimal128> decimal128_col({numeric::decimal128{1.0, numeric::scale_type{-1}}});
The text was updated successfully, but these errors were encountered: