-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add logical type inspection for raw Parquet VARIANT values #23491
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
base: main
Are you sure you want to change the base?
Changes from all commits
a7f3578
7bbdfb7
62ede89
8403e28
d169aa4
9a24f8e
3f1e0a8
e3930a4
dc4ddea
512ffdc
2dc6168
e5145cf
2b18cf5
d0db423
1445a9d
b61ea8a
ff660ee
c91b905
7b64624
5d9c0bb
9c0aafd
4503305
b0dfd69
b6e6d8f
e5246f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
|
|
||
| #include <cudf/column/column.hpp> | ||
| #include <cudf/column/column_view.hpp> | ||
| #include <cudf/io/experimental/variant_spec.hpp> | ||
| #include <cudf/types.hpp> | ||
| #include <cudf/utilities/default_stream.hpp> | ||
| #include <cudf/utilities/memory_resource.hpp> | ||
|
|
@@ -109,6 +110,26 @@ namespace io::parquet::experimental { | |
| rmm::cuda_stream_view stream = cudf::get_default_stream(), | ||
| rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); | ||
|
|
||
| /** | ||
| * @brief Return the logical type of each VARIANT value blob in a `list<uint8>` column. | ||
| * | ||
| * Classifies only the value_metadata header byte; does not validate the remaining payload. | ||
| * A recognized header returns its logical type even when the payload is truncated. A null output | ||
| * row is produced when the input row is null, the blob is empty, or the header carries an | ||
| * unrecognized type. An encoded Variant null (NULLVAL) produces a valid `NULL_VALUE` row. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nartal1 is it okay that this API returns null in multiple cases, i.e.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This behavior is sufficient here from cudf-spark perspective. We can handle the above from the status column from PR 23560. Thanks for checking. |
||
| * | ||
| * @param values `list<uint8>` column of VARIANT-encoded value bytes | ||
| * @param stream CUDA stream | ||
| * @param mr Device memory resource | ||
| * @return `UINT8` column of `variant_logical_type` values cast to `uint8_t` | ||
| * | ||
|
abigalekim marked this conversation as resolved.
|
||
| * @throws std::invalid_argument if `values` is not a `list<uint8>` column | ||
| */ | ||
| [[nodiscard]] std::unique_ptr<column> get_variant_type_id( | ||
| column_view const& values, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nartal1 do to expect to need a "batched" version of this API, i.e. something that takes a table view and returns a table? If you expect to regularly run this on multiple columns , it could even be the only API, and the caller would create a single column table when we need the current capability.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the current tasks, we only need the single-column API. But later, Spark scan pushdown can request several fields from one Variant and can reference multiple Variant columns in the same scan, so a batched classifier overload may become useful. |
||
| rmm::cuda_stream_view stream = cudf::get_default_stream(), | ||
| rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()); | ||
|
|
||
| /** @} */ | ||
| } // namespace io::parquet::experimental | ||
| } // namespace CUDF_EXPORT cudf | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,4 +46,25 @@ enum class variant_primitive_type : uint8_t { | |
| UUID = 20, | ||
| }; | ||
|
|
||
| /** | ||
| * @brief Logical type of a VARIANT value as returned by get_variant_type_id. | ||
| */ | ||
| enum class variant_logical_type : uint8_t { | ||
|
abigalekim marked this conversation as resolved.
|
||
| OBJECT = 0, | ||
| ARRAY = 1, | ||
| NULL_VALUE = 2, | ||
| BOOLEAN = 3, | ||
| LONG_VALUE = 4, | ||
| STRING = 5, | ||
| DOUBLE_VALUE = 6, | ||
| DECIMAL = 7, | ||
| DATE = 8, | ||
| TIMESTAMP = 9, | ||
| TIMESTAMP_NTZ = 10, | ||
|
Comment on lines
+62
to
+63
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nartal1 do we need values for nanosecond types?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The above looks good. Both |
||
| FLOAT_VALUE = 11, | ||
| BINARY = 12, | ||
| UUID = 13, | ||
| TIME_NTZ = 14, | ||
| }; | ||
|
|
||
| } // namespace cudf::io::parquet::experimental | ||
Uh oh!
There was an error while loading. Please reload this page.