Closed sacundim closed 1 year ago
I just tried 1.4.0rc2 and it behaves different. No Rust panic but I get this:
ValueError: DataFusion error: Schema error: No field named variable. Valid fields are tbl_0._vf_order, tbl_0.bulletin_date, tbl_0.collected_date, tbl_0.youngest, tbl_0.population, tbl_0."Antígenos", tbl_0."Moleculares", tbl_0.positive_antigens, tbl_0.positive_molecular, tbl_0."Casos", tbl_0."Muertes", tbl_0."Casos por antígeno", tbl_0."Casos por molecular", tbl_0.facet_variable_sort_index.
The variable
field is coming from a fold transform
Thanks for the report @sacundim. The Vega-Lite JSON repro was really helpful. After digging in, I think there's an error in the Vega spec that Vega-Lite is producing (which I've reported in https://github.com/vega/vega-lite/issues/9013).
The summary is that Vega-Lite is producing a spec that references the "variable" column before it's defined, and then uses this column in the groupby
list of a window
transform. Vega just ignores the non-existent column (and groups by the other columns in the list), whereas VegaFusion is raising an error.
I'm going to update VegaFusion to follow Vega's behavior here.
Fixed (to match Vega's behavior) in 1.4.0-rc3
I just had a shot at using 1.4.0rc3, and I can confirmed it now works fine.
I did have a tangential issue with a transitive dependency: psutils 5.9.5 wouldn't build in my Docker image because it won't pull a binary wheel and I was using a python:slim
base that doesn't have gcc. I worked around that by using the full python image.
Ok, thanks for letting me know!
I don't have a standalone reproduction, this is from my app that you have no good way to actually run. I can produce the regular Vega-Lite JSON spec for this chart (actually I just linked it there), is that enough to reproduce the bug? If not I can try to rip out the rather long Altair code in question and package it as a test case.
Python stack trace
``` Traceback (most recent call last): [...] File "/Users/sacundim/Code/covid-19-puerto-rico/website/src/covid_19_puerto_rico/charts.py", line 55, in save_chart_vegafusion vf.save_svg(chart, filename) File "/Users/sacundim/Code/covid-19-puerto-rico/website/.venv/lib/python3.10/site-packages/vegafusion/save.py", line 136, in save_svg bundle = spec_to_mime_bundle( File "/Users/sacundim/Code/covid-19-puerto-rico/website/.venv/lib/python3.10/site-packages/vegafusion/renderer.py", line 40, in spec_to_mime_bundle tx_vega_spec, warnings = runtime.pre_transform_spec( File "/Users/sacundim/Code/covid-19-puerto-rico/website/.venv/lib/python3.10/site-packages/vegafusion/runtime.py", line 222, in pre_transform_spec new_spec, warnings = self.embedded_runtime.pre_transform_spec( pyo3_runtime.PanicException: Failed to get node value: DataFusionError(SchemaError(FieldNotFound { field: Column { relation: None, name: "variable" }, valid_fields: [Column { relation: Some(Bare { table: "tbl_0" }), name: "_vf_order" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "bulletin_date" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "collected_date" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "youngest" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "population" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "Antígenos" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "Moleculares" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "positive_antigens" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "positive_molecular" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "Casos" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "Muertes" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "Casos por antígeno" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "Casos por molecular" }, Column { relation: Some(Bare { table: "tbl_0" }), name: "facet_variable_sort_index" }] }), ErrorContext { contexts: [] }) ```Rust stack trace
``` 2023-07-16 19:52:21,757 worker_thread_1 Writing RecentAgeGroups charts to output... thread '