Skip to content

Commit

Permalink
Merge identical transforms at forks (#4029)
Browse files Browse the repository at this point in the history
* Merge identical transforms at forks

* Modify failing test

* Create TransformNode abstract class and extend it

* Clean up

* Remove comment

* Add node type to hash

* Tests for hash methods

* Add space to hash

* Fix rebase errors

* Remove "Node" from hash

* [Travis] Update examples (build: 18764)
  • Loading branch information
invokesus authored and domoritz committed Aug 2, 2018
1 parent dad6955 commit 1dad6bf
Show file tree
Hide file tree
Showing 44 changed files with 469 additions and 449 deletions.
18 changes: 3 additions & 15 deletions examples/compiled/concat_layer_voyager_result_future.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@
"name": "data_3",
"source": "data_1",
"transform": [{"type": "filter", "expr": "datum.label !== 'PoleStar'"}]
},
{
"name": "data_4",
"source": "data_1",
"transform": [{"type": "filter", "expr": "datum.label === 'PoleStar'"}]
},
{
"name": "data_5",
"source": "data_1",
"transform": [{"type": "filter", "expr": "datum.label !== 'PoleStar'"}]
}
],
"signals": [
Expand Down Expand Up @@ -334,7 +324,7 @@
"name": "concat_1_layer_4_marks",
"type": "text",
"style": ["text", "arrow-label2"],
"from": {"data": "data_4"},
"from": {"data": "data_2"},
"encode": {
"update": {
"align": {"value": "right"},
Expand All @@ -359,7 +349,7 @@
"name": "concat_1_layer_5_marks",
"type": "text",
"style": ["text", "arrow-label2"],
"from": {"data": "data_5"},
"from": {"data": "data_3"},
"encode": {
"update": {
"align": {"value": "left"},
Expand Down Expand Up @@ -414,9 +404,7 @@
{"data": "data_1", "field": "from"},
{"data": "data_1", "field": "to"},
{"data": "data_2", "field": "from"},
{"data": "data_3", "field": "from"},
{"data": "data_4", "field": "from"},
{"data": "data_5", "field": "from"}
{"data": "data_3", "field": "from"}
]
},
"range": [0, {"signal": "width"}],
Expand Down
69 changes: 7 additions & 62 deletions examples/compiled/facet_independent_scale_layer_broken.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,7 @@
"type": "formula",
"expr": "toNumber(datum[\"people\"])",
"as": "people"
}
]
},
{
"name": "data_2",
"source": "data_1",
"transform": [
{
"type": "aggregate",
"groupby": ["age", "gender"],
"ops": ["sum"],
"fields": ["people"],
"as": ["sum_people"]
}
]
},
{
"name": "data_3",
"source": "data_1",
"transform": [
},
{
"type": "aggregate",
"groupby": ["age", "gender"],
Expand Down Expand Up @@ -149,26 +130,7 @@
"type": "formula",
"expr": "toNumber(datum[\"people\"])",
"as": "people"
}
]
},
{
"name": "data_1",
"source": "data_0",
"transform": [
{
"type": "aggregate",
"groupby": ["age", "gender"],
"ops": ["sum"],
"fields": ["people"],
"as": ["sum_people"]
}
]
},
{
"name": "data_2",
"source": "data_0",
"transform": [
},
{
"type": "aggregate",
"groupby": ["age", "gender"],
Expand All @@ -194,7 +156,7 @@
"from": {
"facet": {
"name": "faceted_path_child_layer_0_main",
"data": "data_1",
"data": "data_0",
"groupby": ["gender"]
}
},
Expand Down Expand Up @@ -231,7 +193,7 @@
"name": "child_layer_1_marks",
"type": "symbol",
"style": ["point"],
"from": {"data": "data_2"},
"from": {"data": "data_0"},
"encode": {
"update": {
"fill": [
Expand Down Expand Up @@ -261,13 +223,7 @@
{
"name": "child_x",
"type": "point",
"domain": {
"fields": [
{"data": "data_1", "field": "age"},
{"data": "data_2", "field": "age"}
],
"sort": true
},
"domain": {"data": "data_0", "field": "age", "sort": true},
"range": {"step": {"signal": "child_x_step"}},
"padding": 0.5
}
Expand Down Expand Up @@ -304,26 +260,15 @@
{
"name": "y",
"type": "linear",
"domain": {
"fields": [
{"data": "data_2", "field": "sum_people"},
{"data": "data_3", "field": "sum_people"}
]
},
"domain": {"data": "data_1", "field": "sum_people"},
"range": [{"signal": "child_height"}, 0],
"nice": true,
"zero": true
},
{
"name": "color",
"type": "ordinal",
"domain": {
"fields": [
{"data": "data_2", "field": "gender"},
{"data": "data_3", "field": "gender"}
],
"sort": true
},
"domain": {"data": "data_1", "field": "gender", "sort": true},
"range": ["#EA98D2", "#659CCA"]
}
],
Expand Down
15 changes: 2 additions & 13 deletions examples/compiled/interactive_stocks_nearest_index.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@
"expr": "(index.date) && (!(length(data(\"index_store\"))) || (vlSingle(\"index_store\", datum)))"
}
]
},
{
"name": "data_1",
"source": "source_0",
"transform": [
{
"type": "filter",
"expr": "(index.date) && (!(length(data(\"index_store\"))) || (vlSingle(\"index_store\", datum)))"
}
]
}
],
"signals": [
Expand Down Expand Up @@ -184,7 +174,7 @@
"name": "layer_3_marks",
"type": "text",
"style": ["text"],
"from": {"data": "data_1"},
"from": {"data": "data_0"},
"encode": {
"update": {
"fill": [
Expand All @@ -211,8 +201,7 @@
"domain": {
"fields": [
{"data": "source_0", "field": "date"},
{"data": "data_0", "field": "date"},
{"data": "data_1", "field": "date"}
{"data": "data_0", "field": "date"}
]
},
"range": [0, {"signal": "width"}]
Expand Down
19 changes: 8 additions & 11 deletions examples/compiled/layer_bar_dual_axis.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
"precipitation": "number",
"temp_max": "number"
}
}
},
{
"name": "data_0",
"source": "source_0",
},
"transform": [
{
"type": "formula",
"as": "month_date",
"expr": "datetime(0, month(datum[\"date\"]), 1, 0, 0, 0, 0)"
},
}
]
},
{
"name": "data_0",
"source": "source_0",
"transform": [
{
"type": "aggregate",
"groupby": ["month_date"],
Expand All @@ -39,11 +41,6 @@
"name": "data_1",
"source": "source_0",
"transform": [
{
"type": "formula",
"as": "month_date",
"expr": "datetime(0, month(datum[\"date\"]), 1, 0, 0, 0, 0)"
},
{
"type": "aggregate",
"groupby": ["month_date"],
Expand Down
24 changes: 8 additions & 16 deletions examples/compiled/layer_bar_dual_axis_minmax.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@
"temp_max": "number",
"temp_min": "number"
}
}
},
{
"name": "data_0",
"source": "source_0",
},
"transform": [
{
"type": "formula",
"as": "month_date",
"expr": "datetime(0, month(datum[\"date\"]), 1, 0, 0, 0, 0)"
},
}
]
},
{
"name": "data_0",
"source": "source_0",
"transform": [
{
"type": "aggregate",
"groupby": ["month_date"],
Expand All @@ -41,11 +43,6 @@
"name": "data_1",
"source": "source_0",
"transform": [
{
"type": "formula",
"as": "month_date",
"expr": "datetime(0, month(datum[\"date\"]), 1, 0, 0, 0, 0)"
},
{
"type": "aggregate",
"groupby": ["month_date"],
Expand All @@ -59,11 +56,6 @@
"name": "data_2",
"source": "source_0",
"transform": [
{
"type": "formula",
"as": "month_date",
"expr": "datetime(0, month(datum[\"date\"]), 1, 0, 0, 0, 0)"
},
{
"type": "aggregate",
"groupby": ["month_date"],
Expand Down
33 changes: 5 additions & 28 deletions examples/compiled/layer_falkensee.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,7 @@
"type": "formula",
"expr": "toNumber(datum[\"population\"])",
"as": "population"
}
]
},
{
"name": "data_2",
"source": "data_1",
"transform": [
{
"type": "formula",
"as": "year_year",
"expr": "datetime(year(datum[\"year\"]), 0, 1, 0, 0, 0, 0)"
}
]
},
{
"name": "data_3",
"source": "data_1",
"transform": [
},
{
"type": "formula",
"as": "year_year",
Expand Down Expand Up @@ -154,7 +137,7 @@
"type": "line",
"style": ["line"],
"sort": {"field": "datum[\"year_year\"]", "order": "descending"},
"from": {"data": "data_2"},
"from": {"data": "data_1"},
"encode": {
"update": {
"stroke": {"value": "#333"},
Expand All @@ -173,7 +156,7 @@
"name": "layer_2_marks",
"type": "symbol",
"style": ["point"],
"from": {"data": "data_3"},
"from": {"data": "data_1"},
"encode": {
"update": {
"opacity": {"value": 0.7},
Expand Down Expand Up @@ -208,8 +191,7 @@
"fields": [
{"data": "data_0", "field": "year_start"},
{"data": "data_0", "field": "year_end"},
{"data": "data_2", "field": "year_year"},
{"data": "data_3", "field": "year_year"}
{"data": "data_1", "field": "year_year"}
]
},
"range": [0, {"signal": "width"}]
Expand All @@ -223,12 +205,7 @@
{
"name": "y",
"type": "linear",
"domain": {
"fields": [
{"data": "data_2", "field": "population"},
{"data": "data_3", "field": "population"}
]
},
"domain": {"data": "data_1", "field": "population"},
"range": [{"signal": "height"}, 0],
"nice": true,
"zero": true
Expand Down

0 comments on commit 1dad6bf

Please sign in to comment.