Skip to content
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

Handle point selections in projection pushdown #460

Merged
merged 4 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions vegafusion-core/src/planning/projection_pushdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,10 @@ impl ChartVisitor for CollectVlSelectionTestFieldsVisitor {
// ]
// }
//
// or, for point selections
//
// "value": [{"field": "year_date", "type": "E"}]
//
// With a corresponding dataset named "{name}_store". If we fine this pair, then use the
// "field" entries in {name}_tuple_fields as column usage fields.
if signal.name.ends_with("_tuple_fields") {
Expand All @@ -765,9 +769,7 @@ impl ChartVisitor for CollectVlSelectionTestFieldsVisitor {
if let Ok(table) = VegaFusionTable::from_json(value) {
// Check that we have "field", "channel", and "type" columns
let schema = &table.schema;
if schema.field_with_name("channel").is_ok()
&& schema.field_with_name("type").is_ok()
{
if schema.field_with_name("type").is_ok() {
if let Ok(field_index) = schema.index_of("field") {
if let Ok(batch) = table.to_record_batch() {
let field_array = batch.column(field_index);
Expand Down
2 changes: 1 addition & 1 deletion vegafusion-core/src/spec/transform/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl TransformSpecTrait for ProjectTransformSpec {
self.fields
.iter()
.filter_map(|project_field| {
if input_local_datetime_columns.contains(project_field) {
if input_local_datetime_columns.contains(&unescape_field(project_field)) {
Some(project_field.clone())
} else {
None
Expand Down
30 changes: 30 additions & 0 deletions vegafusion-runtime/tests/specs/custom/gh_456.comm_plan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"server_to_client": [
{
"name": "column_domain",
"namespace": "data",
"scope": []
},
{
"name": "data_0_color_domain_symbol",
"namespace": "data",
"scope": []
},
{
"name": "data_0_facet_facet0",
"namespace": "data",
"scope": []
},
{
"name": "data_3_x_domain_symbol",
"namespace": "data",
"scope": []
},
{
"name": "data_3_y_domain_sum_price",
"namespace": "data",
"scope": []
}
],
"client_to_server": []
}
Loading
Loading