test: add _field filter coverage to read_group
@@ -956,3 +956,36 @@ async fn test_grouped_series_set_plan_group_field_pred_and_null_fields() {
)
.await;
}
+
+// See issue: https://github.com/influxdata/influxdb_iox/issues/2845
+//
+// This test adds coverage for filtering on _field when executing a read_group
+// plan.
+#[tokio::test]
+async fn test_grouped_series_set_plan_group_field_pred_filter_on_field() {
+ // no predicate
+ let predicate = PredicateBuilder::default()
+ .table("o2")
+ .add_expr(col("_field").eq(lit("reading")))
+ .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, city, state partition_key_vals: MA, reading",
+ "Series tags={_field=reading, _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;
+}
