Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease committed Nov 8, 2024
1 parent 2f55380 commit 4689b80
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
5 changes: 3 additions & 2 deletions vegafusion-core/src/planning/stitch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::spec::signal::SignalSpec;
use crate::spec::values::MissingNullOrValue;
use crate::task_graph::graph::ScopedVariable;
use crate::task_graph::scope::TaskScope;
use itertools::Itertools;
use serde_json::Value;
use std::collections::HashSet;

Expand Down Expand Up @@ -76,8 +77,8 @@ pub fn stitch_specs(

// Return plan which specifies which signals/data need to be communicated between client and server
Ok(CommPlan {
server_to_client: server_to_client.into_iter().collect(),
client_to_server: client_to_server.into_iter().collect(),
server_to_client: server_to_client.into_iter().sorted().collect(),
client_to_server: client_to_server.into_iter().sorted().collect(),
})
}

Expand Down
26 changes: 13 additions & 13 deletions vegafusion-python/tests/test_pretransform.py
Original file line number Diff line number Diff line change
Expand Up @@ -1761,43 +1761,43 @@ def test_pre_transform_spec_encoded_datasets():
# Pre-transform with supported aggregate function should result in no warnings
vega_spec = movies_histogram_spec()

# default list of dict format
tx_spec, _warnings = vf.runtime.pre_transform_spec(
vega_spec, data_encoding_threshold=10, data_encoding_format="pyarrow"
# Inline when threshold is larger than transformed data
tx_spec, datasets, _warnings = vf.runtime.pre_transform_extract(
vega_spec, extract_threshold=10, extracted_format="pyarrow"
)

values = tx_spec["data"][0]["values"]
assert isinstance(values, list)
assert len(values) == 9

# pyarrow format
tx_spec, _warnings = vf.runtime.pre_transform_spec(
vega_spec, data_encoding_threshold=0, data_encoding_format="pyarrow"
tx_spec, datasets, _warnings = vf.runtime.pre_transform_extract(
vega_spec, extract_threshold=0, extracted_format="pyarrow"
)

values = tx_spec["data"][0]["values"]
name, scope, values = datasets[0]
assert name == "source_0"
assert isinstance(values, pa.Table)
values_df = values.to_pandas()
assert len(values_df) == 9
assert values_df.columns[0] == "bin_maxbins_10_IMDB Rating"

# arrow-ipc format
tx_spec, _warnings = vf.runtime.pre_transform_spec(
vega_spec, data_encoding_threshold=0, data_encoding_format="arrow-ipc"
tx_spec, datasets, _warnings = vf.runtime.pre_transform_extract(
vega_spec, extract_threshold=0, extracted_format="arrow-ipc"
)

values = tx_spec["data"][0]["values"]
name, scope, values = datasets[0]
assert isinstance(values, bytes)
values_df = pa.ipc.deserialize_pandas(values)
assert len(values_df) == 9
assert values_df.columns[0] == "bin_maxbins_10_IMDB Rating"

# arrow-ipc-base64 format
tx_spec, _warnings = vf.runtime.pre_transform_spec(
vega_spec, data_encoding_threshold=0, data_encoding_format="arrow-ipc-base64"
tx_spec, datasets, _warnings = vf.runtime.pre_transform_extract(
vega_spec, extract_threshold=0, extracted_format="arrow-ipc-base64"
)

values = tx_spec["data"][0]["values"]
name, scope, values = datasets[0]
assert isinstance(values, str)
values_df = pa.ipc.deserialize_pandas(base64.standard_b64decode(values))
assert len(values_df) == 9
Expand Down

0 comments on commit 4689b80

Please sign in to comment.