Skip to content

Commit

Permalink
Handle unescaping fields aggregate/fold/pivot
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease committed Feb 19, 2024
1 parent d407fc2 commit bb02573
Show file tree
Hide file tree
Showing 6 changed files with 5,906 additions and 5 deletions.
5 changes: 3 additions & 2 deletions vegafusion-core/src/spec/transform/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,9 @@ impl TransformSpecTrait for AggregateTransformSpec {
.iter()
.filter_map(|groupby_field| {
let groupby_field_name = groupby_field.field();
if input_local_datetime_columns.contains(&groupby_field_name) {
Some(groupby_field_name)
let unescaped = unescape_field(&groupby_field_name);
if input_local_datetime_columns.contains(&unescaped) {
Some(unescaped)
} else {
None
}
Expand Down
2 changes: 1 addition & 1 deletion vegafusion-core/src/spec/transform/fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl TransformSpecTrait for FoldTransformSpec {
let value_is_datetime = self
.fields
.iter()
.all(|field| local_datetime_cols.contains(&field.field()));
.all(|field| local_datetime_cols.contains(&unescape_field(&field.field())));

if value_is_datetime {
let value_col = self.as_().get(1).cloned().unwrap();
Expand Down
5 changes: 3 additions & 2 deletions vegafusion-core/src/spec/transform/pivot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ impl TransformSpecTrait for PivotTransformSpec {
.unwrap_or_default()
.iter()
.filter_map(|groupby_field| {
if input_local_datetime_columns.contains(groupby_field) {
Some(groupby_field.clone())
let unescaped = unescape_field(&groupby_field);
if input_local_datetime_columns.contains(&unescaped) {
Some(unescaped)
} else {
None
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"server_to_client": [
{
"name": "column_domain",
"namespace": "data",
"scope": []
},
{
"name": "data_0",
"namespace": "data",
"scope": []
},
{
"name": "data_0_x_domain_symbol",
"namespace": "data",
"scope": []
},
{
"name": "data_0_y_domain_sum_price",
"namespace": "data",
"scope": []
}
],
"client_to_server": []
}
Loading

0 comments on commit bb02573

Please sign in to comment.