Repository navigation
Conversation
Add a `dfv` workspace crate whose binary is datafusion-cli's `main.rs` from the pinned DataFusion revision plus `register_all` and the `VariantTypePlanner`. The root workspace lists `dfv` in `default-members` so `cargo run --bin dfv` and `cargo test` work from the repository root. End-to-end tests run the binary with `-c` to check the banner, JSON parsing and field extraction, `:` field access, the SQL `VARIANT` type, a Parquet write/read round trip, and error reporting. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Drop the datafusion-cli options other than `-c` and `-f` (memory and disk limits, Spark mode, output format, rc files, etc.) and the dependencies they needed. Rewrite the end-to-end tests as `dfv/tests/cli_integration.rs` using `assert_cmd` and `predicates`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The dfv REPL test pipes SQL on stdin, and datafusion-cli writes its command history to the working directory. Remove the accidentally committed file and ignore it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
| > [!WARNING] | ||
| > `register_all` replaces existing functions with the same names. Individual UDFs | ||
| > remain available for selective registration. | ||
| > `register_all` replaces existing functions with the same names. |
There was a problem hiding this comment.
I tried to rewrite the intro to be more succinct and show how to do common tasks.
| +---------+------------+ | ||
| ``` | ||
|
|
||
| ## What is Variant? |
There was a problem hiding this comment.
Moved to the top and make it more concise
|
|
||
| This repository also includes a `dfv` command-line tool with the Variant | ||
| functions and SQL type preinstalled for you to try the examples interactively. Run it like | ||
| ```shell |
There was a problem hiding this comment.
My goal was to make it super easy to try this out cargo run
|
|
||
| `parse_json` converts JSON text to the | ||
| [Parquet Variant encoding](https://parquet.apache.org/docs/file-format/types/variantencoding/); | ||
| `CAST(value AS VARIANT)` converts typed scalars and arrays, including decimals; |
There was a problem hiding this comment.
I am afraid this cast stuff got lost. I can add examples as a follow on PR perhaps
| | Objects | [`variant_object_construct`](https://github.com/datafusion-contrib/datafusion-variant/blob/main/tests/test_files/variant_object_construct.slt), [`variant_object_keys`](https://github.com/datafusion-contrib/datafusion-variant/blob/main/tests/test_files/variant_object_keys.slt), [`variant_object_insert`](https://github.com/datafusion-contrib/datafusion-variant/blob/main/tests/test_files/variant_object_insert.slt), [`variant_object_delete`](https://github.com/datafusion-contrib/datafusion-variant/blob/main/tests/test_files/variant_object_delete.slt) | | ||
| | Arrays | [`variant_list_construct`](https://github.com/datafusion-contrib/datafusion-variant/blob/main/tests/test_files/variant_list_construct.slt), [`variant_list_insert`](https://github.com/datafusion-contrib/datafusion-variant/blob/main/tests/test_files/variant_list_insert.slt), [`variant_list_delete`](https://github.com/datafusion-contrib/datafusion-variant/blob/main/tests/test_files/variant_list_delete.slt) | | ||
| | Utilities | [`variant_normalize`](https://github.com/datafusion-contrib/datafusion-variant/blob/main/src/variant_normalize.rs), [`variant_pretty`](https://github.com/datafusion-contrib/datafusion-variant/blob/main/tests/test_files/variant_pretty.slt) | | ||
| | JSON conversion | [`parse_json`, `try_parse_json`, `to_json`][parse-json-slt], [`variant_get_json`][variant-get-json-slt] | |
There was a problem hiding this comment.
I found out of line links much easier to understand
|
What do you think about this @sdf-jkl ? |
Resolve README conflicts: keep the new structure, take the updated `register_all` warning from main, and note that `register_all` now installs the type planner. Drop the explicit type planner from dfv. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
| > statements. Individual UDFs remain available for selective registration. | ||
|
|
||
| ### 3. Create the events table | ||
| Congratulations -- you can now query semi-structured data with the Variant type! |
|
|
||
| ```sql | ||
| SELECT event:service::VARCHAR AS service, | ||
| event:latency_ms::BIGINT AS latency_ms |
There was a problem hiding this comment.
use UDF syntax for one of the options?
Saw below
Co-authored-by: Kosta Tarasov <33369833+sdf-jkl@users.noreply.github.com>
|
I think I made the requested changes |
|
🚀 |
|
Thank you @sdf-jkl -- I also have a bunch of tickets I am working to file |
|
Thanks @alamb 🙏 Really appreciate your help pushing this forward |
The interactive CLI example is superseded by dfv (#102), a datafusion-cli with the Variant functions preinstalled. Drop the example, its rustyline dev-dependency, and the README instructions for it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* Remove the examples/cli.rs interactive CLI example The interactive CLI example is superseded by dfv (#102), a datafusion-cli with the Variant functions preinstalled. Drop the example, its rustyline dev-dependency, and the README instructions for it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * Remove download_data.sh and remaining references to the CLI example The jsonbench prepare command downloads the same Bluesky files itself, so the script is redundant. Point profile_parse_json at that command instead. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * Revert "Remove download_data.sh and remaining references to the CLI example" This reverts commit dc10c77. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
No problem -- sorry it took so long. This has been on my list for a while but I think I was waiting for a willing partner to help drive it. Thank you for helping. This is going to be great |
Why
Note this PR looks huge but more than half of it is Cargo.lock
I want to make this repo as simple as possible to use / test, and part of that is lowering the friction to ad-hoc testing
Here is my proposal: https://github.com/datafusion-contrib/datafusion-variant/blob/alamb/dfv/README.md
There is a "cli" example, but it:
Instead, I think it would be better to have a version of datafusion-cli with datafusion-variant pre-integrated so people could test how it works more easily and so that we can test and improve the integration going forward
What
dfv("DataFusion Variant") binary that isdatafusion-cliwith the Variant functions preinstalledTest it out:
Planned follow ons: