From 30c3d1e00134a03d59ecdc6855f4083e775b1a2a Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Mon, 18 Oct 2021 14:43:52 -0400 Subject: [PATCH] test: Add read_group test for missing fields (#2881) * test: Add read_group test * fix: Update to use o2 table --- query_tests/src/influxrpc/read_group.rs | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/query_tests/src/influxrpc/read_group.rs b/query_tests/src/influxrpc/read_group.rs index d919a14021..d42bd8d66c 100644 --- a/query_tests/src/influxrpc/read_group.rs +++ b/query_tests/src/influxrpc/read_group.rs @@ -3,6 +3,7 @@ use crate::{ influxrpc::util::run_series_set_plan, scenarios::{ make_two_chunk_scenarios, util::all_scenarios_for_one_chunk, DbScenario, DbSetup, NoData, + TwoMeasurementsManyFieldsOneChunk, }, }; @@ -925,3 +926,33 @@ async fn test_grouped_series_set_plan_group_measurement_tag_count() { ) .await; } + +#[tokio::test] +async fn test_grouped_series_set_plan_group_field_pred_and_null_fields() { + // no predicate + let predicate = PredicateBuilder::default().table("o2").build(); + + let agg = Aggregate::Count; + let group_columns = vec!["state", "_field"]; + + // Expect the data is grouped so output is sorted by measurement and then region + let expected_results = vec![ + "Group tag_keys: _field, _measurement, state partition_key_vals: CA, reading", + "Series tags={_field=reading, _measurement=o2, state=CA}\n IntegerPoints timestamps: [300], values: [0]", + "Group tag_keys: _field, _measurement, state partition_key_vals: CA, temp", + "Series tags={_field=temp, _measurement=o2, state=CA}\n IntegerPoints timestamps: [300], values: [1]", + "Group tag_keys: _field, _measurement, city, state partition_key_vals: MA, reading", + "Series tags={_field=reading, _measurement=o2, city=Boston, state=MA}\n IntegerPoints timestamps: [50], values: [1]", + "Group tag_keys: _field, _measurement, city, state partition_key_vals: MA, temp", + "Series tags={_field=temp, _measurement=o2, city=Boston, state=MA}\n IntegerPoints timestamps: [50], values: [1]", + ]; + + run_read_group_test_case( + TwoMeasurementsManyFieldsOneChunk {}, + predicate, + agg, + group_columns, + expected_results, + ) + .await; +}