From 5b649daaeaf019616cb6e6b05798e73a54b73227 Mon Sep 17 00:00:00 2001 From: discord9 <55937128+discord9@users.noreply.github.com> Date: Sat, 17 Oct 2026 11:30:55 +0800 Subject: [PATCH 1/5] feat(mito2): produce typed raw series from RegionScanner with truthful ordering Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> --- Cargo.lock | 1 + src/mito2/Cargo.toml | 1 + src/mito2/src/engine/scan_test.rs | 918 +++++++++++++++++++- src/mito2/src/read/series_scan.rs | 383 ++++---- src/mito2/src/read/series_scan/raw.rs | 13 +- src/mito2/src/read/series_scan/raw/tests.rs | 76 +- 6 files changed, 1211 insertions(+), 181 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea2a530d6b5..43d65a03bd8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8742,6 +8742,7 @@ dependencies = [ "partition", "pin-project", "prometheus 0.14.0", + "promql", "prost 0.14.1", "puffin", "rand 0.9.4", diff --git a/src/mito2/Cargo.toml b/src/mito2/Cargo.toml index 02c134e964c..151694c40d1 100644 --- a/src/mito2/Cargo.toml +++ b/src/mito2/Cargo.toml @@ -101,6 +101,7 @@ dotenv.workspace = true log-store = { workspace = true, features = ["testing"] } mito-codec = { workspace = true, features = ["testing"] } object-store = { workspace = true, features = ["services-memory"] } +promql.workspace = true rskafka.workspace = true rstest.workspace = true rstest_reuse.workspace = true diff --git a/src/mito2/src/engine/scan_test.rs b/src/mito2/src/engine/scan_test.rs index a893a234adc..3ad13fac11e 100644 --- a/src/mito2/src/engine/scan_test.rs +++ b/src/mito2/src/engine/scan_test.rs @@ -4772,6 +4772,7 @@ async fn test_mito_handle_query_raw_series_candidate_projection_and_mvcc() { use datatypes::series::samples::SampleRef; use datatypes::value::Value as DatumValue; use mito_codec::row_converter::build_primary_key_codec; + use promql::source::materialize_raw_labels; use store_api::region_engine::{BoundTag, QueryScanContext, RawLabelSource}; use store_api::region_request::RegionDeleteRequest; use table::predicate::Predicate; @@ -4907,7 +4908,7 @@ async fn test_mito_handle_query_raw_series_candidate_projection_and_mvcc() { .scan_series_partition(&QueryScanContext::default(), &metrics, partition, &source) .unwrap() .expect("supported millisecond PerSeries scan"); - assert_eq!(SeriesOrdering::Contiguous, stream.ordering()); + assert_eq!(SeriesOrdering::KeyThenTime, stream.ordering()); assert!(stream.schema().eval_grid.is_none()); assert_eq!( vec!["field_1", "field_0"], @@ -4925,7 +4926,7 @@ async fn test_mito_handle_query_raw_series_candidate_projection_and_mvcc() { !closed_keys.contains(chunk.primary_key.as_slice()), "no chunk may follow a key's is_last chunk" ); - let times = chunk.time.as_buffer().as_ref(); + let times = chunk.time.as_buffer(); assert_eq!(2, chunk.fields.len()); assert_eq!(times.len(), chunk.fields.get(0).unwrap().len()); assert_eq!(times.len(), chunk.fields.get(1).unwrap().len()); @@ -4994,7 +4995,7 @@ async fn test_mito_handle_query_raw_series_candidate_projection_and_mvcc() { } // Compare keyed visible tuples through a separately opened legacy scanner. // A partition cannot be consumed through both paths. - let mut legacy_request = request; + let mut legacy_request = request.clone(); legacy_request.projection = Some(vec![0, 3, 2, 1, 4]); legacy_request.preserve_pk_dictionary_encoding = false; let legacy = engine @@ -5090,6 +5091,133 @@ async fn test_mito_handle_query_raw_series_candidate_projection_and_mvcc() { .collect::>(); raw_visible.sort_by(|a, b| a.0.cmp(&b.0).then(a.1.cmp(&b.1))); assert_eq!(raw_visible, visible); + + // Exercise the production table physical consumer over a fresh real Mito scanner. + use common_query::series_frame::unpack_raw_series; + use datafusion::execution::TaskContext; + use datafusion::physical_plan::ExecutionPlan; + use table::table::scan::RegionScanExec; + let native_scanner = engine + .handle_query(region_id, request.clone()) + .await + .unwrap(); + let native_metadata = native_scanner.metadata(); + let native_tags = native_metadata + .column_metadatas + .iter() + .filter(|c| c.semantic_type == SemanticType::Tag) + .map(|c| BoundTag { + column_id: c.column_id, + name: Arc::from(c.column_schema.name.as_str()), + }) + .collect::>(); + let native_source = RawLabelSource::PrimaryKey { + metric_name: Arc::from("fixture_metric"), + physical_metadata: native_metadata, + logical_tags: native_tags.into(), + }; + let native_plan = Arc::new(RegionScanExec::new(native_scanner, request.clone(), None).unwrap()); + let native_plan = native_plan + .try_to_series_scan(native_source.clone()) + .unwrap() + .expect("Mito raw-series capability"); + let native_schema = native_plan.series_schema().clone(); + let native_frames = native_plan + .execute(0, Arc::new(TaskContext::default())) + .unwrap(); + let unpacked = unpack_raw_series( + native_frames, + native_schema, + native_source, + SeriesOrdering::Contiguous, + ) + .unwrap(); + let native_schema = unpacked.schema().clone(); + let materialized = materialize_raw_labels(unpacked).unwrap(); + assert!(matches!( + materialized.label_source(), + RawLabelSource::Explicit + )); + let mut native = materialized.try_collect::>().await.unwrap(); + assert_eq!( + vec!["field_1", "field_0"], + native_schema + .fields + .iter() + .map(|field| field.name.as_ref()) + .collect::>() + ); + let mut native_visible = native + .drain(..) + .flat_map(|chunk| { + let metric = chunk.metric.as_ref().expect("materialized complete metric"); + assert_eq!(Some("fixture_metric"), metric.name()); + let labels = metric + .tags() + .iter() + .map(|label| (label.name.as_ref(), label.value.as_ref())) + .collect::>(); + assert_eq!(1, labels.len()); + let tag = labels["tag_0"].to_string(); + assert!(tag == "A" || tag == "B"); + let times = chunk.time.as_buffer(); + let key = chunk.primary_key.to_vec(); + let is_last = chunk.is_last; + let mut rows = Vec::with_capacity(times.len()); + for (i, time) in times.iter().enumerate() { + let SampleRef::Float(f1) = chunk.fields.get(0).unwrap().sample(i) else { + panic!("expected f1 float") + }; + let f0 = match chunk.fields.get(1).unwrap().sample(i) { + SampleRef::Float(value) => Some(value), + SampleRef::Missing => None, + _ => panic!("expected f0 float or null"), + }; + rows.push(( + key.clone(), + tag.clone(), + *time, + f1, + f0, + is_last && i + 1 == times.len(), + )); + } + rows + }) + .collect::>(); + let mut expected_native = raw + .iter() + .map(|(key, time, f1, f0, _)| (key.to_vec(), *time, *f1, *f0)) + .collect::>(); + type NativeRow = (Vec, String, i64, f64, Option, bool); + let sort_native = |rows: &mut Vec| { + rows.sort_by(|a, b| a.0.cmp(&b.0).then(a.2.cmp(&b.2))); + }; + sort_native(&mut native_visible); + expected_native.sort_by(|a, b| a.0.cmp(&b.0).then(a.1.cmp(&b.1))); + assert_eq!( + expected_native, + native_visible + .iter() + .map(|(key, _, time, f1, f0, _)| (key.clone(), *time, *f1, *f0)) + .collect::>() + ); + for key in &expected_keys { + assert_eq!( + 1, + native_visible + .iter() + .filter(|(row_key, _, _, _, _, is_last)| row_key == key && *is_last) + .count() + ); + } + let mut decoded_visible = native_visible + .iter() + .map(|(_, tag, time, f1, f0, _)| (tag.clone(), *time, *f1, *f0)) + .collect::>(); + decoded_visible.sort_by(|a, b| a.0.cmp(&b.0).then(a.1.cmp(&b.1))); + assert_eq!(visible, decoded_visible); + // Apply the typed predicate and final projection through the ordinary legacy filter path. assert_eq!(3, visible.len()); assert_eq!( @@ -5102,6 +5230,602 @@ async fn test_mito_handle_query_raw_series_candidate_projection_and_mvcc() { ); } +#[tokio::test] +async fn test_mito_regional_raw_merge_preserves_global_key_order_and_labels() { + use api::v1::{Row, Value}; + use common_query::series_frame::{pack_raw_series, unpack_raw_series}; + use datatypes::arrow::array::Array; + use datatypes::series::SeriesOrdering; + use datatypes::series::samples::{SampleRef, SeriesSchema}; + use datatypes::value::Value as DatumValue; + use mito_codec::row_converter::build_primary_key_codec; + use promql::source::{materialize_raw_labels, merge_ordered_raw_series}; + use store_api::region_engine::{BoundTag, QueryScanContext, RawLabelSource}; + use store_api::region_request::RegionDeleteRequest; + + let mut env = TestEnv::with_prefix("test_mito_regional_raw_merge").await; + let engine = env.create_engine(MitoConfig::default()).await; + let regions = [RegionId::new(1, 1), RegionId::new(1, 2)]; + let mut request = CreateRequestBuilder::new().field_num(3).build(); + request + .options + .insert("memtable.type".into(), "bulk".into()); + let schema = test_util::rows_schema(&request); + for region in regions { + engine + .handle_request(region, RegionRequest::Create(request.clone())) + .await + .unwrap(); + } + let make_row = |tag: &str, f0: Option, f1: f64, gate: f64, time: i64| Row { + values: vec![ + Some(ValueData::StringValue(tag.into())), + f0.map(ValueData::F64Value), + Some(ValueData::F64Value(f1)), + Some(ValueData::F64Value(gate)), + Some(ValueData::TimestampMillisecondValue(time)), + ] + .into_iter() + .map(|value_data| Value { value_data }) + .collect(), + }; + for (region, rows) in [ + ( + regions[0], + vec![ + make_row("A", Some(10.0), 1.0, 1.0, 10), + make_row("A", None, 3.0, 1.0, 30), + make_row("B", Some(-0.0), 5.0, 1.0, 10), + ], + ), + ( + regions[1], + vec![ + make_row("A", Some(20.0), 2.0, 1.0, 20), + make_row("A", Some(40.0), 4.0, 1.0, 40), + make_row("C", Some(60.0), 6.0, 1.0, 10), + ], + ), + ] { + test_util::put_rows( + &engine, + region, + Rows { + schema: schema.clone(), + rows, + }, + ) + .await; + } + test_util::flush_region(&engine, regions[0], None).await; + test_util::flush_region(&engine, regions[1], None).await; + test_util::put_rows( + &engine, + regions[0], + Rows { + schema: schema.clone(), + rows: vec![ + make_row("A", Some(11.0), 11.0, 1.0, 10), + make_row("A", Some(50.0), 5.0, 0.0, 50), + make_row("B", Some(60.0), 6.0, 1.0, 60), + ], + }, + ) + .await; + engine + .handle_request( + regions[0], + RegionRequest::Delete(RegionDeleteRequest { + rows: Rows { + schema: test_util::delete_rows_schema( + &CreateRequestBuilder::new().field_num(3).build(), + ), + rows: vec![row(vec![ + ValueData::StringValue("B".into()), + ValueData::TimestampMillisecondValue(60), + ])], + }, + hint: None, + partition_expr_version: None, + }), + ) + .await + .unwrap(); + let request = ScanRequest { + projection: Some(vec![2, 1, 4]), + filters: vec![col("field_2").gt(lit(0.0_f64))], + distribution: Some(TimeSeriesDistribution::PerSeries), + preserve_pk_dictionary_encoding: true, + ..Default::default() + }; + let mut streams = Vec::new(); + let mut metadata_for_codec = None; + let mut expected_schema: Option> = None; + let metrics = ExecutionPlanMetricsSet::default(); + for region in regions { + let selected = engine.scanner(region, request.clone()).await.unwrap(); + let mut scanner: Box = match selected { + Scanner::Series(series) => { + assert_eq!("legacy", series.mode()); + Box::new(series) + } + _ => panic!("PerSeries request must select a series scanner"), + }; + assert_eq!(SeriesOrdering::KeyThenTime, scanner.raw_series_ordering()); + let metadata = scanner.metadata(); + metadata_for_codec.get_or_insert_with(|| metadata.clone()); + let source = RawLabelSource::PrimaryKey { + metric_name: Arc::from("fixture_metric"), + physical_metadata: metadata.clone(), + logical_tags: metadata + .column_metadatas + .iter() + .filter(|column| { + column.semantic_type == SemanticType::Tag + && !store_api::storage::consts::is_internal_column( + &column.column_schema.name, + ) + && !store_api::metric_engine_consts::is_metric_engine_internal_column( + &column.column_schema.name, + ) + }) + .map(|column| BoundTag { + column_id: column.column_id, + name: Arc::from(column.column_schema.name.as_str()), + }) + .collect::>() + .into(), + }; + let ranges = scanner + .properties() + .partitions + .clone() + .into_iter() + .flatten() + .collect::>(); + assert!(!ranges.is_empty(), "region scan needs an input range"); + let partition_count = 2; + let mut partitions = vec![Vec::new(); partition_count]; + for (index, range) in ranges.into_iter().enumerate() { + partitions[index % partition_count].push(range); + } + scanner + .prepare(PrepareRequest { + ranges: Some(partitions), + target_partitions: Some(partition_count), + ..Default::default() + }) + .unwrap(); + let partition_count = scanner.properties().num_partitions(); + assert!( + partition_count > 1, + "prepare must use multiple supplied native range partitions" + ); + for partition in 0..partition_count { + let stream = scanner + .scan_series_partition(&QueryScanContext::default(), &metrics, partition, &source) + .unwrap() + .expect("native raw input"); + assert_eq!(scanner.raw_series_ordering(), stream.ordering()); + assert_eq!(SeriesOrdering::KeyThenTime, stream.ordering()); + assert_eq!( + vec!["field_1", "field_0"], + stream + .schema() + .fields + .iter() + .map(|field| field.name.as_ref()) + .collect::>() + ); + if let Some(schema) = &expected_schema { + assert_eq!( + schema + .fields + .iter() + .map(|field| field.name.as_ref()) + .collect::>(), + stream + .schema() + .fields + .iter() + .map(|field| field.name.as_ref()) + .collect::>() + ); + } else { + expected_schema = Some(Arc::clone(stream.schema())); + } + streams.push(stream); + } + // Each scanner owns the same schema and explicitly bound source. + } + let merged = merge_ordered_raw_series(streams).unwrap(); + let merged_schema = Arc::clone(merged.schema()); + let binding = merged.label_source().clone(); + let ordering = merged.ordering(); + assert_eq!(SeriesOrdering::KeyThenTime, ordering); + let packed = pack_raw_series(merged).unwrap(); + let unpacked = unpack_raw_series(packed, merged_schema, binding, ordering).unwrap(); + let mut materialized = materialize_raw_labels(unpacked).unwrap(); + let mut actual = Vec::new(); + while let Some(chunk) = materialized.try_next().await.unwrap() { + let metric = chunk.metric.as_ref().unwrap(); + assert_eq!(Some("fixture_metric"), metric.name()); + let tag = metric.get("tag_0").unwrap().to_string(); + for index in 0..chunk.time.len() { + let SampleRef::Float(f1) = chunk.fields.get(0).unwrap().sample(index) else { + panic!("field_1 float") + }; + let f0 = match chunk.fields.get(1).unwrap().sample(index) { + SampleRef::Float(value) => Some(value.to_bits()), + SampleRef::Missing => None, + _ => panic!("unexpected field_0 sample type"), + }; + actual.push(( + chunk.primary_key.to_vec(), + tag.clone(), + chunk.time.timestamp(index).unwrap(), + f1.to_bits(), + f0, + chunk.is_last && index + 1 == chunk.time.len(), + )); + } + } + assert!( + actual + .windows(2) + .all(|pair| pair[0].0 < pair[1].0 || (pair[0].0 == pair[1].0 && pair[0].2 < pair[1].2)), + "merged stream must be ordered by full read key then time" + ); + let metadata = metadata_for_codec.unwrap(); + let codec = build_primary_key_codec(&metadata); + let mut expected = Vec::new(); + for (tag, time, f1, f0) in [ + ("A", 10, 11.0_f64, Some(11.0_f64)), + ("A", 20, 2.0, Some(20.0)), + ("A", 30, 3.0, None), + ("A", 40, 4.0, Some(40.0)), + ("B", 10, 5.0, Some(-0.0_f64)), + ("C", 10, 6.0, Some(60.0)), + ] { + let mut key = Vec::new(); + codec + .encode_values( + &[(metadata.primary_key[0], DatumValue::String(tag.into()))], + &mut key, + ) + .unwrap(); + expected.push((key, tag, time, f1.to_bits(), f0.map(f64::to_bits))); + } + let duplicate_key = expected[0].0.clone(); + assert_eq!( + expected + .iter() + .map(|(key, _, _, _, _)| key.clone()) + .collect::>(), + actual.iter().map(|row| row.0.clone()).collect::>() + ); + let visible = actual + .iter() + .map(|(_, tag, time, f1, f0, _)| (tag.as_str(), *time, *f1, *f0)) + .collect::>(); + assert_eq!( + expected + .iter() + .map(|(_, tag, time, f1, f0)| (*tag, *time, *f1, *f0)) + .collect::>(), + visible + ); + let mut legacy_batches = Vec::new(); + for region in regions { + let mut legacy_request = request.clone(); + legacy_request.projection = Some(vec![0, 1, 2, 3, 4]); + legacy_request.filters.clear(); + legacy_request.preserve_pk_dictionary_encoding = false; + let legacy = engine.handle_query(region, legacy_request).await.unwrap(); + for partition in 0..legacy.properties().num_partitions() { + legacy_batches.extend( + legacy + .scan_partition(&QueryScanContext::default(), &metrics, partition) + .unwrap() + .try_collect::>() + .await + .unwrap(), + ); + } + } + let mut legacy_visible = Vec::new(); + for batch in &legacy_batches { + let batch = batch.df_record_batch(); + let tags = batch + .column_by_name("tag_0") + .unwrap() + .as_any() + .downcast_ref::() + .unwrap(); + let f0 = batch + .column_by_name("field_0") + .unwrap() + .as_any() + .downcast_ref::() + .unwrap(); + let f1 = batch + .column_by_name("field_1") + .unwrap() + .as_any() + .downcast_ref::() + .unwrap(); + let times = batch + .column_by_name("ts") + .unwrap() + .as_any() + .downcast_ref::() + .unwrap(); + let gate = batch + .column_by_name("field_2") + .unwrap() + .as_any() + .downcast_ref::() + .unwrap(); + for row in 0..batch.num_rows() { + if gate.value(row) > 0.0 { + legacy_visible.push(( + tags.value(row).to_string(), + times.value(row), + f1.value(row).to_bits(), + if f0.is_null(row) { + None + } else { + Some(f0.value(row).to_bits()) + }, + )); + } + } + } + legacy_visible.sort_by(|left, right| left.0.cmp(&right.0).then(left.1.cmp(&right.1))); + let mut raw_visible = actual + .iter() + .map(|(_, tag, time, f1, f0, _)| (tag.clone(), *time, *f1, *f0)) + .collect::>(); + raw_visible.sort_by(|left, right| left.0.cmp(&right.0).then(left.1.cmp(&right.1))); + assert_eq!( + legacy_visible, raw_visible, + "raw candidates after field_2 predicate must match legacy scan" + ); + test_util::put_rows( + &engine, + regions[1], + Rows { + schema: schema.clone(), + rows: vec![make_row("A", Some(99.0), 99.0, 1.0, 30)], + }, + ) + .await; + let mut duplicate_inputs = Vec::new(); + for region in regions { + let scanner = engine.handle_query(region, request.clone()).await.unwrap(); + let metadata = scanner.metadata(); + let source = RawLabelSource::PrimaryKey { + metric_name: Arc::from("fixture_metric"), + physical_metadata: metadata.clone(), + logical_tags: metadata + .column_metadatas + .iter() + .filter(|column| { + column.semantic_type == SemanticType::Tag + && !store_api::storage::consts::is_internal_column( + &column.column_schema.name, + ) + && !store_api::metric_engine_consts::is_metric_engine_internal_column( + &column.column_schema.name, + ) + }) + .map(|column| BoundTag { + column_id: column.column_id, + name: Arc::from(column.column_schema.name.as_str()), + }) + .collect::>() + .into(), + }; + let mut scanner = scanner; + let ranges = scanner + .properties() + .partitions + .clone() + .into_iter() + .flatten() + .collect::>(); + let partition_count = 2; + let mut partitions = vec![Vec::new(); partition_count]; + for (index, range) in ranges.into_iter().enumerate() { + partitions[index % partition_count].push(range); + } + scanner + .prepare(PrepareRequest { + ranges: Some(partitions), + target_partitions: Some(partition_count), + ..Default::default() + }) + .unwrap(); + for partition in 0..scanner.properties().num_partitions() { + duplicate_inputs.push( + scanner + .scan_series_partition( + &QueryScanContext::default(), + &metrics, + partition, + &source, + ) + .unwrap() + .unwrap(), + ); + } + } + let mut duplicate_merge = merge_ordered_raw_series(duplicate_inputs).unwrap(); + let mut affected_key_last = Vec::new(); + let duplicate_error = loop { + match duplicate_merge.try_next().await { + Ok(Some(chunk)) => { + if chunk.primary_key.as_slice() == duplicate_key.as_slice() { + affected_key_last.push(chunk.is_last); + } + } + Ok(None) => panic!("same full key/timestamp across regions must fail"), + Err(error) => break error.to_string(), + } + }; + assert!( + duplicate_error.contains("timestamp") || duplicate_error.contains("time"), + "unexpected duplicate timestamp error: {duplicate_error}" + ); + assert!(!affected_key_last.is_empty()); + assert!(affected_key_last.iter().all(|is_last| !is_last)); + assert!( + duplicate_merge.try_next().await.unwrap().is_none(), + "merge error must fuse stream" + ); + for tag in ["A", "B", "C"] { + let key_rows = actual.iter().filter(|row| row.1 == tag).collect::>(); + assert_eq!( + 1, + key_rows.iter().filter(|row| row.5).count(), + "global finality for {tag}" + ); + assert!(key_rows.last().unwrap().5); + assert!(key_rows[..key_rows.len() - 1].iter().all(|row| !row.5)); + } +} + +#[tokio::test] +async fn test_two_phase_native_raw_stream_is_rejected_by_ordered_merge() { + use datatypes::series::SeriesOrdering; + use store_api::region_engine::{BoundTag, QueryScanContext, RawLabelSource}; + use store_api::region_request::RegionPutRequest; + + let mut env = TestEnv::with_prefix("test_two_phase_native_raw_merge_rejection").await; + let engine = env + .create_engine(MitoConfig { + experimental_series_scan_v2: true, + ..Default::default() + }) + .await; + let region_id = RegionId::new(1, 1); + let metadata = Arc::new(sst_region_metadata_with_encoding( + PrimaryKeyEncoding::Sparse, + )); + let mut create = CreateRequestBuilder::new().build(); + create.column_metadatas = metadata.column_metadatas.clone(); + create.primary_key = metadata.primary_key.clone(); + create + .options + .insert(PRIMARY_KEY_ENCODING.to_string(), "sparse".to_string()); + create + .options + .insert("memtable.type".to_string(), "bulk".to_string()); + create + .options + .insert("sst_format".to_string(), "flat".to_string()); + let full_schema = test_util::rows_schema(&create); + let mut key_schema = full_schema[0].clone(); + key_schema.column_name = PRIMARY_KEY_COLUMN_NAME.to_string(); + key_schema.datatype = ColumnDataType::Binary.into(); + key_schema.semantic_type = SemanticType::Tag.into(); + let row_schema = vec![key_schema, full_schema[5].clone(), full_schema[4].clone()]; + engine + .handle_request(region_id, RegionRequest::Create(create)) + .await + .unwrap(); + let sparse_rows = Rows { + schema: row_schema, + rows: vec![ + row(vec![ + ValueData::BinaryValue(new_sparse_primary_key(&["a", "x"], &metadata, 10, 0)), + ValueData::TimestampMillisecondValue(10), + ValueData::U64Value(1), + ]), + row(vec![ + ValueData::BinaryValue(new_sparse_primary_key(&["b", "y"], &metadata, 20, 0)), + ValueData::TimestampMillisecondValue(20), + ValueData::U64Value(2), + ]), + ], + }; + engine + .handle_request( + region_id, + RegionRequest::Put(RegionPutRequest { + rows: sparse_rows, + hint: Some(WriteHint { + primary_key_encoding: api::v1::PrimaryKeyEncoding::Sparse.into(), + }), + skip_wal: false, + partition_expr_version: None, + }), + ) + .await + .unwrap(); + test_util::flush_region(&engine, region_id, None).await; + let request = ScanRequest { + distribution: Some(TimeSeriesDistribution::PerSeries), + preserve_pk_dictionary_encoding: true, + ..Default::default() + }; + let selected = engine.scanner(region_id, request.clone()).await.unwrap(); + let Scanner::Series(series) = selected else { + panic!("sparse PerSeries request must use SeriesScan"); + }; + assert_eq!("two_phase", series.mode()); + let mut scanner = engine.handle_query(region_id, request).await.unwrap(); + assert_eq!(SeriesOrdering::Contiguous, scanner.raw_series_ordering()); + let metadata = scanner.metadata(); + let source = RawLabelSource::PrimaryKey { + metric_name: Arc::from("fixture_metric"), + physical_metadata: metadata.clone(), + logical_tags: metadata + .column_metadatas + .iter() + .filter(|column| { + column.semantic_type == SemanticType::Tag + && !store_api::storage::consts::is_internal_column(&column.column_schema.name) + && !store_api::metric_engine_consts::is_metric_engine_internal_column( + &column.column_schema.name, + ) + }) + .map(|column| BoundTag { + column_id: column.column_id, + name: Arc::from(column.column_schema.name.as_str()), + }) + .collect::>() + .into(), + }; + let ranges = scanner.properties().partitions.clone(); + scanner + .prepare(PrepareRequest { + ranges: Some(ranges.clone()), + target_partitions: Some(ranges.len()), + ..Default::default() + }) + .unwrap(); + let metrics = ExecutionPlanMetricsSet::default(); + let mut streams = Vec::new(); + for partition in 0..ranges.len() { + let stream = scanner + .scan_series_partition(&QueryScanContext::default(), &metrics, partition, &source) + .unwrap() + .unwrap(); + assert_eq!(scanner.raw_series_ordering(), stream.ordering()); + assert_eq!(SeriesOrdering::Contiguous, stream.ordering()); + streams.push(stream); + } + let error = match promql::source::merge_ordered_raw_series(streams) { + Ok(_) => panic!("Contiguous two-phase input cannot satisfy ordered merge ordering"), + Err(error) => error, + }; + assert!( + error.to_string().contains("ordering") || error.to_string().contains("ordered"), + "expected ordering rejection, got: {error}" + ); +} + #[tokio::test] async fn test_mito_raw_series_int64_predicate_uses_original_precision() { use datatypes::series::samples::SampleRef; @@ -5199,7 +5923,7 @@ async fn test_mito_raw_series_int64_predicate_uses_original_precision() { ); let chunks = stream.try_collect::>().await.unwrap(); for chunk in chunks { - let axis = chunk.time.as_buffer().as_ref(); + let axis = chunk.time.as_buffer(); times.extend(axis.iter().copied()); for (index, &time) in axis.iter().enumerate() { output_values.push(( @@ -5214,6 +5938,112 @@ async fn test_mito_raw_series_int64_predicate_uses_original_precision() { } assert_eq!(vec![2], times); assert_eq!(vec![(2, 20.0)], output_values); + + // Validate the typed integer gate through RegionScanExec's actual physical consumer. + use common_query::series_frame::unpack_raw_series; + use datafusion::execution::TaskContext; + use datafusion::physical_plan::ExecutionPlan; + use datatypes::series::SeriesOrdering; + use table::table::scan::RegionScanExec; + let native_request = ScanRequest { + projection: Some(vec![2, 3]), + filters: vec![ + col("tag_0").eq(lit("series")), + col("field_0").gt(lit(boundary)), + ], + distribution: Some(TimeSeriesDistribution::PerSeries), + preserve_pk_dictionary_encoding: true, + ..Default::default() + }; + let native_scanner = engine + .handle_query(region_id, native_request.clone()) + .await + .unwrap(); + let native_metadata = native_scanner.metadata(); + let native_source = RawLabelSource::PrimaryKey { + metric_name: Arc::from("fixture_metric"), + physical_metadata: native_metadata.clone(), + logical_tags: Arc::from([BoundTag { + column_id: native_metadata.primary_key[0], + name: Arc::from("tag_0"), + }]), + }; + let native_plan = Arc::new(RegionScanExec::new(native_scanner, native_request, None).unwrap()) + .try_to_series_scan(native_source.clone()) + .unwrap() + .expect("typed int64 gate is supported"); + let native_schema = native_plan.series_schema().clone(); + let frames = native_plan + .execute(0, Arc::new(TaskContext::default())) + .unwrap(); + let chunks = unpack_raw_series( + frames, + native_schema, + native_source, + SeriesOrdering::Contiguous, + ) + .unwrap() + .try_collect::>() + .await + .unwrap(); + let native_rows = chunks + .iter() + .flat_map(|chunk| { + let times = chunk.time.as_buffer(); + (0..times.len()) + .map(|i| { + let SampleRef::Float(value) = chunk.fields.get(0).unwrap().sample(i) else { + panic!("expected float output field") + }; + (times[i], value) + }) + .collect::>() + }) + .collect::>(); + assert_eq!(vec![(2, 20.0)], native_rows); + + let empty_request = ScanRequest { + projection: Some(vec![2, 3]), + filters: vec![ + col("tag_0").eq(lit("series")), + col("field_0").gt(lit(boundary + 1)), + ], + distribution: Some(TimeSeriesDistribution::PerSeries), + preserve_pk_dictionary_encoding: true, + ..Default::default() + }; + let empty_scanner = engine + .handle_query(region_id, empty_request.clone()) + .await + .unwrap(); + let empty_metadata = empty_scanner.metadata(); + let empty_source = RawLabelSource::PrimaryKey { + metric_name: Arc::from("fixture_metric"), + physical_metadata: empty_metadata.clone(), + logical_tags: Arc::from([BoundTag { + column_id: empty_metadata.primary_key[0], + name: Arc::from("tag_0"), + }]), + }; + let empty_plan = Arc::new(RegionScanExec::new(empty_scanner, empty_request, None).unwrap()) + .try_to_series_scan(empty_source.clone()) + .unwrap() + .expect("statically empty scan still has native capability"); + let empty_schema = empty_plan.series_schema().clone(); + let empty_frames = empty_plan + .execute(0, Arc::new(TaskContext::default())) + .unwrap(); + let empty_chunks = unpack_raw_series( + empty_frames, + empty_schema, + empty_source, + SeriesOrdering::Contiguous, + ) + .unwrap() + .try_collect::>() + .await + .unwrap(); + assert!(empty_chunks.is_empty()); } /// Invalid predicate bindings decline before consumption; explicit labels decline and legacy still reads. @@ -5304,6 +6134,11 @@ async fn test_mito_raw_series_invalid_binding_before_legacy_read() { name: Arc::from("tag_0"), }]), }; + assert_eq!( + supported, + scanner.raw_series_schema(&valid_source).unwrap().is_some(), + "schema preflight case: {name}" + ); let raw = scanner .scan_series_partition(&ctx, &metrics, 0, &valid_source) .unwrap(); @@ -5313,7 +6148,7 @@ async fn test_mito_raw_series_invalid_binding_before_legacy_read() { let tuples = chunks .iter() .map(|chunk| { - let times = chunk.time.as_buffer().as_ref(); + let times = chunk.time.as_buffer(); let SampleRef::Float(value) = chunk.fields.get(0).unwrap().sample(0) else { panic!("expected raw float sample"); }; @@ -5387,6 +6222,13 @@ async fn test_mito_raw_series_invalid_binding_before_legacy_read() { .unwrap() .is_none() ); + assert!( + scanner + .raw_series_schema(&RawLabelSource::Explicit) + .unwrap() + .is_none() + ); + assert!(scanner.raw_series_schema(&valid_shape_bad_tag).is_err()); assert!( scanner .scan_series_partition(&ctx, &metrics, 0, &valid_shape_bad_tag) @@ -5427,4 +6269,70 @@ async fn test_mito_raw_series_invalid_binding_before_legacy_read() { vec![("0".to_string(), 0.0, 0), ("1".to_string(), 1.0, 1000)], rows ); + + // Runtime pruning wrappers are deliberately ineligible for native planning, and + // wrappers installed after planning must be caught at execute time. + use datafusion::execution::TaskContext; + use datafusion::physical_plan::ExecutionPlan; + use table::table::scan::RegionScanExec; + let dynamic_request = ScanRequest { + distribution: Some(TimeSeriesDistribution::PerSeries), + preserve_pk_dictionary_encoding: true, + ..Default::default() + }; + let dynamic_source_for = |scanner: &dyn RegionScanner| { + let metadata = scanner.metadata(); + RawLabelSource::PrimaryKey { + metric_name: Arc::from("fixture_metric"), + physical_metadata: metadata.clone(), + logical_tags: Arc::from([BoundTag { + column_id: metadata.primary_key[0], + name: Arc::from("tag_0"), + }]), + } + }; + let make_dynamic = || { + Arc::new(DynamicFilterPhysicalExpr::new( + vec![Arc::new(Column::new("field_0", 1))], + physical_lit(true), + )) + }; + let before = engine + .handle_query(region_id, dynamic_request.clone()) + .await + .unwrap(); + let before_source = dynamic_source_for(before.as_ref()); + let before_scan = Arc::new(RegionScanExec::new(before, dynamic_request.clone(), None).unwrap()); + assert_eq!( + vec![true], + before_scan.add_dyn_filters_to_predicate(vec![make_dynamic()]) + ); + assert!( + before_scan + .clone() + .try_to_series_scan(before_source) + .unwrap() + .is_none() + ); + + let after = engine + .handle_query(region_id, dynamic_request.clone()) + .await + .unwrap(); + let after_source = dynamic_source_for(after.as_ref()); + let after_scan = Arc::new(RegionScanExec::new(after, dynamic_request, None).unwrap()); + let after_plan = after_scan + .clone() + .try_to_series_scan(after_source) + .unwrap() + .expect("native plan before dynamic wrapper installation"); + assert_eq!( + vec![true], + after_scan.add_dyn_filters_to_predicate(vec![make_dynamic()]) + ); + assert!( + after_plan + .execute(0, Arc::new(TaskContext::default())) + .is_err() + ); } diff --git a/src/mito2/src/read/series_scan.rs b/src/mito2/src/read/series_scan.rs index eb5c1048ab5..8b4ad2acf20 100644 --- a/src/mito2/src/read/series_scan.rs +++ b/src/mito2/src/read/series_scan.rs @@ -31,13 +31,15 @@ use common_recordbatch::{RecordBatchStreamWrapper, SendableRecordBatchStream}; use common_telemetry::tracing::{self, Instrument}; use common_telemetry::{debug, warn}; use datafusion::physical_plan::metrics::ExecutionPlanMetricsSet; -use datafusion::physical_plan::{DisplayAs, DisplayFormatType}; +use datafusion::physical_plan::{DisplayAs, DisplayFormatType, PhysicalExpr}; use datafusion_common::tree_node::TreeNode; use datafusion_expr::{Expr, Volatility}; use datatypes::arrow::array::BinaryArray; use datatypes::arrow::datatypes::DataType as ArrowDataType; use datatypes::arrow::record_batch::RecordBatch; +use datatypes::prelude::ConcreteDataType; use datatypes::schema::SchemaRef; +use datatypes::series::SeriesOrdering; use datatypes::series::samples::{FieldSpec, SeriesSchema}; use datatypes::types::TimestampType; use futures::{StreamExt, TryStreamExt}; @@ -88,6 +90,12 @@ type CandidateReceiverList = Vec>; /// Candidate assignment senders for output partitions. type CandidateSenderList = Vec>>>; +struct RawScanPreparation { + schema: Arc, + fields: Vec<(usize, ConcreteDataType)>, + predicates: Vec>, +} + struct CandidateReceiver { receiver: mpsc::UnboundedReceiver>, active_receivers: Arc, @@ -194,6 +202,189 @@ impl SeriesScan { } } + fn prepare_raw_scan( + &self, + label_source: &RawLabelSource, + ) -> Result, BoxedError> { + let input = &self.stream_ctx.input; + let metadata = input.mapper.metadata(); + match label_source { + RawLabelSource::PrimaryKey { + physical_metadata, + logical_tags, + .. + } => { + if !Arc::ptr_eq(metadata, physical_metadata) { + debug!( + "Raw series scan preflight rejected metadata snapshot: region_id={}, physical_region_id={}, schema_version={}, physical_schema_version={}", + metadata.region_id, + physical_metadata.region_id, + metadata.schema_version, + physical_metadata.schema_version, + ); + return Err(BoxedError::new( + InvalidRecordBatchSnafu { + reason: "raw label source metadata does not match scanner snapshot" + .to_string(), + } + .build(), + )); + } + let mut ids = HashSet::new(); + let mut names = HashSet::new(); + for tag in logical_tags.iter() { + let column = metadata.column_by_id(tag.column_id).filter(|column| { + column.semantic_type == SemanticType::Tag + && metadata.primary_key.contains(&tag.column_id) + }); + let valid = column.is_some_and(|column| { + column.column_schema.name == tag.name.as_ref() + && tag.name.as_ref() != "__name__" + && !is_internal_column(tag.name.as_ref()) + && !is_metric_engine_internal_column(tag.name.as_ref()) + && !ReservedColumnId::is_reserved(tag.column_id) + }); + let unique_id = valid && ids.insert(tag.column_id); + let unique_name = unique_id && names.insert(tag.name.as_ref()); + if !valid || !unique_id || !unique_name { + debug!( + "Raw series scan preflight rejected label binding: region_id={}, column_id={}, binding_valid={}, unique_id={}, unique_name={}", + metadata.region_id, tag.column_id, valid, unique_id, unique_name, + ); + return Err(BoxedError::new( + InvalidRecordBatchSnafu { + reason: "invalid raw label binding".to_string(), + } + .build(), + )); + } + } + } + RawLabelSource::Explicit => { + debug!( + "Raw series scan preflight rejected explicit labels: region_id={}", + metadata.region_id, + ); + return Ok(None); + } + } + let selected = input.mapper.output_schema(); + let mut fields = Vec::new(); + let mut specs = Vec::new(); + for output in selected.column_schemas() { + let Some(column) = metadata.column_metadatas.iter().find(|column| { + column.column_schema.name == output.name + && column.semantic_type == SemanticType::Field + }) else { + continue; + }; + let Some((index, (_, data_type))) = input + .mapper + .batch_schema() + .iter() + .enumerate() + .find(|(_, (id, _))| *id == column.column_id) + else { + debug!( + "Raw series scan preflight missing mapper field: region_id={}, column_id={}", + metadata.region_id, column.column_id, + ); + return Err(BoxedError::new( + InvalidRecordBatchSnafu { + reason: format!( + "selected field {} is missing from mapper batch schema", + output.name + ), + } + .build(), + )); + }; + if !data_type.is_numeric() && !is_native_histogram_value_type(data_type) { + debug!( + "Raw series scan preflight rejected field type: region_id={}, column_id={}", + metadata.region_id, column.column_id, + ); + return Ok(None); + } + fields.push((index, data_type.clone())); + specs.push(FieldSpec { + name: Arc::from(output.name.as_str()), + }); + } + let time_is_millis = matches!(metadata.time_index_type(), TimestampType::Millisecond(_)); + if fields.is_empty() + || input.append_mode + || input.series_row_selector.is_some() + || !time_is_millis + { + debug!( + "Raw series scan preflight rejected scan options: region_id={}, selected_fields={}, append_mode={}, row_selector={}, time_is_millis={}", + metadata.region_id, + fields.len(), + input.append_mode, + input.series_row_selector.is_some(), + time_is_millis, + ); + return Ok(None); + } + let schema = Arc::new(SeriesSchema { + fields: specs.into(), + eval_grid: None, + }); + let typed_schema = input.mapper.input_arrow_schema(false); + let mut predicates = Vec::new(); + if let Some(predicate) = input.predicate_group().predicate_without_region() { + if !predicate.dyn_filters().is_empty() { + debug!( + "Raw series scan preflight rejected dynamic predicate filters: region_id={}", + metadata.region_id, + ); + return Ok(None); + } + for expr in predicate.exprs() { + // Fresh execution properties cannot preserve Stable or query-dependent semantics. + if expr + .exists(|node| { + Ok(matches!(node, Expr::ScalarFunction(function) + if function.func.signature().volatility != Volatility::Immutable) + || matches!(node, Expr::ScalarVariable(..))) + }) + .unwrap_or(true) + { + debug!( + "Raw series scan preflight rejected predicate volatility or variable: region_id={}", + metadata.region_id, + ); + return Ok(None); + } + // Evaluate residuals with original types before raw conversion to Float64. + let Ok(physical) = Predicate::to_physical_expr(expr, &typed_schema) else { + debug!( + "Raw series scan preflight failed predicate compilation: region_id={}", + metadata.region_id, + ); + return Ok(None); + }; + if !matches!( + physical.data_type(&typed_schema), + Ok(ArrowDataType::Boolean | ArrowDataType::Null) + ) { + debug!( + "Raw series scan preflight rejected predicate type: region_id={}", + metadata.region_id, + ); + return Ok(None); + } + predicates.push(physical); + } + } + Ok(Some(RawScanPreparation { + schema, + fields, + predicates, + })) + } + fn supports_two_phase(input: &ScanInput) -> bool { if !is_sparse_metric_metadata(input.region_metadata()) { return false; @@ -578,6 +769,22 @@ impl RegionScanner for SeriesScan { .map_err(BoxedError::new) } + fn raw_series_ordering(&self) -> SeriesOrdering { + match self.mode { + SeriesScanMode::Legacy => SeriesOrdering::KeyThenTime, + SeriesScanMode::TwoPhase => SeriesOrdering::Contiguous, + } + } + + fn raw_series_schema( + &self, + label_source: &RawLabelSource, + ) -> Result>, BoxedError> { + Ok(self + .prepare_raw_scan(label_source)? + .map(|preparation| preparation.schema)) + } + fn scan_series_partition( &self, ctx: &QueryScanContext, @@ -585,171 +792,9 @@ impl RegionScanner for SeriesScan { partition: usize, label_source: &RawLabelSource, ) -> Result, BoxedError> { - let input = &self.stream_ctx.input; - let metadata = input.mapper.metadata(); - match label_source { - RawLabelSource::PrimaryKey { - physical_metadata, - logical_tags, - .. - } => { - if !Arc::ptr_eq(metadata, physical_metadata) { - debug!( - "Raw series scan preflight rejected metadata snapshot: region_id={}, physical_region_id={}, schema_version={}, physical_schema_version={}", - metadata.region_id, - physical_metadata.region_id, - metadata.schema_version, - physical_metadata.schema_version, - ); - return Err(BoxedError::new( - InvalidRecordBatchSnafu { - reason: "raw label source metadata does not match scanner snapshot" - .to_string(), - } - .build(), - )); - } - let mut ids = HashSet::new(); - let mut names = HashSet::new(); - for tag in logical_tags.iter() { - let column = metadata.column_by_id(tag.column_id).filter(|column| { - column.semantic_type == SemanticType::Tag - && metadata.primary_key.contains(&tag.column_id) - }); - let valid = column.is_some_and(|column| { - column.column_schema.name == tag.name.as_ref() - && tag.name.as_ref() != "__name__" - && !is_internal_column(tag.name.as_ref()) - && !is_metric_engine_internal_column(tag.name.as_ref()) - && !ReservedColumnId::is_reserved(tag.column_id) - }); - let unique_id = valid && ids.insert(tag.column_id); - let unique_name = unique_id && names.insert(tag.name.as_ref()); - if !valid || !unique_id || !unique_name { - debug!( - "Raw series scan preflight rejected label binding: region_id={}, column_id={}, binding_valid={}, unique_id={}, unique_name={}", - metadata.region_id, tag.column_id, valid, unique_id, unique_name, - ); - return Err(BoxedError::new( - InvalidRecordBatchSnafu { - reason: "invalid raw label binding".to_string(), - } - .build(), - )); - } - } - } - RawLabelSource::Explicit => { - debug!( - "Raw series scan preflight rejected explicit labels: region_id={}", - metadata.region_id, - ); - return Ok(None); - } - } - let selected = input.mapper.output_schema(); - let mut fields = Vec::new(); - let mut specs = Vec::new(); - for output in selected.column_schemas() { - let Some(column) = metadata.column_metadatas.iter().find(|column| { - column.column_schema.name == output.name - && column.semantic_type == SemanticType::Field - }) else { - continue; - }; - let Some((index, (_, data_type))) = input - .mapper - .batch_schema() - .iter() - .enumerate() - .find(|(_, (id, _))| *id == column.column_id) - else { - debug!( - "Raw series scan preflight missing mapper field: region_id={}, column_id={}", - metadata.region_id, column.column_id, - ); - return Err(BoxedError::new( - InvalidRecordBatchSnafu { - reason: format!( - "selected field {} is missing from mapper batch schema", - output.name - ), - } - .build(), - )); - }; - if !data_type.is_numeric() && !is_native_histogram_value_type(data_type) { - debug!( - "Raw series scan preflight rejected field type: region_id={}, column_id={}", - metadata.region_id, column.column_id, - ); - return Ok(None); - } - fields.push((index, data_type.clone())); - specs.push(FieldSpec { - name: Arc::from(output.name.as_str()), - }); - } - let time_is_millis = matches!(metadata.time_index_type(), TimestampType::Millisecond(_)); - if fields.is_empty() - || input.append_mode - || input.series_row_selector.is_some() - || !time_is_millis - { - debug!( - "Raw series scan preflight rejected scan options: region_id={}, selected_fields={}, append_mode={}, row_selector={}, time_is_millis={}", - metadata.region_id, - fields.len(), - input.append_mode, - input.series_row_selector.is_some(), - time_is_millis, - ); + let Some(preparation) = self.prepare_raw_scan(label_source)? else { return Ok(None); - } - let schema = Arc::new(SeriesSchema { - fields: specs.into(), - eval_grid: None, - }); - let typed_schema = input.mapper.input_arrow_schema(false); - let mut predicates = Vec::new(); - if let Some(predicate) = input.predicate_group().predicate_without_region() { - for expr in predicate.exprs() { - // Fresh execution properties cannot preserve Stable or query-dependent semantics. - if expr - .exists(|node| { - Ok(matches!(node, Expr::ScalarFunction(function) - if function.func.signature().volatility != Volatility::Immutable) - || matches!(node, Expr::ScalarVariable(..))) - }) - .unwrap_or(true) - { - debug!( - "Raw series scan preflight rejected predicate volatility or variable: region_id={}", - metadata.region_id, - ); - return Ok(None); - } - // Evaluate residuals with original types before raw conversion to Float64. - let Ok(physical) = Predicate::to_physical_expr(expr, &typed_schema) else { - debug!( - "Raw series scan preflight failed predicate compilation: region_id={}", - metadata.region_id, - ); - return Ok(None); - }; - if !matches!( - physical.data_type(&typed_schema), - Ok(ArrowDataType::Boolean | ArrowDataType::Null) - ) { - debug!( - "Raw series scan preflight rejected predicate type: region_id={}", - metadata.region_id, - ); - return Ok(None); - } - predicates.push(physical); - } - } + }; let metrics = new_partition_metrics( &self.stream_ctx, ctx.explain_verbose, @@ -760,13 +805,15 @@ impl RegionScanner for SeriesScan { let batches = self .scan_batch_in_partition(ctx, partition, metrics.clone(), metrics_set) .map_err(BoxedError::new)?; + let ordering = self.raw_series_ordering(); Ok(Some(raw::make_stream( batches, - schema, + preparation.schema, label_source.clone(), - fields, + preparation.fields, metrics, - predicates, + preparation.predicates, + ordering, ))) } diff --git a/src/mito2/src/read/series_scan/raw.rs b/src/mito2/src/read/series_scan/raw.rs index 6ed41bf8c14..4adac4263ae 100644 --- a/src/mito2/src/read/series_scan/raw.rs +++ b/src/mito2/src/read/series_scan/raw.rs @@ -128,6 +128,7 @@ fn chunk( struct RawStream { schema: Arc, label_source: RawLabelSource, + ordering: SeriesOrdering, inner: BoxStream<'static, Result>, } @@ -146,7 +147,7 @@ impl RawSeriesStream for RawStream { &self.label_source } fn ordering(&self) -> SeriesOrdering { - SeriesOrdering::Contiguous + self.ordering } } @@ -157,15 +158,16 @@ pub(crate) fn make_stream( fields: Vec<(usize, ConcreteDataType)>, metrics: PartitionMetrics, predicates: Vec>, + ordering: SeriesOrdering, ) -> SendableRawSeriesStream { let output_schema = schema.clone(); let stream = async_stream::stream! { let mut input = inner; let mut pending: Option = None; while let Some(item) = input.next().await { - let (records, is_legacy) = match item { - Ok(ScanBatch::Series(SeriesBatch::Flat(flat))) => (flat.batches.into_vec(), true), - Ok(ScanBatch::RecordBatch(batch)) => (vec![batch], false), + let records = match item { + Ok(ScanBatch::Series(SeriesBatch::Flat(flat))) => flat.batches.into_vec(), + Ok(ScanBatch::RecordBatch(batch)) => vec![batch], Err(error) => { yield Err(BoxedError::new(error)); return; } }; for record in records { @@ -238,7 +240,7 @@ pub(crate) fn make_stream( }; metrics.inc_convert_batch_cost(begun.elapsed()); if let Some(old) = pending.as_ref() - && is_legacy + && ordering == SeriesOrdering::KeyThenTime && old.primary_key.as_slice() != current.primary_key.as_slice() && current.primary_key.as_slice() <= old.primary_key.as_slice() { @@ -265,6 +267,7 @@ pub(crate) fn make_stream( Box::pin(RawStream { schema, label_source, + ordering, inner: Box::pin(stream), }) } diff --git a/src/mito2/src/read/series_scan/raw/tests.rs b/src/mito2/src/read/series_scan/raw/tests.rs index 22dd3eefa15..1fdd703b00d 100644 --- a/src/mito2/src/read/series_scan/raw/tests.rs +++ b/src/mito2/src/read/series_scan/raw/tests.rs @@ -37,6 +37,7 @@ use datatypes::arrow::record_batch::RecordBatch; use datatypes::data_type::DataType as _; use datatypes::prelude::ConcreteDataType; use datatypes::schema::ColumnSchema; +use datatypes::series::SeriesOrdering; use datatypes::series::raw::RawSeriesChunk; use datatypes::series::samples::{FieldSpec, SampleRef, SeriesSchema}; use futures::{Stream, StreamExt, stream}; @@ -239,6 +240,7 @@ fn convert_with_source( schema: Arc, source: RawLabelSource, field_type: ConcreteDataType, + ordering: SeriesOrdering, ) -> SendableRawSeriesStream { make_stream( inner, @@ -247,6 +249,7 @@ fn convert_with_source( vec![(0, field_type)], metrics(), vec![], + ordering, ) } @@ -267,6 +270,17 @@ fn convert(inner: ScanBatchStream, schema: Arc) -> SendableRawSeri schema, primary_key_source(metadata()), ConcreteDataType::int64_datatype(), + SeriesOrdering::Contiguous, + ) +} + +fn convert_ordered(inner: ScanBatchStream, schema: Arc) -> SendableRawSeriesStream { + convert_with_source( + inner, + schema, + primary_key_source(metadata()), + ConcreteDataType::int64_datatype(), + SeriesOrdering::KeyThenTime, ) } @@ -370,6 +384,59 @@ async fn chunks_preserve_keys_values_times_and_final_flags_for_both_input_shapes } } +#[tokio::test] +async fn raw_stream_reports_and_enforces_declared_ordering() { + let stream = convert(input(vec![]), schema()); + assert_eq!(stream.ordering(), SeriesOrdering::Contiguous); + drop(stream); + let stream = convert_ordered(input(vec![]), schema()); + assert_eq!(stream.ordering(), SeriesOrdering::KeyThenTime); + drop(stream); + + let mut output = convert_ordered( + input(vec![ + Ok(ScanBatch::RecordBatch(dictionary_batch( + &[b"z"], + &[1], + &[Some(1)], + ))), + Ok(ScanBatch::RecordBatch(dictionary_batch( + &[b"a"], + &[1], + &[Some(2)], + ))), + ]), + schema(), + ); + assert!(output.next().await.unwrap().is_err()); + assert!(output.next().await.is_none()); + + let mut output = convert( + input(vec![ + Ok(ScanBatch::RecordBatch(dictionary_batch( + &[b"z"], + &[1], + &[Some(1)], + ))), + Ok(ScanBatch::RecordBatch(dictionary_batch( + &[b"a"], + &[1], + &[Some(2)], + ))), + ]), + schema(), + ); + assert_eq!( + output.next().await.unwrap().unwrap().primary_key.as_slice(), + b"z" + ); + assert_eq!( + output.next().await.unwrap().unwrap().primary_key.as_slice(), + b"a" + ); + assert!(output.next().await.is_none()); +} + #[tokio::test] async fn typed_predicate_filters_before_numeric_samples_are_cast() { let threshold = 1_i64 << 53; @@ -395,6 +462,7 @@ async fn typed_predicate_filters_before_numeric_samples_are_cast() { vec![(0, ConcreteDataType::int64_datatype())], metrics(), vec![predicate], + SeriesOrdering::Contiguous, ); let chunk = output.next().await.unwrap().unwrap(); assert!(chunk.is_last); @@ -424,6 +492,7 @@ async fn predicate_error_is_terminal() { vec![(0, ConcreteDataType::int64_datatype())], metrics(), vec![predicate], + SeriesOrdering::Contiguous, ); assert!(output.next().await.unwrap().is_err()); assert!(output.next().await.is_none()); @@ -515,7 +584,7 @@ async fn legacy_series_requires_increasing_keys_but_record_batches_do_not() { let mut batches = smallvec::SmallVec::new(); batches.push(dictionary_batch(&[b"b"], &[1], &[Some(1)])); batches.push(dictionary_batch(&[b"a"], &[2], &[Some(2)])); - let mut output = convert( + let mut output = convert_ordered( input(vec![Ok(ScanBatch::Series(SeriesBatch::Flat( FlatSeriesBatch { batches }, )))]), @@ -528,7 +597,7 @@ async fn legacy_series_requires_increasing_keys_but_record_batches_do_not() { batches.push(dictionary_batch(&[b"a"], &[1], &[Some(1)])); batches.push(dictionary_batch(&[b"b"], &[1], &[Some(2)])); batches.push(dictionary_batch(&[b"a"], &[2], &[Some(3)])); - let mut output = convert( + let mut output = convert_ordered( input(vec![Ok(ScanBatch::Series(SeriesBatch::Flat( FlatSeriesBatch { batches }, )))]), @@ -545,7 +614,7 @@ async fn legacy_series_requires_increasing_keys_but_record_batches_do_not() { let mut batches = smallvec::SmallVec::new(); batches.push(dictionary_batch(&[b"a"], &[1], &[Some(1)])); batches.push(dictionary_batch(&[b"b"], &[1], &[Some(2)])); - let mut output = convert( + let mut output = convert_ordered( input(vec![Ok(ScanBatch::Series(SeriesBatch::Flat( FlatSeriesBatch { batches }, )))]), @@ -636,6 +705,7 @@ async fn native_histogram_adapter_preserves_complete_payload() { native_histogram_value_type().clone(), )), native_histogram_value_type().clone(), + SeriesOrdering::Contiguous, ); assert!(matches!( raw.label_source(), From 8e90db600d10ee226b42d66c64856766ddb259d2 Mon Sep 17 00:00:00 2001 From: discord9 <55937128+discord9@users.noreply.github.com> Date: Tue, 20 Oct 2026 20:27:44 +0800 Subject: [PATCH 2/5] test(mito2): cover raw partition bounds and contiguity across assignments The raw-series path had two untested behaviours. An out-of-range partition must fail without consuming the scanner's partition state: the range check runs before the receiver is taken, so a later in-bounds scan on the same scanner still reads its complete data, and a repeat scan of that partition then reports the one-shot violation. A two-phase stream must stay contiguous in the sense the raw contract advertises, including across candidate assignments: chunks are checked per partition for a non-empty, disjoint key set, the whole stream is routed through the frame codec so its own sequence validator runs, and a series may appear in only one run so a non-adjacent recurrence would fail. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> --- src/mito2/src/engine/scan_test.rs | 501 ++++++++++++++++++++++++++++++ 1 file changed, 501 insertions(+) diff --git a/src/mito2/src/engine/scan_test.rs b/src/mito2/src/engine/scan_test.rs index 3ad13fac11e..6fe07d63ecd 100644 --- a/src/mito2/src/engine/scan_test.rs +++ b/src/mito2/src/engine/scan_test.rs @@ -5826,6 +5826,507 @@ async fn test_two_phase_native_raw_stream_is_rejected_by_ordered_merge() { ); } +#[tokio::test] +async fn test_two_phase_raw_partition_out_of_range_keeps_scanner_usable() { + use datatypes::series::samples::SampleRef; + use store_api::region_engine::QueryScanContext; + + let mut env = TestEnv::with_prefix("test_two_phase_raw_partition_out_of_range").await; + let engine = env + .create_engine(MitoConfig { + experimental_series_scan_v2: true, + ..Default::default() + }) + .await; + let region_id = RegionId::new(1, 1); + let (metadata, row_schema) = create_two_phase_sparse_region(&engine, region_id).await; + let expected = [ + (new_sparse_primary_key(&["a", "x"], &metadata, 10, 0), 10, 1), + (new_sparse_primary_key(&["b", "x"], &metadata, 10, 0), 20, 2), + ]; + put_sparse_rows( + &engine, + region_id, + &row_schema, + expected + .iter() + .map(|(key, time, value)| (key.clone(), *time, *value)) + .collect(), + ) + .await; + test_util::flush_region(&engine, region_id, None).await; + + let request = ScanRequest { + distribution: Some(TimeSeriesDistribution::PerSeries), + preserve_pk_dictionary_encoding: true, + ..Default::default() + }; + let Scanner::Series(selected) = engine.scanner(region_id, request.clone()).await.unwrap() + else { + panic!("sparse PerSeries request must use SeriesScan"); + }; + assert_eq!("two_phase", selected.mode()); + let mut scanner = engine.handle_query(region_id, request).await.unwrap(); + let source = primary_key_label_source(&scanner.metadata()); + let ranges = scanner.properties().partitions.clone(); + scanner + .prepare(PrepareRequest { + ranges: Some(ranges.clone()), + target_partitions: Some(ranges.len()), + ..Default::default() + }) + .unwrap(); + let partitions = scanner.properties().num_partitions(); + assert!(partitions > 0, "prepared scan needs an output partition"); + let metrics = ExecutionPlanMetricsSet::default(); + let ctx = QueryScanContext::default(); + + // `scan_batch_in_partition` validates the index before it takes that partition's receiver, so + // the first index past the last partition must fail without disturbing scanner state. + let error = match scanner.scan_series_partition(&ctx, &metrics, partitions, &source) { + Ok(_) => { + panic!("partition {partitions} must be rejected by a {partitions}-partitions scan") + } + Err(error) => error, + }; + let message = error.to_string(); + assert!( + message.contains("out of range") && message.contains(&partitions.to_string()), + "expected a partition range error, got: {message}" + ); + + // The in-range partition must still read the complete data set. + let stream = scanner + .scan_series_partition(&ctx, &metrics, 0, &source) + .unwrap() + .expect("the raw series scan stays available after a rejected partition"); + let mut actual = HashMap::new(); + for chunk in stream.try_collect::>().await.unwrap() { + let times = chunk.time.as_buffer(); + for (index, time) in times.iter().enumerate() { + let SampleRef::Float(value) = chunk.fields.get(0).unwrap().sample(index) else { + panic!("raw fields are converted to float samples"); + }; + actual.insert((chunk.primary_key.to_vec(), *time), value); + } + } + assert_eq!( + expected.len(), + actual.len(), + "the rejected call must not consume rows" + ); + for (key, time, value) in expected { + assert_eq!(Some(&(value as f64)), actual.get(&(key, time))); + } + + // A partition can only be scanned once, so this proves the rejected index never took the + // in-range partition's receiver: the error above is raised by the range check alone. + let repeated = match scanner.scan_series_partition(&ctx, &metrics, 0, &source) { + Ok(_) => panic!("partition 0 was already scanned"), + Err(error) => error.to_string(), + }; + assert!( + repeated.contains("scan multiple times"), + "expected a repeated-scan error, got: {repeated}" + ); +} + +#[tokio::test] +async fn test_two_phase_raw_stream_stays_contiguous_across_assignments() { + use common_query::series_frame::{pack_raw_series, unpack_raw_series}; + use datatypes::series::SeriesOrdering; + use datatypes::series::raw::RawSeriesChunk; + use datatypes::series::samples::{SampleRef, SeriesSchema}; + use store_api::region_engine::QueryScanContext; + + let mut env = TestEnv::with_prefix("test_two_phase_raw_contiguous_assignments").await; + let engine = env + .create_engine(MitoConfig { + experimental_series_scan_v2: true, + ..Default::default() + }) + .await; + let region_id = RegionId::new(1, 1); + let (metadata, row_schema) = create_two_phase_sparse_region(&engine, region_id).await; + + // A sparse primary key carries the TSID, and `SeriesRange::partition_for` splits the u64 TSID + // domain over the output partitions, so the fixture splits into two disjoint groups of series: + // tsids below 2^63 own partition 0 and tsids at or above 2^63 own partition 1. + let series = [ + ("a0", 0_u64), + ("a1", 1), + ("b0", 1_u64 << 63), + ("b1", (1_u64 << 63) + 1), + ]; + let keys = series + .iter() + .map(|(tag, tsid)| new_sparse_primary_key(&[tag, "x"], &metadata, 10, *tsid)) + .collect::>(); + + // Three write rounds put every series into two SST ranges plus one memtable range, and the + // large rounds make a series span more than one read batch, so one series is emitted as + // multiple chunks instead of exactly one. + const LARGE: i64 = 20_000; + const SMALL: i64 = 3; + let rounds: [&[(usize, i64, i64)]; 3] = [ + &[(0, 0, LARGE), (1, 0, SMALL), (2, 0, SMALL), (3, 0, LARGE)], + &[ + (0, LARGE, 5), + (1, SMALL, SMALL), + (2, SMALL, SMALL), + (3, LARGE, 5), + ], + &[ + (0, LARGE + 5, 2), + (1, 2 * SMALL, 2), + (2, 2 * SMALL, 2), + (3, LARGE + 5, 2), + ], + ]; + let mut expected_times = HashMap::, Vec>::new(); + for spec in rounds { + for &(index, first, count) in spec { + expected_times + .entry(keys[index].clone()) + .or_default() + .extend(first..first + count); + } + } + for (round, spec) in rounds.iter().enumerate() { + let rows = spec + .iter() + .flat_map(|&(index, first, count)| { + let key = keys[index].clone(); + (0..count).map(move |offset| { + let time = first + offset; + (key.clone(), time, (time + 1) as u64) + }) + }) + .collect::>(); + put_sparse_rows(&engine, region_id, &row_schema, rows).await; + if round + 1 < rounds.len() { + test_util::flush_region(&engine, region_id, None).await; + } + } + + let request = ScanRequest { + distribution: Some(TimeSeriesDistribution::PerSeries), + preserve_pk_dictionary_encoding: true, + ..Default::default() + }; + let mut scanner = engine.handle_query(region_id, request).await.unwrap(); + assert_eq!(SeriesOrdering::Contiguous, scanner.raw_series_ordering()); + let source = primary_key_label_source(&scanner.metadata()); + let ranges = scanner + .properties() + .partitions + .clone() + .into_iter() + .flatten() + .collect::>(); + assert!(!ranges.is_empty(), "region scan needs an input range"); + // Two output partitions make the candidate distributor create one reader assignment per + // partition, so the scan runs more than one assignment. + let partition_count = 2; + let mut partitions = vec![Vec::new(); partition_count]; + for (index, range) in ranges.into_iter().enumerate() { + partitions[index % partition_count].push(range); + } + scanner + .prepare(PrepareRequest { + ranges: Some(partitions), + target_partitions: Some(partition_count), + ..Default::default() + }) + .unwrap(); + assert_eq!(partition_count, scanner.properties().num_partitions()); + + let metrics = ExecutionPlanMetricsSet::default(); + let ctx = QueryScanContext::default(); + let mut per_partition = Vec::with_capacity(partition_count); + let mut schema: Option> = None; + for partition in 0..partition_count { + let stream = scanner + .scan_series_partition(&ctx, &metrics, partition, &source) + .unwrap() + .expect("two-phase raw scan is supported"); + assert_eq!(SeriesOrdering::Contiguous, stream.ordering()); + assert_eq!( + vec!["field_0"], + stream + .schema() + .fields + .iter() + .map(|field| field.name.as_ref()) + .collect::>() + ); + schema.get_or_insert_with(|| Arc::clone(stream.schema())); + let chunks = stream.try_collect::>().await.unwrap(); + assert!( + !chunks.is_empty(), + "partition {partition} must own a reader assignment" + ); + // Each partition owns exactly the series the TSID split assigned to it, so the two + // assignment streams are non-empty and disjoint. + let mut observed = chunks + .iter() + .map(|chunk| chunk.primary_key.to_vec()) + .collect::>(); + observed.sort(); + observed.dedup(); + let mut assigned = vec![keys[2 * partition].clone(), keys[2 * partition + 1].clone()]; + assigned.sort(); + assert_eq!( + assigned, observed, + "partition {partition} must own exactly its assigned series" + ); + per_partition.push(chunks); + } + + // The complete raw series stream of the multi-assignment scan: every assignment's chunks in + // partition order. + let complete = per_partition + .into_iter() + .flatten() + .collect::>(); + let schema = schema.unwrap(); + let complete_rows = complete.iter().map(|chunk| chunk.time.len()).sum::(); + assert_eq!( + expected_times.values().map(Vec::len).sum::(), + complete_rows, + "the complete stream must carry every written row" + ); + + // Reuse the frame adapter's cross-chunk validator (private to + // `common_query::series_frame`) by packing and unpacking the complete stream. It rejects a key + // change that was not preceded by that key's final chunk, a key that recurs right after its + // final chunk, timestamps that do not increase across chunks, and a stream whose last chunk is + // not final. + let packed = pack_raw_series(Box::pin(ChainedRawSeriesStream::new( + Arc::clone(&schema), + source.clone(), + SeriesOrdering::Contiguous, + complete.clone(), + ))) + .unwrap(); + let unpacked = unpack_raw_series( + packed, + Arc::clone(&schema), + source, + SeriesOrdering::Contiguous, + ) + .unwrap(); + let validated = unpacked.try_collect::>().await.unwrap(); + assert_eq!( + complete_rows, + validated + .iter() + .map(|chunk| chunk.time.len()) + .sum::(), + "packing and unpacking must preserve the complete stream" + ); + + // `SequenceValidator` checks adjacent chunks only, so also reject non-adjacent recurrence: a + // series interrupted by another series and resumed later would break `Contiguous`. + let mut runs = Vec::>::new(); + let mut chunks_per_series = HashMap::, usize>::new(); + for chunk in &complete { + let key = chunk.primary_key.to_vec(); + *chunks_per_series.entry(key.clone()).or_default() += 1; + if runs.last() != Some(&key) { + assert!( + !runs.contains(&key), + "a series' chunks must stay contiguous across assignments" + ); + runs.push(key); + } + } + assert_eq!(keys.len(), runs.len(), "every series appears exactly once"); + assert!( + chunks_per_series.values().copied().max().unwrap() > 1, + "the fixture must emit multiple chunks for one series, got {chunks_per_series:?}" + ); + assert_eq!(keys.len(), chunks_per_series.len()); + for (key, times) in &expected_times { + let observed = complete + .iter() + .filter(|chunk| chunk.primary_key.as_slice() == key.as_slice()) + .flat_map(|chunk| chunk.time.as_buffer().iter().copied()) + .collect::>(); + assert_eq!( + times, &observed, + "sample positions must increase per series" + ); + } + for (index, chunk) in complete.iter().enumerate() { + let next_is_same_series = complete + .get(index + 1) + .is_some_and(|next| next.primary_key.as_slice() == chunk.primary_key.as_slice()); + assert_eq!( + !next_is_same_series, chunk.is_last, + "is_last must mark the final chunk of a series" + ); + let times = chunk.time.as_buffer(); + for (sample, time) in times.iter().enumerate() { + let SampleRef::Float(value) = chunk.fields.get(0).unwrap().sample(sample) else { + panic!("raw fields are converted to float samples"); + }; + assert_eq!((*time + 1) as f64, value); + } + } +} + +/// Creates the sparse-encoded flat region shared by the two-phase raw scan tests. +/// +/// Returns the region metadata and the row schema accepted by the sparse write path. +async fn create_two_phase_sparse_region( + engine: &crate::engine::MitoEngine, + region_id: RegionId, +) -> ( + Arc, + Vec, +) { + let metadata = Arc::new(sst_region_metadata_with_encoding( + PrimaryKeyEncoding::Sparse, + )); + let mut create = CreateRequestBuilder::new().build(); + create.column_metadatas = metadata.column_metadatas.clone(); + create.primary_key = metadata.primary_key.clone(); + create + .options + .insert(PRIMARY_KEY_ENCODING.to_string(), "sparse".to_string()); + create + .options + .insert("memtable.type".to_string(), "bulk".to_string()); + create + .options + .insert("sst_format".to_string(), "flat".to_string()); + let full_schema = test_util::rows_schema(&create); + let mut key_schema = full_schema[0].clone(); + key_schema.column_name = PRIMARY_KEY_COLUMN_NAME.to_string(); + key_schema.datatype = ColumnDataType::Binary.into(); + key_schema.semantic_type = SemanticType::Tag.into(); + let row_schema = vec![key_schema, full_schema[5].clone(), full_schema[4].clone()]; + engine + .handle_request(region_id, RegionRequest::Create(create)) + .await + .unwrap(); + (metadata, row_schema) +} + +/// Writes `(primary key, timestamp, field_0)` rows through the sparse write path. +async fn put_sparse_rows( + engine: &crate::engine::MitoEngine, + region_id: RegionId, + schema: &[api::v1::ColumnSchema], + rows: Vec<(Vec, i64, u64)>, +) { + let rows = rows + .into_iter() + .map(|(key, time, value)| { + row(vec![ + ValueData::BinaryValue(key), + ValueData::TimestampMillisecondValue(time), + ValueData::U64Value(value), + ]) + }) + .collect(); + engine + .handle_request( + region_id, + RegionRequest::Put(RegionPutRequest { + rows: Rows { + schema: schema.to_vec(), + rows, + }, + hint: Some(WriteHint { + primary_key_encoding: api::v1::PrimaryKeyEncoding::Sparse.into(), + }), + skip_wal: false, + partition_expr_version: None, + }), + ) + .await + .unwrap(); +} + +/// Binds every non-internal tag column of `metadata` as the raw label source. +fn primary_key_label_source( + metadata: &store_api::metadata::RegionMetadataRef, +) -> store_api::region_engine::RawLabelSource { + use store_api::region_engine::{BoundTag, RawLabelSource}; + + RawLabelSource::PrimaryKey { + metric_name: Arc::from("fixture_metric"), + physical_metadata: Arc::clone(metadata), + logical_tags: metadata + .column_metadatas + .iter() + .filter(|column| { + column.semantic_type == SemanticType::Tag + && !store_api::storage::consts::is_internal_column(&column.column_schema.name) + && !store_api::metric_engine_consts::is_metric_engine_internal_column( + &column.column_schema.name, + ) + }) + .map(|column| BoundTag { + column_id: column.column_id, + name: Arc::from(column.column_schema.name.as_str()), + }) + .collect::>() + .into(), + } +} + +/// Concatenates the raw chunks of every reader assignment of one scan, in partition order. +struct ChainedRawSeriesStream { + schema: Arc, + label_source: store_api::region_engine::RawLabelSource, + ordering: datatypes::series::SeriesOrdering, + chunks: std::vec::IntoIter, +} + +impl ChainedRawSeriesStream { + fn new( + schema: Arc, + label_source: store_api::region_engine::RawLabelSource, + ordering: datatypes::series::SeriesOrdering, + chunks: Vec, + ) -> Self { + Self { + schema, + label_source, + ordering, + chunks: chunks.into_iter(), + } + } +} + +impl futures::Stream for ChainedRawSeriesStream { + type Item = Result; + + fn poll_next( + mut self: std::pin::Pin<&mut Self>, + _cx: &mut std::task::Context<'_>, + ) -> std::task::Poll> { + std::task::Poll::Ready(self.chunks.next().map(Ok)) + } +} + +impl store_api::region_engine::RawSeriesStream for ChainedRawSeriesStream { + fn schema(&self) -> &Arc { + &self.schema + } + + fn label_source(&self) -> &store_api::region_engine::RawLabelSource { + &self.label_source + } + + fn ordering(&self) -> datatypes::series::SeriesOrdering { + self.ordering + } +} + #[tokio::test] async fn test_mito_raw_series_int64_predicate_uses_original_precision() { use datatypes::series::samples::SampleRef; From 38f728ee3fa97e4405a1a4466022f7e63fe04b43 Mon Sep 17 00:00:00 2001 From: discord9 <55937128+discord9@users.noreply.github.com> Date: Tue, 20 Oct 2026 21:42:34 +0800 Subject: [PATCH 3/5] test(mito2): cover a second assignment reaching the same partition The cross-assignment test wrote four candidate series, gave each of two output partitions one assignment, and concatenated the two streams. It proved that two disjoint non-empty assignments stay contiguous once joined, but production only sends a second round to the *same* receiver when one collection round holds `CANDIDATE_SERIES_ASSIGNMENT_THRESHOLD` (1,000,000) candidates, so that boundary was never crossed. The new test lowers the threshold through a `#[cfg(test)]` override instead of writing a million series, then writes 501 series -- one candidate batch plus a trailing remainder -- into a single output partition and asserts on that partition's one stream: two or more assignment rounds were sent, every series appears exactly once in key order with no recurrence, timestamps increase within a key, `is_last` is correct at the boundary, and every value matches. The stream then goes through `pack_raw_series`/`unpack_raw_series` so `SequenceValidator` runs on it as well. Dropping a later round leaves a validator-clean stream, so the data assertions are what catch it. The layout assertions now check the composition rather than non-emptiness: the scan input reports two SST sources whose row counts are the two flushed write rounds and one memtable whose rows are the unflushed round. Compaction is disabled in both tests so a background merge cannot move that composition. The older test is renamed to say what it covers: two disjoint partitions, one assignment each, concatenated. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> --- src/mito2/src/engine/scan_test.rs | 369 +++++++++++++++++++++++++++++- src/mito2/src/read/series_scan.rs | 48 +++- 2 files changed, 408 insertions(+), 9 deletions(-) diff --git a/src/mito2/src/engine/scan_test.rs b/src/mito2/src/engine/scan_test.rs index 6fe07d63ecd..4a720ef73f2 100644 --- a/src/mito2/src/engine/scan_test.rs +++ b/src/mito2/src/engine/scan_test.rs @@ -5932,7 +5932,7 @@ async fn test_two_phase_raw_partition_out_of_range_keeps_scanner_usable() { } #[tokio::test] -async fn test_two_phase_raw_stream_stays_contiguous_across_assignments() { +async fn test_two_phase_raw_stream_stays_contiguous_across_disjoint_partition_assignments() { use common_query::series_frame::{pack_raw_series, unpack_raw_series}; use datatypes::series::SeriesOrdering; use datatypes::series::raw::RawSeriesChunk; @@ -5943,6 +5943,10 @@ async fn test_two_phase_raw_stream_stays_contiguous_across_assignments() { let engine = env .create_engine(MitoConfig { experimental_series_scan_v2: true, + // Automatic compaction could merge the two flushed SSTs before the scan pins its + // input and make the source-composition assertions below racy. + schedule_compaction_after_edit: false, + min_compaction_interval: Duration::from_secs(60 * 60), ..Default::default() }) .await; @@ -5963,9 +5967,11 @@ async fn test_two_phase_raw_stream_stays_contiguous_across_assignments() { .map(|(tag, tsid)| new_sparse_primary_key(&[tag, "x"], &metadata, 10, *tsid)) .collect::>(); - // Three write rounds put every series into two SST ranges plus one memtable range, and the - // large rounds make a series span more than one read batch, so one series is emitted as - // multiple chunks instead of exactly one. + // Three write rounds put every series into two SST sources (the first two rounds are flushed) + // plus one memtable source (the last round stays in memory), and the large rounds make a + // series span more than one read batch, so one series is emitted as multiple chunks instead + // of exactly one. The scan input assertions below check that composition instead of only + // checking that something was read. const LARGE: i64 = 20_000; const SMALL: i64 = 3; let rounds: [&[(usize, i64, i64)]; 3] = [ @@ -5992,6 +5998,7 @@ async fn test_two_phase_raw_stream_stays_contiguous_across_assignments() { .extend(first..first + count); } } + let mut round_rows = Vec::with_capacity(rounds.len()); for (round, spec) in rounds.iter().enumerate() { let rows = spec .iter() @@ -6003,6 +6010,7 @@ async fn test_two_phase_raw_stream_stays_contiguous_across_assignments() { }) }) .collect::>(); + round_rows.push(rows.len()); put_sparse_rows(&engine, region_id, &row_schema, rows).await; if round + 1 < rounds.len() { test_util::flush_region(&engine, region_id, None).await; @@ -6014,8 +6022,50 @@ async fn test_two_phase_raw_stream_stays_contiguous_across_assignments() { preserve_pk_dictionary_encoding: true, ..Default::default() }; - let mut scanner = engine.handle_query(region_id, request).await.unwrap(); + let selected = engine.scanner(region_id, request).await.unwrap(); + let Scanner::Series(mut scanner) = selected else { + panic!("sparse PerSeries request must use SeriesScan"); + }; + assert_eq!("two_phase", scanner.mode()); assert_eq!(SeriesOrdering::Contiguous, scanner.raw_series_ordering()); + // Composition of the pinned scan input: the two flushes pin two SST sources and the third + // write round stays in one memtable source. Each source reports the rows its write round + // wrote, so this asserts the layout instead of only asserting that something was read. + { + let input = scanner.input(); + let mut file_rows = input + .files + .iter() + .map(|file| file.num_rows()) + .collect::>(); + file_rows.sort_unstable(); + let mut expected_file_rows = round_rows[..2].to_vec(); + expected_file_rows.sort_unstable(); + assert_eq!( + expected_file_rows, file_rows, + "each flushed write round must be one SST source" + ); + assert_eq!(2, input.num_files()); + assert_eq!( + 1, + input.num_memtables(), + "the last round is one memtable range" + ); + assert_eq!( + round_rows[2], + input + .memtables + .iter() + .map(|memtable| memtable.stats().num_rows) + .sum::(), + "the unflushed round must be the memtable's contribution" + ); + assert_eq!( + round_rows.iter().sum::(), + input.total_rows(), + "the sources must add up to every written row" + ); + } let source = primary_key_label_source(&scanner.metadata()); let ranges = scanner .properties() @@ -6083,8 +6133,9 @@ async fn test_two_phase_raw_stream_stays_contiguous_across_assignments() { per_partition.push(chunks); } - // The complete raw series stream of the multi-assignment scan: every assignment's chunks in - // partition order. + // The complete raw series stream of the two-partition scan: each partition's one assignment, + // concatenated in partition order. `test_two_phase_raw_same_partition_multi_round_assignment_ + // stays_contiguous` covers two assignments handed to the same partition. let complete = per_partition .into_iter() .flatten() @@ -6136,7 +6187,7 @@ async fn test_two_phase_raw_stream_stays_contiguous_across_assignments() { if runs.last() != Some(&key) { assert!( !runs.contains(&key), - "a series' chunks must stay contiguous across assignments" + "a series' chunks must stay contiguous across the concatenated assignments" ); runs.push(key); } @@ -6176,6 +6227,308 @@ async fn test_two_phase_raw_stream_stays_contiguous_across_assignments() { } } +/// Lowers the candidate-series assignment threshold and restores it when dropped. +/// +/// The override is process-global, so it is restored from `Drop` to keep a failing assertion or a +/// panic from leaking a weakened threshold into later tests of the same binary. `cargo nextest` +/// (the documented runner for this crate) additionally runs every test in its own process. +struct AssignmentThresholdScope; + +impl AssignmentThresholdScope { + fn lower_to(threshold: usize) -> Self { + crate::read::series_scan::set_candidate_series_assignment_threshold(threshold); + Self + } +} + +impl Drop for AssignmentThresholdScope { + fn drop(&mut self) { + crate::read::series_scan::set_candidate_series_assignment_threshold(0); + } +} + +/// One partition receiving two candidate assignments must still emit one contiguous stream. +/// +/// Without the threshold override a second assignment reaches the same partition only when a +/// single collection round holds `CANDIDATE_SERIES_ASSIGNMENT_THRESHOLD` (1,000,000) candidate +/// series, so this test lowers the threshold instead of writing a million series. +#[tokio::test] +async fn test_two_phase_raw_same_partition_multi_round_assignment_stays_contiguous() { + use common_query::series_frame::{pack_raw_series, unpack_raw_series}; + use datatypes::series::SeriesOrdering; + use datatypes::series::samples::SampleRef; + use store_api::region_engine::QueryScanContext; + + // The candidate distributor starts a new assignment as soon as the collected series reach the + // threshold, and the candidate stream hands series over in globally sorted batches of at most + // `METRIC_SERIES_ID_BATCH_SIZE` (500) entries, yielding a trailing batch for the remainder. + // With the threshold lowered to 1 every one of those batches becomes one assignment round, so + // 501 series produce exactly two non-empty rounds: the first 500 sorted series, then the last + // one. Both rounds are addressed to the single output partition, i.e. to one receiver. + const CANDIDATE_BATCH: usize = 500; + const SERIES: usize = CANDIDATE_BATCH + 1; + let _scope = AssignmentThresholdScope::lower_to(1); + + let mut env = TestEnv::with_prefix("test_two_phase_raw_same_partition_multi_round").await; + let engine = env + .create_engine(MitoConfig { + experimental_series_scan_v2: true, + // The source-composition assertions below pin the flushed SST until the scan opens. + schedule_compaction_after_edit: false, + min_compaction_interval: Duration::from_secs(60 * 60), + ..Default::default() + }) + .await; + let region_id = RegionId::new(1, 1); + let (metadata, row_schema) = create_two_phase_sparse_region(&engine, region_id).await; + + let tags = (0..SERIES) + .map(|index| format!("s{index}")) + .collect::>(); + let keys = tags + .iter() + .enumerate() + .map(|(index, tag)| { + new_sparse_primary_key(&[tag.as_str(), "x"], &metadata, 10, index as u64) + }) + .collect::>(); + // The round split below relies on the candidate stream ordering series by primary key, which + // is the ascending TSID order for this fixture. + let mut sorted_keys = keys.clone(); + sorted_keys.sort(); + assert_eq!(keys, sorted_keys, "primary keys must sort in TSID order"); + + // One flushed SST source plus one memtable source. The wide series spans more than one read + // batch, so a series is emitted as several chunks and the round boundary sits next to chunks + // that must stay grouped. + const WIDE: i64 = 20_000; + const SMALL: i64 = 3; + const SECOND_ROUND_FIRST: i64 = 100_000; + let mut expected_times = HashMap::, Vec>::new(); + expected_times.insert( + keys[0].clone(), + (0..WIDE) + .chain(SECOND_ROUND_FIRST..SECOND_ROUND_FIRST + 3) + .collect(), + ); + for key in &keys[1..] { + expected_times.insert( + key.clone(), + (0..SMALL) + .chain(SECOND_ROUND_FIRST..SECOND_ROUND_FIRST + 3) + .collect(), + ); + } + + let first_round = std::iter::once((keys[0].clone(), 0_i64, WIDE)) + .chain(keys[1..].iter().map(|key| (key.clone(), 0_i64, SMALL))) + .flat_map(|(key, first, count)| { + (0..count).map(move |offset| { + let time = first + offset; + (key.clone(), time, (time + 1) as u64) + }) + }) + .collect::>(); + let second_round = keys + .iter() + .flat_map(|key| { + (0..SMALL).map(move |offset| { + let time = SECOND_ROUND_FIRST + offset; + (key.clone(), time, (time + 1) as u64) + }) + }) + .collect::>(); + let (sst_rows, memtable_rows) = (first_round.len(), second_round.len()); + put_sparse_rows(&engine, region_id, &row_schema, first_round).await; + test_util::flush_region(&engine, region_id, None).await; + put_sparse_rows(&engine, region_id, &row_schema, second_round).await; + + let request = ScanRequest { + distribution: Some(TimeSeriesDistribution::PerSeries), + preserve_pk_dictionary_encoding: true, + ..Default::default() + }; + let selected = engine.scanner(region_id, request).await.unwrap(); + let Scanner::Series(mut scanner) = selected else { + panic!("sparse PerSeries request must use SeriesScan"); + }; + assert_eq!("two_phase", scanner.mode()); + assert_eq!(SeriesOrdering::Contiguous, scanner.raw_series_ordering()); + // The fixture must really be one SST source plus one memtable source, or the two rounds below + // would be explained by something else. + { + let input = scanner.input(); + assert_eq!(1, input.num_files()); + assert_eq!( + vec![sst_rows], + input + .files + .iter() + .map(|file| file.num_rows()) + .collect::>() + ); + assert_eq!(1, input.num_memtables()); + assert_eq!( + memtable_rows, + input + .memtables + .iter() + .map(|memtable| memtable.stats().num_rows) + .sum::() + ); + } + + let source = primary_key_label_source(&scanner.metadata()); + let ranges = scanner + .properties() + .partitions + .clone() + .into_iter() + .flatten() + .collect::>(); + assert!(!ranges.is_empty(), "region scan needs an input range"); + // One output partition means every series the distributor assigns belongs to this receiver, + // so both rounds are delivered to partition 0. + scanner + .prepare(PrepareRequest { + ranges: Some(vec![ranges]), + target_partitions: Some(1), + ..Default::default() + }) + .unwrap(); + assert_eq!(1, scanner.properties().num_partitions()); + + let metrics = ExecutionPlanMetricsSet::default(); + let ctx = QueryScanContext::default(); + let stream = scanner + .scan_series_partition(&ctx, &metrics, 0, &source) + .unwrap() + .expect("two-phase raw scan is supported"); + assert_eq!(SeriesOrdering::Contiguous, stream.ordering()); + let schema = Arc::clone(stream.schema()); + let chunks = stream.try_collect::>().await.unwrap(); + // Two collection rounds really happened; the fixture never reaches the production threshold. + let rounds = crate::read::series_scan::candidate_assignment_rounds(); + assert!( + rounds >= 2, + "the partition must consume more than one assignment round, got {rounds}" + ); + assert!( + !chunks.is_empty(), + "partition 0 must own reader assignments" + ); + + // Partition 0's single stream carries every series exactly once, in ascending key order, so + // the stream crosses the round boundary: series 0..500 come from the first assignment and + // series 500 (the last of the globally sorted candidate stream) from the second one. + let mut runs = Vec::>::new(); + let mut chunks_per_series = HashMap::, usize>::new(); + for chunk in &chunks { + let key = chunk.primary_key.to_vec(); + *chunks_per_series.entry(key.clone()).or_default() += 1; + if runs.last() != Some(&key) { + assert!( + !runs.contains(&key), + "a series must not resume after another series across a round boundary" + ); + runs.push(key); + } + } + assert_eq!(keys, runs, "every series appears exactly once in key order"); + assert!( + chunks_per_series.values().copied().max().unwrap() > 1, + "the fixture must emit multiple chunks for one series, got {chunks_per_series:?}" + ); + // The round boundary: the first run belongs to the first assignment, the last run to the + // second assignment, and both are chunks of the same partition stream. + assert_eq!( + &keys[0], + runs.first().unwrap(), + "first round data is streamed" + ); + assert_eq!( + &keys[SERIES - 1], + runs.last().unwrap(), + "second round data is streamed" + ); + let last_round_chunks = chunks + .iter() + .filter(|chunk| chunk.primary_key.as_slice() == keys[SERIES - 1].as_slice()) + .count(); + assert!( + last_round_chunks > 0, + "the series of the second assignment must be streamed" + ); + + let stream_rows = chunks.iter().map(|chunk| chunk.time.len()).sum::(); + assert_eq!( + expected_times.values().map(Vec::len).sum::(), + stream_rows, + "the stream must carry every written row of both rounds" + ); + for (key, times) in &expected_times { + let observed = chunks + .iter() + .filter(|chunk| chunk.primary_key.as_slice() == key.as_slice()) + .flat_map(|chunk| chunk.time.as_buffer().iter().copied()) + .collect::>(); + assert_eq!(times, &observed, "timestamps must increase per series"); + assert!( + observed.windows(2).all(|window| window[0] < window[1]), + "timestamps must strictly increase within a key" + ); + } + for (index, chunk) in chunks.iter().enumerate() { + let next_is_same_series = chunks + .get(index + 1) + .is_some_and(|next| next.primary_key.as_slice() == chunk.primary_key.as_slice()); + assert_eq!( + !next_is_same_series, chunk.is_last, + "is_last must mark the final chunk of a series, including at the round boundary" + ); + let times = chunk.time.as_buffer(); + for (sample, time) in times.iter().enumerate() { + let SampleRef::Float(value) = chunk.fields.get(0).unwrap().sample(sample) else { + panic!("raw fields are converted to float samples"); + }; + assert_eq!((*time + 1) as f64, value); + } + } + + // Route the same partition stream through the frame codec so its `SequenceValidator` checks + // the chunks this reader produced, including the chunks the second assignment added. + let packed = pack_raw_series(Box::pin(ChainedRawSeriesStream::new( + Arc::clone(&schema), + source.clone(), + SeriesOrdering::Contiguous, + chunks.clone(), + ))) + .unwrap(); + let unpacked = unpack_raw_series( + packed, + Arc::clone(&schema), + source, + SeriesOrdering::Contiguous, + ) + .unwrap(); + let validated = unpacked.try_collect::>().await.unwrap(); + assert_eq!( + stream_rows, + validated + .iter() + .map(|chunk| chunk.time.len()) + .sum::(), + "packing and unpacking must preserve the multi-round stream" + ); + let mut schema_fields = schema + .fields + .iter() + .map(|field| field.name.as_ref()) + .collect::>(); + schema_fields.dedup(); + assert_eq!(vec!["field_0"], schema_fields); +} + /// Creates the sparse-encoded flat region shared by the two-phase raw scan tests. /// /// Returns the region metadata and the row schema accepted by the sparse write path. diff --git a/src/mito2/src/read/series_scan.rs b/src/mito2/src/read/series_scan.rs index 8b4ad2acf20..971ff93a742 100644 --- a/src/mito2/src/read/series_scan.rs +++ b/src/mito2/src/read/series_scan.rs @@ -81,6 +81,49 @@ const SEND_TIMEOUT: Duration = Duration::from_micros(100); /// Maximum number of candidate series retained before distributing assignments. const CANDIDATE_SERIES_ASSIGNMENT_THRESHOLD: usize = 1_000_000; +/// Test-only override of [`CANDIDATE_SERIES_ASSIGNMENT_THRESHOLD`], where `0` means "use the +/// production constant". +/// +/// The production build compiles this static, the setter below and the private accessor out, so +/// the shipped threshold is always the constant above. +#[cfg(test)] +static CANDIDATE_SERIES_ASSIGNMENT_THRESHOLD_OVERRIDE: AtomicUsize = AtomicUsize::new(0); + +/// Test-only number of candidate assignment rounds sent since the override was last set. +/// +/// A round is one `send_assignments` call, so a partition that received more than one assignment +/// sees `>= 2` rounds here. Increments are compiled out of production builds. +#[cfg(test)] +static CANDIDATE_ASSIGNMENT_ROUNDS: AtomicUsize = AtomicUsize::new(0); + +/// Returns the candidate-series assignment threshold, honouring the test-only override. +fn candidate_series_assignment_threshold() -> usize { + #[cfg(test)] + { + let threshold = CANDIDATE_SERIES_ASSIGNMENT_THRESHOLD_OVERRIDE.load(Ordering::Relaxed); + if threshold > 0 { + return threshold; + } + } + CANDIDATE_SERIES_ASSIGNMENT_THRESHOLD +} + +/// Test-only: overrides the candidate-series assignment threshold and resets the round counter. +/// +/// Pass `0` to restore the production threshold. Tests must reset the override before they +/// return; a scope guard in `engine::scan_test` does that even on panic. +#[cfg(test)] +pub(crate) fn set_candidate_series_assignment_threshold(threshold: usize) { + CANDIDATE_SERIES_ASSIGNMENT_THRESHOLD_OVERRIDE.store(threshold, Ordering::Relaxed); + CANDIDATE_ASSIGNMENT_ROUNDS.store(0, Ordering::Relaxed); +} + +/// Test-only: returns the number of assignment rounds sent since the override was last set. +#[cfg(test)] +pub(crate) fn candidate_assignment_rounds() -> usize { + CANDIDATE_ASSIGNMENT_ROUNDS.load(Ordering::Relaxed) +} + /// Legacy data receivers for output partitions. type LegacyReceiverList = Vec>>>; @@ -1143,7 +1186,7 @@ impl SeriesCandidateDistributor { return Ok(()); } collector.push(batch); - if collector.len() >= CANDIDATE_SERIES_ASSIGNMENT_THRESHOLD { + if collector.len() >= candidate_series_assignment_threshold() { chunked = true; self.send_assignments(collector.finish(false), &partition_pruner); if !self.should_fetch_candidates() { @@ -1167,6 +1210,9 @@ impl SeriesCandidateDistributor { assignments: Vec, partition_pruner: &Arc, ) { + // One round of candidate collection; a partition that receives two assignments sees two. + #[cfg(test)] + CANDIDATE_ASSIGNMENT_ROUNDS.fetch_add(1, Ordering::Relaxed); for (partition, assigned_series) in assignments.into_iter().enumerate() { if assigned_series.series().is_empty() { continue; From e1dba11eea857c2b1b9825753262fece81fffcfa Mon Sep 17 00:00:00 2001 From: discord9 <55937128+discord9@users.noreply.github.com> Date: Tue, 20 Oct 2026 22:46:23 +0800 Subject: [PATCH 4/5] test(mito2): check the ordering the producer declares, and drop the promql dev-dep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The three end-to-end sites unpacked every frame as `Contiguous` while the producer declared `KeyThenTime`, and `SequenceValidator` only checks key order under the ordering it is given. A producer that declared key-then-time and emitted keys out of order passed all three. Each site now reads the ordering the frame declares, asserts it is `KeyThenTime` — so a future producer that quietly downgrades its declaration fails instead of skipping the check — and unpacks under it. Reversing two series' key order in the fixture now fails the test; passing `Contiguous` for the same frames still passes, which is what the old code did. The two-phase test asserted key order for an ordering that declares only `Contiguous`: a reader that stayed contiguous and stopped sorting keys is within contract and failed the test for it. It now asserts one run per key and that the two assignments hold the first and last key, which is what `Contiguous` plus the assignment composition actually promise. `promql` leaves mito2's dev-dependencies. The storage contract needs only `pack`/`unpack_raw_series` from `common-query`, which mito2 already depends on; the cross-region merge composition moves to promql, where it is a stream-level test rather than a two-region fixture: `merges_two_unpacked_frames_through_the_frame_codec`. The merge rejection that the two-phase test used to exercise is already covered by `rejects_unsupported_ordering_and_empty_input_without_polling`, which the remaining test now cites instead of duplicating. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> --- Cargo.lock | 1 - src/mito2/Cargo.toml | 1 - src/mito2/src/engine/scan_test.rs | 637 +++++---------------------- src/promql/src/source/merge/tests.rs | 62 +++ 4 files changed, 164 insertions(+), 537 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43d65a03bd8..ea2a530d6b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8742,7 +8742,6 @@ dependencies = [ "partition", "pin-project", "prometheus 0.14.0", - "promql", "prost 0.14.1", "puffin", "rand 0.9.4", diff --git a/src/mito2/Cargo.toml b/src/mito2/Cargo.toml index 151694c40d1..02c134e964c 100644 --- a/src/mito2/Cargo.toml +++ b/src/mito2/Cargo.toml @@ -101,7 +101,6 @@ dotenv.workspace = true log-store = { workspace = true, features = ["testing"] } mito-codec = { workspace = true, features = ["testing"] } object-store = { workspace = true, features = ["services-memory"] } -promql.workspace = true rskafka.workspace = true rstest.workspace = true rstest_reuse.workspace = true diff --git a/src/mito2/src/engine/scan_test.rs b/src/mito2/src/engine/scan_test.rs index 4a720ef73f2..c0b155f7311 100644 --- a/src/mito2/src/engine/scan_test.rs +++ b/src/mito2/src/engine/scan_test.rs @@ -4772,7 +4772,6 @@ async fn test_mito_handle_query_raw_series_candidate_projection_and_mvcc() { use datatypes::series::samples::SampleRef; use datatypes::value::Value as DatumValue; use mito_codec::row_converter::build_primary_key_codec; - use promql::source::materialize_raw_labels; use store_api::region_engine::{BoundTag, QueryScanContext, RawLabelSource}; use store_api::region_request::RegionDeleteRequest; use table::predicate::Predicate; @@ -5093,7 +5092,7 @@ async fn test_mito_handle_query_raw_series_candidate_projection_and_mvcc() { assert_eq!(raw_visible, visible); // Exercise the production table physical consumer over a fresh real Mito scanner. - use common_query::series_frame::unpack_raw_series; + use common_query::series_frame::{raw_series_frame_ordering, unpack_raw_series}; use datafusion::execution::TaskContext; use datafusion::physical_plan::ExecutionPlan; use table::table::scan::RegionScanExec; @@ -5125,20 +5124,18 @@ async fn test_mito_handle_query_raw_series_candidate_projection_and_mvcc() { let native_frames = native_plan .execute(0, Arc::new(TaskContext::default())) .unwrap(); - let unpacked = unpack_raw_series( - native_frames, - native_schema, - native_source, - SeriesOrdering::Contiguous, - ) - .unwrap(); + // Unpack under the frame's own declaration. A legacy producer declares `KeyThenTime`, and + // only that declaration makes the decoder check that keys increase. + let frame_ordering = raw_series_frame_ordering(native_frames.schema().as_ref()).unwrap(); + assert_eq!( + SeriesOrdering::KeyThenTime, + frame_ordering, + "the legacy producer must declare key-then-time frames" + ); + let unpacked = + unpack_raw_series(native_frames, native_schema, native_source, frame_ordering).unwrap(); let native_schema = unpacked.schema().clone(); - let materialized = materialize_raw_labels(unpacked).unwrap(); - assert!(matches!( - materialized.label_source(), - RawLabelSource::Explicit - )); - let mut native = materialized.try_collect::>().await.unwrap(); + let mut native = unpacked.try_collect::>().await.unwrap(); assert_eq!( vec!["field_1", "field_0"], native_schema @@ -5150,18 +5147,17 @@ async fn test_mito_handle_query_raw_series_candidate_projection_and_mvcc() { let mut native_visible = native .drain(..) .flat_map(|chunk| { - let metric = chunk.metric.as_ref().expect("materialized complete metric"); - assert_eq!(Some("fixture_metric"), metric.name()); - let labels = metric - .tags() - .iter() - .map(|label| (label.name.as_ref(), label.value.as_ref())) - .collect::>(); - assert_eq!(1, labels.len()); - let tag = labels["tag_0"].to_string(); - assert!(tag == "A" || tag == "B"); - let times = chunk.time.as_buffer(); let key = chunk.primary_key.to_vec(); + // The frame binding is the raw primary key, so decode it back to the fixture tag to + // keep the raw rows comparable with the legacy path. + let tag = if key == expected_keys[0] { + "A" + } else if key == expected_keys[1] { + "B" + } else { + panic!("unexpected raw primary key {key:?}") + }; + let times = chunk.time.as_buffer(); let is_last = chunk.is_last; let mut rows = Vec::with_capacity(times.len()); for (i, time) in times.iter().enumerate() { @@ -5175,7 +5171,7 @@ async fn test_mito_handle_query_raw_series_candidate_projection_and_mvcc() { }; rows.push(( key.clone(), - tag.clone(), + tag.to_string(), *time, f1, f0, @@ -5230,478 +5226,22 @@ async fn test_mito_handle_query_raw_series_candidate_projection_and_mvcc() { ); } +/// A `TwoPhase` scan declares [`SeriesOrdering::Contiguous`] on the scanner, on every partition +/// stream, and therefore in every frame it packs; the frame adapter validates that declaration. +/// +/// The ordered merge that rejects a non-`KeyThenTime` input is covered by +/// `promql::source::merge::tests::rejects_unsupported_ordering_and_empty_input_without_polling`. #[tokio::test] -async fn test_mito_regional_raw_merge_preserves_global_key_order_and_labels() { - use api::v1::{Row, Value}; - use common_query::series_frame::{pack_raw_series, unpack_raw_series}; - use datatypes::arrow::array::Array; - use datatypes::series::SeriesOrdering; - use datatypes::series::samples::{SampleRef, SeriesSchema}; - use datatypes::value::Value as DatumValue; - use mito_codec::row_converter::build_primary_key_codec; - use promql::source::{materialize_raw_labels, merge_ordered_raw_series}; - use store_api::region_engine::{BoundTag, QueryScanContext, RawLabelSource}; - use store_api::region_request::RegionDeleteRequest; - - let mut env = TestEnv::with_prefix("test_mito_regional_raw_merge").await; - let engine = env.create_engine(MitoConfig::default()).await; - let regions = [RegionId::new(1, 1), RegionId::new(1, 2)]; - let mut request = CreateRequestBuilder::new().field_num(3).build(); - request - .options - .insert("memtable.type".into(), "bulk".into()); - let schema = test_util::rows_schema(&request); - for region in regions { - engine - .handle_request(region, RegionRequest::Create(request.clone())) - .await - .unwrap(); - } - let make_row = |tag: &str, f0: Option, f1: f64, gate: f64, time: i64| Row { - values: vec![ - Some(ValueData::StringValue(tag.into())), - f0.map(ValueData::F64Value), - Some(ValueData::F64Value(f1)), - Some(ValueData::F64Value(gate)), - Some(ValueData::TimestampMillisecondValue(time)), - ] - .into_iter() - .map(|value_data| Value { value_data }) - .collect(), +async fn test_two_phase_native_raw_stream_declares_contiguous_frames() { + use common_query::series_frame::{ + pack_raw_series, raw_series_frame_ordering, unpack_raw_series, }; - for (region, rows) in [ - ( - regions[0], - vec![ - make_row("A", Some(10.0), 1.0, 1.0, 10), - make_row("A", None, 3.0, 1.0, 30), - make_row("B", Some(-0.0), 5.0, 1.0, 10), - ], - ), - ( - regions[1], - vec![ - make_row("A", Some(20.0), 2.0, 1.0, 20), - make_row("A", Some(40.0), 4.0, 1.0, 40), - make_row("C", Some(60.0), 6.0, 1.0, 10), - ], - ), - ] { - test_util::put_rows( - &engine, - region, - Rows { - schema: schema.clone(), - rows, - }, - ) - .await; - } - test_util::flush_region(&engine, regions[0], None).await; - test_util::flush_region(&engine, regions[1], None).await; - test_util::put_rows( - &engine, - regions[0], - Rows { - schema: schema.clone(), - rows: vec![ - make_row("A", Some(11.0), 11.0, 1.0, 10), - make_row("A", Some(50.0), 5.0, 0.0, 50), - make_row("B", Some(60.0), 6.0, 1.0, 60), - ], - }, - ) - .await; - engine - .handle_request( - regions[0], - RegionRequest::Delete(RegionDeleteRequest { - rows: Rows { - schema: test_util::delete_rows_schema( - &CreateRequestBuilder::new().field_num(3).build(), - ), - rows: vec![row(vec![ - ValueData::StringValue("B".into()), - ValueData::TimestampMillisecondValue(60), - ])], - }, - hint: None, - partition_expr_version: None, - }), - ) - .await - .unwrap(); - let request = ScanRequest { - projection: Some(vec![2, 1, 4]), - filters: vec![col("field_2").gt(lit(0.0_f64))], - distribution: Some(TimeSeriesDistribution::PerSeries), - preserve_pk_dictionary_encoding: true, - ..Default::default() - }; - let mut streams = Vec::new(); - let mut metadata_for_codec = None; - let mut expected_schema: Option> = None; - let metrics = ExecutionPlanMetricsSet::default(); - for region in regions { - let selected = engine.scanner(region, request.clone()).await.unwrap(); - let mut scanner: Box = match selected { - Scanner::Series(series) => { - assert_eq!("legacy", series.mode()); - Box::new(series) - } - _ => panic!("PerSeries request must select a series scanner"), - }; - assert_eq!(SeriesOrdering::KeyThenTime, scanner.raw_series_ordering()); - let metadata = scanner.metadata(); - metadata_for_codec.get_or_insert_with(|| metadata.clone()); - let source = RawLabelSource::PrimaryKey { - metric_name: Arc::from("fixture_metric"), - physical_metadata: metadata.clone(), - logical_tags: metadata - .column_metadatas - .iter() - .filter(|column| { - column.semantic_type == SemanticType::Tag - && !store_api::storage::consts::is_internal_column( - &column.column_schema.name, - ) - && !store_api::metric_engine_consts::is_metric_engine_internal_column( - &column.column_schema.name, - ) - }) - .map(|column| BoundTag { - column_id: column.column_id, - name: Arc::from(column.column_schema.name.as_str()), - }) - .collect::>() - .into(), - }; - let ranges = scanner - .properties() - .partitions - .clone() - .into_iter() - .flatten() - .collect::>(); - assert!(!ranges.is_empty(), "region scan needs an input range"); - let partition_count = 2; - let mut partitions = vec![Vec::new(); partition_count]; - for (index, range) in ranges.into_iter().enumerate() { - partitions[index % partition_count].push(range); - } - scanner - .prepare(PrepareRequest { - ranges: Some(partitions), - target_partitions: Some(partition_count), - ..Default::default() - }) - .unwrap(); - let partition_count = scanner.properties().num_partitions(); - assert!( - partition_count > 1, - "prepare must use multiple supplied native range partitions" - ); - for partition in 0..partition_count { - let stream = scanner - .scan_series_partition(&QueryScanContext::default(), &metrics, partition, &source) - .unwrap() - .expect("native raw input"); - assert_eq!(scanner.raw_series_ordering(), stream.ordering()); - assert_eq!(SeriesOrdering::KeyThenTime, stream.ordering()); - assert_eq!( - vec!["field_1", "field_0"], - stream - .schema() - .fields - .iter() - .map(|field| field.name.as_ref()) - .collect::>() - ); - if let Some(schema) = &expected_schema { - assert_eq!( - schema - .fields - .iter() - .map(|field| field.name.as_ref()) - .collect::>(), - stream - .schema() - .fields - .iter() - .map(|field| field.name.as_ref()) - .collect::>() - ); - } else { - expected_schema = Some(Arc::clone(stream.schema())); - } - streams.push(stream); - } - // Each scanner owns the same schema and explicitly bound source. - } - let merged = merge_ordered_raw_series(streams).unwrap(); - let merged_schema = Arc::clone(merged.schema()); - let binding = merged.label_source().clone(); - let ordering = merged.ordering(); - assert_eq!(SeriesOrdering::KeyThenTime, ordering); - let packed = pack_raw_series(merged).unwrap(); - let unpacked = unpack_raw_series(packed, merged_schema, binding, ordering).unwrap(); - let mut materialized = materialize_raw_labels(unpacked).unwrap(); - let mut actual = Vec::new(); - while let Some(chunk) = materialized.try_next().await.unwrap() { - let metric = chunk.metric.as_ref().unwrap(); - assert_eq!(Some("fixture_metric"), metric.name()); - let tag = metric.get("tag_0").unwrap().to_string(); - for index in 0..chunk.time.len() { - let SampleRef::Float(f1) = chunk.fields.get(0).unwrap().sample(index) else { - panic!("field_1 float") - }; - let f0 = match chunk.fields.get(1).unwrap().sample(index) { - SampleRef::Float(value) => Some(value.to_bits()), - SampleRef::Missing => None, - _ => panic!("unexpected field_0 sample type"), - }; - actual.push(( - chunk.primary_key.to_vec(), - tag.clone(), - chunk.time.timestamp(index).unwrap(), - f1.to_bits(), - f0, - chunk.is_last && index + 1 == chunk.time.len(), - )); - } - } - assert!( - actual - .windows(2) - .all(|pair| pair[0].0 < pair[1].0 || (pair[0].0 == pair[1].0 && pair[0].2 < pair[1].2)), - "merged stream must be ordered by full read key then time" - ); - let metadata = metadata_for_codec.unwrap(); - let codec = build_primary_key_codec(&metadata); - let mut expected = Vec::new(); - for (tag, time, f1, f0) in [ - ("A", 10, 11.0_f64, Some(11.0_f64)), - ("A", 20, 2.0, Some(20.0)), - ("A", 30, 3.0, None), - ("A", 40, 4.0, Some(40.0)), - ("B", 10, 5.0, Some(-0.0_f64)), - ("C", 10, 6.0, Some(60.0)), - ] { - let mut key = Vec::new(); - codec - .encode_values( - &[(metadata.primary_key[0], DatumValue::String(tag.into()))], - &mut key, - ) - .unwrap(); - expected.push((key, tag, time, f1.to_bits(), f0.map(f64::to_bits))); - } - let duplicate_key = expected[0].0.clone(); - assert_eq!( - expected - .iter() - .map(|(key, _, _, _, _)| key.clone()) - .collect::>(), - actual.iter().map(|row| row.0.clone()).collect::>() - ); - let visible = actual - .iter() - .map(|(_, tag, time, f1, f0, _)| (tag.as_str(), *time, *f1, *f0)) - .collect::>(); - assert_eq!( - expected - .iter() - .map(|(_, tag, time, f1, f0)| (*tag, *time, *f1, *f0)) - .collect::>(), - visible - ); - let mut legacy_batches = Vec::new(); - for region in regions { - let mut legacy_request = request.clone(); - legacy_request.projection = Some(vec![0, 1, 2, 3, 4]); - legacy_request.filters.clear(); - legacy_request.preserve_pk_dictionary_encoding = false; - let legacy = engine.handle_query(region, legacy_request).await.unwrap(); - for partition in 0..legacy.properties().num_partitions() { - legacy_batches.extend( - legacy - .scan_partition(&QueryScanContext::default(), &metrics, partition) - .unwrap() - .try_collect::>() - .await - .unwrap(), - ); - } - } - let mut legacy_visible = Vec::new(); - for batch in &legacy_batches { - let batch = batch.df_record_batch(); - let tags = batch - .column_by_name("tag_0") - .unwrap() - .as_any() - .downcast_ref::() - .unwrap(); - let f0 = batch - .column_by_name("field_0") - .unwrap() - .as_any() - .downcast_ref::() - .unwrap(); - let f1 = batch - .column_by_name("field_1") - .unwrap() - .as_any() - .downcast_ref::() - .unwrap(); - let times = batch - .column_by_name("ts") - .unwrap() - .as_any() - .downcast_ref::() - .unwrap(); - let gate = batch - .column_by_name("field_2") - .unwrap() - .as_any() - .downcast_ref::() - .unwrap(); - for row in 0..batch.num_rows() { - if gate.value(row) > 0.0 { - legacy_visible.push(( - tags.value(row).to_string(), - times.value(row), - f1.value(row).to_bits(), - if f0.is_null(row) { - None - } else { - Some(f0.value(row).to_bits()) - }, - )); - } - } - } - legacy_visible.sort_by(|left, right| left.0.cmp(&right.0).then(left.1.cmp(&right.1))); - let mut raw_visible = actual - .iter() - .map(|(_, tag, time, f1, f0, _)| (tag.clone(), *time, *f1, *f0)) - .collect::>(); - raw_visible.sort_by(|left, right| left.0.cmp(&right.0).then(left.1.cmp(&right.1))); - assert_eq!( - legacy_visible, raw_visible, - "raw candidates after field_2 predicate must match legacy scan" - ); - test_util::put_rows( - &engine, - regions[1], - Rows { - schema: schema.clone(), - rows: vec![make_row("A", Some(99.0), 99.0, 1.0, 30)], - }, - ) - .await; - let mut duplicate_inputs = Vec::new(); - for region in regions { - let scanner = engine.handle_query(region, request.clone()).await.unwrap(); - let metadata = scanner.metadata(); - let source = RawLabelSource::PrimaryKey { - metric_name: Arc::from("fixture_metric"), - physical_metadata: metadata.clone(), - logical_tags: metadata - .column_metadatas - .iter() - .filter(|column| { - column.semantic_type == SemanticType::Tag - && !store_api::storage::consts::is_internal_column( - &column.column_schema.name, - ) - && !store_api::metric_engine_consts::is_metric_engine_internal_column( - &column.column_schema.name, - ) - }) - .map(|column| BoundTag { - column_id: column.column_id, - name: Arc::from(column.column_schema.name.as_str()), - }) - .collect::>() - .into(), - }; - let mut scanner = scanner; - let ranges = scanner - .properties() - .partitions - .clone() - .into_iter() - .flatten() - .collect::>(); - let partition_count = 2; - let mut partitions = vec![Vec::new(); partition_count]; - for (index, range) in ranges.into_iter().enumerate() { - partitions[index % partition_count].push(range); - } - scanner - .prepare(PrepareRequest { - ranges: Some(partitions), - target_partitions: Some(partition_count), - ..Default::default() - }) - .unwrap(); - for partition in 0..scanner.properties().num_partitions() { - duplicate_inputs.push( - scanner - .scan_series_partition( - &QueryScanContext::default(), - &metrics, - partition, - &source, - ) - .unwrap() - .unwrap(), - ); - } - } - let mut duplicate_merge = merge_ordered_raw_series(duplicate_inputs).unwrap(); - let mut affected_key_last = Vec::new(); - let duplicate_error = loop { - match duplicate_merge.try_next().await { - Ok(Some(chunk)) => { - if chunk.primary_key.as_slice() == duplicate_key.as_slice() { - affected_key_last.push(chunk.is_last); - } - } - Ok(None) => panic!("same full key/timestamp across regions must fail"), - Err(error) => break error.to_string(), - } - }; - assert!( - duplicate_error.contains("timestamp") || duplicate_error.contains("time"), - "unexpected duplicate timestamp error: {duplicate_error}" - ); - assert!(!affected_key_last.is_empty()); - assert!(affected_key_last.iter().all(|is_last| !is_last)); - assert!( - duplicate_merge.try_next().await.unwrap().is_none(), - "merge error must fuse stream" - ); - for tag in ["A", "B", "C"] { - let key_rows = actual.iter().filter(|row| row.1 == tag).collect::>(); - assert_eq!( - 1, - key_rows.iter().filter(|row| row.5).count(), - "global finality for {tag}" - ); - assert!(key_rows.last().unwrap().5); - assert!(key_rows[..key_rows.len() - 1].iter().all(|row| !row.5)); - } -} - -#[tokio::test] -async fn test_two_phase_native_raw_stream_is_rejected_by_ordered_merge() { use datatypes::series::SeriesOrdering; + use datatypes::series::samples::SeriesSchema; use store_api::region_engine::{BoundTag, QueryScanContext, RawLabelSource}; use store_api::region_request::RegionPutRequest; - let mut env = TestEnv::with_prefix("test_two_phase_native_raw_merge_rejection").await; + let mut env = TestEnv::with_prefix("test_two_phase_native_raw_contiguous_frames").await; let engine = env .create_engine(MitoConfig { experimental_series_scan_v2: true, @@ -5806,23 +5346,47 @@ async fn test_two_phase_native_raw_stream_is_rejected_by_ordered_merge() { }) .unwrap(); let metrics = ExecutionPlanMetricsSet::default(); - let mut streams = Vec::new(); + let mut schema: Option> = None; + let mut chunks = Vec::new(); for partition in 0..ranges.len() { let stream = scanner .scan_series_partition(&QueryScanContext::default(), &metrics, partition, &source) .unwrap() .unwrap(); + // The storage-side contract: every partition stream reports the scanner's declaration. assert_eq!(scanner.raw_series_ordering(), stream.ordering()); assert_eq!(SeriesOrdering::Contiguous, stream.ordering()); - streams.push(stream); + schema.get_or_insert_with(|| Arc::clone(stream.schema())); + chunks.extend(stream.try_collect::>().await.unwrap()); } - let error = match promql::source::merge_ordered_raw_series(streams) { - Ok(_) => panic!("Contiguous two-phase input cannot satisfy ordered merge ordering"), - Err(error) => error, - }; - assert!( - error.to_string().contains("ordering") || error.to_string().contains("ordered"), - "expected ordering rejection, got: {error}" + assert_eq!( + 2, + chunks.iter().map(|chunk| chunk.time.len()).sum::() + ); + + // The frames the adapter receives carry that declaration, and the adapter validates it + // through `pack`/`unpack_raw_series` without ever seeing a sorted key guarantee. + let schema = schema.expect("the scan must emit at least one partition stream"); + let packed = pack_raw_series(Box::pin(ChainedRawSeriesStream::new( + Arc::clone(&schema), + source.clone(), + SeriesOrdering::Contiguous, + chunks, + ))) + .unwrap(); + let ordering = raw_series_frame_ordering(packed.schema().as_ref()).unwrap(); + assert_eq!(SeriesOrdering::Contiguous, ordering); + let validated = unpack_raw_series(packed, schema, source, ordering) + .unwrap() + .try_collect::>() + .await + .unwrap(); + assert_eq!( + 2, + validated + .iter() + .map(|chunk| chunk.time.len()) + .sum::() ); } @@ -6418,9 +5982,10 @@ async fn test_two_phase_raw_same_partition_multi_round_assignment_stays_contiguo "partition 0 must own reader assignments" ); - // Partition 0's single stream carries every series exactly once, in ascending key order, so - // the stream crosses the round boundary: series 0..500 come from the first assignment and - // series 500 (the last of the globally sorted candidate stream) from the second one. + // Partition 0's single stream carries every series in one contiguous run each. `TwoPhase` + // declares only `Contiguous`, so the runs are not contracted to be sorted; the assignment + // composition is: the first assignment holds the first 500 candidate series (which includes + // `keys[0]`) and the trailing assignment holds the last candidate series. let mut runs = Vec::>::new(); let mut chunks_per_series = HashMap::, usize>::new(); for chunk in &chunks { @@ -6434,22 +5999,21 @@ async fn test_two_phase_raw_same_partition_multi_round_assignment_stays_contiguo runs.push(key); } } - assert_eq!(keys, runs, "every series appears exactly once in key order"); + assert_eq!(keys.len(), runs.len(), "every series appears in one run"); assert!( chunks_per_series.values().copied().max().unwrap() > 1, "the fixture must emit multiple chunks for one series, got {chunks_per_series:?}" ); // The round boundary: the first run belongs to the first assignment, the last run to the // second assignment, and both are chunks of the same partition stream. - assert_eq!( - &keys[0], - runs.first().unwrap(), - "first round data is streamed" + let (first_assignment, second_assignment) = runs.split_at(SERIES - 1); + assert!( + first_assignment.contains(&keys[0]), + "the first assignment must stream the first key" ); - assert_eq!( - &keys[SERIES - 1], - runs.last().unwrap(), - "second round data is streamed" + assert!( + second_assignment.contains(&keys[SERIES - 1]), + "the second assignment must stream the last key" ); let last_round_chunks = chunks .iter() @@ -6794,7 +6358,7 @@ async fn test_mito_raw_series_int64_predicate_uses_original_precision() { assert_eq!(vec![(2, 20.0)], output_values); // Validate the typed integer gate through RegionScanExec's actual physical consumer. - use common_query::series_frame::unpack_raw_series; + use common_query::series_frame::{raw_series_frame_ordering, unpack_raw_series}; use datafusion::execution::TaskContext; use datafusion::physical_plan::ExecutionPlan; use datatypes::series::SeriesOrdering; @@ -6830,16 +6394,18 @@ async fn test_mito_raw_series_int64_predicate_uses_original_precision() { let frames = native_plan .execute(0, Arc::new(TaskContext::default())) .unwrap(); - let chunks = unpack_raw_series( - frames, - native_schema, - native_source, - SeriesOrdering::Contiguous, - ) - .unwrap() - .try_collect::>() - .await - .unwrap(); + // Unpack under the frame's own declaration so the decoder checks the legacy key order. + let ordering = raw_series_frame_ordering(frames.schema().as_ref()).unwrap(); + assert_eq!( + SeriesOrdering::KeyThenTime, + ordering, + "the legacy producer must declare key-then-time frames" + ); + let chunks = unpack_raw_series(frames, native_schema, native_source, ordering) + .unwrap() + .try_collect::>() + .await + .unwrap(); let native_rows = chunks .iter() .flat_map(|chunk| { @@ -6887,16 +6453,17 @@ async fn test_mito_raw_series_int64_predicate_uses_original_precision() { let empty_frames = empty_plan .execute(0, Arc::new(TaskContext::default())) .unwrap(); - let empty_chunks = unpack_raw_series( - empty_frames, - empty_schema, - empty_source, - SeriesOrdering::Contiguous, - ) - .unwrap() - .try_collect::>() - .await - .unwrap(); + let empty_ordering = raw_series_frame_ordering(empty_frames.schema().as_ref()).unwrap(); + assert_eq!( + SeriesOrdering::KeyThenTime, + empty_ordering, + "a statically empty legacy scan still declares key-then-time frames" + ); + let empty_chunks = unpack_raw_series(empty_frames, empty_schema, empty_source, empty_ordering) + .unwrap() + .try_collect::>() + .await + .unwrap(); assert!(empty_chunks.is_empty()); } diff --git a/src/promql/src/source/merge/tests.rs b/src/promql/src/source/merge/tests.rs index 4ad5d17cbb7..853da99e823 100644 --- a/src/promql/src/source/merge/tests.rs +++ b/src/promql/src/source/merge/tests.rs @@ -23,6 +23,7 @@ use std::task::{Context, Poll, Waker}; use api::v1::SemanticType; use common_error::ext::{BoxedError, ErrorExt, PlainError}; use common_error::status_code::StatusCode; +use common_query::series_frame::{pack_raw_series, raw_series_frame_ordering, unpack_raw_series}; use datatypes::arrow::array::Float64Array; use datatypes::arrow::buffer::{Buffer, ScalarBuffer}; use datatypes::data_type::ConcreteDataType; @@ -431,6 +432,67 @@ async fn merges_full_encoded_keys_and_interleaved_chunks_with_global_finality() assert!(series[2].3.last().unwrap()); } +/// Two inputs that each went through the frame codec merge like plain streams: unpacking keeps +/// the declared ordering, and the merge restores global key order and per-key finality across +/// the unpacked frames. +#[tokio::test] +async fn merges_two_unpacked_frames_through_the_frame_codec() { + let rack_a_sensor_1 = read_key("rack-a", "sensor-1"); + let rack_b_sensor_1 = read_key("rack-b", "sensor-1"); + let framed = |labels: RawLabelSource, chunks: Vec| { + let (stream, _, _) = stream( + labels, + SeriesOrdering::KeyThenTime, + chunks.into_iter().map(ready), + ); + let schema = Arc::clone(stream.schema()); + let binding = stream.label_source().clone(); + let packed = pack_raw_series(stream).unwrap(); + let ordering = raw_series_frame_ordering(packed.schema().as_ref()).unwrap(); + assert_eq!(SeriesOrdering::KeyThenTime, ordering); + unpack_raw_series(packed, schema, binding, ordering).unwrap() + }; + let left = framed( + label_source(1), + vec![ + chunk(rack_a_sensor_1.clone(), &[10, 30], &[1.0, 3.0], true), + chunk(rack_b_sensor_1.clone(), &[5], &[5.0], true), + ], + ); + let right = framed( + label_source(2), + vec![chunk(rack_a_sensor_1.clone(), &[20, 40], &[2.0, 4.0], true)], + ); + + let mut merged = merge_ordered_raw_series(vec![left, right]).unwrap(); + assert_eq!(SeriesOrdering::KeyThenTime, merged.ordering()); + let mut series = Vec::<(Buffer, Vec, Vec)>::new(); + while let Some(item) = merged.next().await { + let item = item.unwrap(); + if series + .last() + .is_none_or(|current| current.0 != item.primary_key) + { + series.push((item.primary_key.clone(), Vec::new(), Vec::new())); + } + let current = series.last_mut().unwrap(); + current.1.extend(item.time.as_buffer().to_vec()); + current.2.push(item.is_last); + } + assert_eq!(2, series.len()); + assert_eq!(rack_a_sensor_1, series[0].0); + assert_eq!(vec![10, 20, 30, 40], series[0].1); + assert!(*series[0].2.last().unwrap()); + assert!( + series[0].2[..series[0].2.len() - 1] + .iter() + .all(|last| !last) + ); + assert_eq!(rack_b_sensor_1, series[1].0); + assert_eq!(vec![5], series[1].1); + assert!(*series[1].2.last().unwrap()); +} + #[tokio::test] async fn rejects_equal_timestamp_from_separate_heads() { let key = read_key("rack-a", "sensor-1"); From 420255ed3950a0a0801ec8551816582e9c00af54 Mon Sep 17 00:00:00 2001 From: dennis zhuang Date: Wed, 21 Oct 2026 11:21:36 +0800 Subject: [PATCH 5/5] feat(promql): add limitk, limit_ratio and binary fill modifiers to native kernels (#9805) Signed-off-by: Dennis Zhuang --- Cargo.lock | 1 + Cargo.toml | 1 + src/promql/Cargo.toml | 1 + src/promql/src/grid_series.rs | 11 + src/promql/src/native/display.rs | 20 +- src/promql/src/native/display/tests.rs | 20 +- src/promql/src/native/metrics.rs | 1 + src/promql/src/native/plan/tests.rs | 3 +- src/promql/src/select.rs | 180 +- src/promql/src/select/limit_cases.txt | 1372 +++++++++++++ src/promql/src/select/tests.rs | 204 +- src/promql/src/vector_match.rs | 246 ++- src/promql/src/vector_match/fill_cases.txt | 2021 ++++++++++++++++++++ src/promql/src/vector_match/tests.rs | 100 +- 14 files changed, 4052 insertions(+), 129 deletions(-) create mode 100644 src/promql/src/select/limit_cases.txt create mode 100644 src/promql/src/vector_match/fill_cases.txt diff --git a/Cargo.lock b/Cargo.lock index ea2a530d6b5..a42a20af081 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11377,6 +11377,7 @@ dependencies = [ "snafu 0.8.6", "store-api", "tokio", + "twox-hash", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 702498ee5e5..c870b88c0b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -278,6 +278,7 @@ tracing = "0.1" tracing-appender = "0.2" tracing-opentelemetry = "0.33.0" tracing-subscriber = { version = "0.3", features = ["env-filter", "json", "fmt"] } +twox-hash = { version = "2.1", default-features = false, features = ["xxhash64"] } typetag = "0.2" uddsketch-rs = "0.1.0" uuid = { version = "1.17", features = ["serde", "v4", "v7", "fast-rng"] } diff --git a/src/promql/Cargo.toml b/src/promql/Cargo.toml index ad682f4b2a2..a3d8f5c4e71 100644 --- a/src/promql/Cargo.toml +++ b/src/promql/Cargo.toml @@ -28,6 +28,7 @@ prost.workspace = true regex.workspace = true snafu.workspace = true store-api.workspace = true +twox-hash.workspace = true [dev-dependencies] api.workspace = true diff --git a/src/promql/src/grid_series.rs b/src/promql/src/grid_series.rs index b5634b259e9..ce24cae6af4 100644 --- a/src/promql/src/grid_series.rs +++ b/src/promql/src/grid_series.rs @@ -88,6 +88,17 @@ pub(crate) enum GridSample { const _: () = assert!(std::mem::size_of::>() == 16); +/// `sample` as an owned value; `None` when missing. +pub(crate) fn owned(sample: SampleRef<'_>) -> Result> { + Ok(match sample { + SampleRef::Missing => None, + SampleRef::Float(value) => Some(GridSample::Float(value)), + SampleRef::Histogram(view) => Some(GridSample::Histogram(Box::new( + FloatHistogram::try_from_view(&view)?, + ))), + }) +} + impl GridSeriesBuilder { /// Creates a builder for series of `schema`, which must have an evaluation grid. pub fn try_new(schema: Arc) -> Result { diff --git a/src/promql/src/native/display.rs b/src/promql/src/native/display.rs index 7e0e82c2b5e..86d40946cc1 100644 --- a/src/promql/src/native/display.rs +++ b/src/promql/src/native/display.rs @@ -32,7 +32,7 @@ use crate::native::plan::{ NativeType, }; use crate::range_eval::RangeFunction; -use crate::vector_match::{BinaryOp, Cardinality, MatchingLabels}; +use crate::vector_match::{BinaryOp, Cardinality, FillValues, MatchingLabels}; /// The header line of every tree. const HEADER: &str = "NativeTree"; @@ -121,7 +121,7 @@ fn describe(node: &NativeNode) -> String { } ), NativeExpr::Binary { matching, .. } => format!( - "{}{} {} {}", + "{}{} {} {}{}", binary_op(matching.op), if matching.return_bool { " bool" } else { "" }, match &matching.labels { @@ -132,11 +132,25 @@ fn describe(node: &NativeNode) -> String { Cardinality::OneToOne => "one-to-one".to_string(), Cardinality::ManyToOne(labels) => format!("many-to-one [{}]", label_list(labels)), Cardinality::OneToMany(labels) => format!("one-to-many [{}]", label_list(labels)), - } + }, + fill(matching.fill) ), } } +fn fill(values: FillValues) -> String { + let side = |name: &str, value: Option| { + value + .map(|value| format!(" {name} {value}")) + .unwrap_or_default() + }; + format!( + "{}{}", + side("fill_left", values.lhs), + side("fill_right", values.rhs) + ) +} + /// A window: what it runs, over which range, and where it lands. fn window(op: &BoundWindow) -> String { format!( diff --git a/src/promql/src/native/display/tests.rs b/src/promql/src/native/display/tests.rs index 8166bad3c98..316f6a39a4e 100644 --- a/src/promql/src/native/display/tests.rs +++ b/src/promql/src/native/display/tests.rs @@ -24,7 +24,7 @@ use super::super::plan::{ }; use crate::map::MathOp; use crate::range_eval::{RangeFunction, RangeWindow}; -use crate::vector_match::{BinaryMatching, BinaryOp, Cardinality, MatchingLabels}; +use crate::vector_match::{BinaryMatching, BinaryOp, Cardinality, FillValues, MatchingLabels}; fn grid(start: i64, step: i64, len: u64) -> Arc { Arc::new(EvalGrid::try_new(GridSpec::try_new(start, step, len).unwrap()).unwrap()) @@ -324,11 +324,12 @@ fn an_aggregate_and_a_binary_name_their_binding() { return_bool: false, labels: MatchingLabels::Ignoring(Vec::new()), cardinality: Cardinality::OneToOne, + fill: FillValues::default(), }, }, output: evaluated(out), }; - let tree = NativeTree::try_new(binary).unwrap(); + let tree = NativeTree::try_new(binary.clone()).unwrap(); assert_eq!( tree.to_string(), shown(&[ @@ -339,6 +340,21 @@ fn an_aggregate_and_a_binary_name_their_binding() { " input Input raw samples", ]) ); + + // Fill values change the result, so a set one is part of the binding shown. + let mut filled = binary; + let NativeExpr::Binary { matching, .. } = &mut filled.expr else { + unreachable!() + }; + matching.fill.rhs = Some(0.5); + assert_eq!( + NativeTree::try_new(filled) + .unwrap() + .to_string() + .lines() + .nth(1), + Some(" root Binary + ignoring [] one-to-one fill_right 0.5") + ); } /// A `without` grouping reads as `without [...]`, not as `by [...]`. diff --git a/src/promql/src/native/metrics.rs b/src/promql/src/native/metrics.rs index bcae9ddcdd0..6e36153fe2e 100644 --- a/src/promql/src/native/metrics.rs +++ b/src/promql/src/native/metrics.rs @@ -452,6 +452,7 @@ mod tests { return_bool: false, labels: crate::vector_match::MatchingLabels::Ignoring(Vec::new()), cardinality: crate::vector_match::Cardinality::OneToOne, + fill: crate::vector_match::FillValues::default(), }, }, output: { diff --git a/src/promql/src/native/plan/tests.rs b/src/promql/src/native/plan/tests.rs index 85be7426a58..1c42c3b32af 100644 --- a/src/promql/src/native/plan/tests.rs +++ b/src/promql/src/native/plan/tests.rs @@ -24,7 +24,7 @@ use super::{ }; use crate::map::MathOp; use crate::range_eval::{RangeFunction, RangeWindow}; -use crate::vector_match::{BinaryMatching, BinaryOp, Cardinality, MatchingLabels}; +use crate::vector_match::{BinaryMatching, BinaryOp, Cardinality, FillValues, MatchingLabels}; fn grid(start: i64, step: i64, len: u64) -> Arc { Arc::new(EvalGrid::try_new(GridSpec::try_new(start, step, len).unwrap()).unwrap()) @@ -218,6 +218,7 @@ fn add() -> BinaryMatching { return_bool: false, labels: MatchingLabels::Ignoring(Vec::new()), cardinality: Cardinality::OneToOne, + fill: FillValues::default(), } } diff --git a/src/promql/src/select.rs b/src/promql/src/select.rs index cc869b91a93..c65a7955c36 100644 --- a/src/promql/src/select.rs +++ b/src/promql/src/select.rs @@ -13,9 +13,9 @@ // limitations under the License. //! Operators that depend on the whole set of evaluated series at each grid point: `topk`, -//! `bottomk`, `scalar`, `absent` and the instant-result sorts. +//! `bottomk`, `limitk`, `limit_ratio`, `scalar`, `absent` and the instant-result sorts. //! -//! Semantics follow Prometheus (`aggregationK`, `funcScalar`, `funcAbsent`, +//! Semantics follow Prometheus (`aggregationK`, `HashRatioSampler`, `funcScalar`, `funcAbsent`, //! `createLabelsForAbsentFunction`, `funcSort*`). A scalar is a grid series without labels that //! has a value at every point, so `vector(s)` is `s` itself and has no kernel. @@ -29,7 +29,7 @@ use datatypes::series::time::union_positions; use datatypes::series::{Label, MetricName}; use crate::go_sort; -use crate::grid_series::{GridSeriesBuilder, external}; +use crate::grid_series::{GridSeriesBuilder, external, owned}; #[cfg(test)] mod tests; @@ -73,22 +73,9 @@ pub fn topk( // Validates the series against the schema and its grid; the walk below visits the carried // positions, not the whole grid. grid_points(schema, series)?; - // Prometheus returns nothing for k below 1, rejects NaN and values out of int64, then - // truncates k and caps it at the number of input series. - if k < 1.0 { + let Some(k) = k_param(k, series.len())? else { return Ok(Vec::new()); - } - if k.is_nan() { - return Err(DataFusionError::Execution("Parameter value is NaN".into())); - } - // Prometheus' `maxInt64`, the largest float64 below 2^63. - if k >= 9_223_372_036_854_774_784.0 { - return Err(DataFusionError::Execution(format!( - "Scalar value {k} overflows int64" - ))); - } - let k = k.trunc().min(series.len() as f64) as usize; - + }; let mut order: Vec = (0..series.len()).collect(); order.sort_by(|&a, &b| compare_labels(&series[a].metric, &series[b].metric)); let mut groups: HashMap> = HashMap::new(); @@ -149,6 +136,144 @@ pub fn topk( Ok(result) } +/// `limitk(k, ...)` with a constant `k`. +/// +/// At every point each group keeps the first `k` series in input order that hold a sample there, +/// float or histogram, with their labels and values. Prometheus takes them in the order its +/// storage returns series: label order once a query reads several queriers (the head and a +/// block), creation order when the TSDB head alone answers it. A caller that wants Prometheus' +/// result over persisted data passes the series in label order. +pub fn limitk( + k: f64, + grouping: &Grouping, + schema: &SeriesSchema, + series: &[Series], +) -> Result> { + single_field(schema, "limitk")?; + grid_points(schema, series)?; + let Some(k) = k_param(k, series.len())? else { + return Ok(Vec::new()); + }; + let mut groups: HashMap> = HashMap::new(); + for (index, item) in series.iter().enumerate() { + groups + .entry(group_key(&item.metric, grouping)) + .or_default() + .push(index); + } + let mut selected: Vec> = vec![Vec::new(); series.len()]; + for members in groups.values() { + let mut cursors: Vec> = members + .iter() + .map(|&member| series[member].fields.as_slice()[0].cursor()) + .collect(); + for point in union_positions(members.iter().map(|&member| &series[member].time)) { + let mut taken = 0; + for (slot, &member) in members.iter().enumerate() { + if taken == k { + break; + } + let Some(row) = series[member].time.row_of(point) else { + continue; + }; + if !matches!( + cursors[slot] + .at(row) + .expect("the axis and the fields are aligned"), + SampleRef::Missing + ) { + selected[member].push((point, row)); + taken += 1; + } + } + } + } + + let mut builder = GridSeriesBuilder::try_new(Arc::new(schema.clone()))?; + let mut result = Vec::new(); + for (index, points) in selected.into_iter().enumerate() { + if points.is_empty() { + continue; + } + builder.begin_series(); + // A series belongs to one group, whose points are visited in order. + let mut cursor = series[index].fields.as_slice()[0].cursor(); + for (point, row) in points { + let sample = cursor.at(row).expect("the axis and the fields are aligned"); + builder.push_samples(point, &[owned(sample)?])?; + } + result.extend(builder.finish(series[index].metric.clone())?); + } + Ok(result) +} + +/// `limit_ratio(r, ...)` with a constant `r`. +/// +/// Keeps whole series: Prometheus derives an offset in `[0, 1)` from the hash of a series' labels +/// and keeps the series when the offset is below `r`, or, for a negative `r`, at least `1 + r`. +/// Which series are kept does not depend on the grouping, so it is not a parameter. The hash is +/// the one of Prometheus' default `stringlabels` build; the other label builds hash differently. +pub fn limit_ratio(ratio: f64, schema: &SeriesSchema, series: &[Series]) -> Result> { + grid_points(schema, series)?; + if ratio.is_nan() { + return Err(DataFusionError::Execution("Ratio value is NaN".into())); + } + let ratio = ratio.clamp(-1.0, 1.0); + let mut builder = GridSeriesBuilder::try_new(Arc::new(schema.clone()))?; + let mut result = Vec::new(); + let mut row = Vec::with_capacity(schema.fields.len()); + for item in series { + let offset = sample_offset(&item.metric); + let kept = if ratio >= 0.0 { + offset < ratio + } else { + offset >= 1.0 + ratio + }; + if !kept { + continue; + } + // Rebuilt rather than cloned: an input may carry rows without a value, a result may not. + builder.begin_series(); + let mut cursors: Vec> = + item.fields.iter().map(|field| field.cursor()).collect(); + for (point, index) in item.time.positions() { + row.clear(); + for cursor in &mut cursors { + row.push(owned( + cursor + .at(index) + .expect("the axis and the fields are aligned"), + )?); + } + builder.push_samples(point, &row)?; + } + result.extend(builder.finish(item.metric.clone())?); + } + Ok(result) +} + +/// Prometheus `HashRatioSampler.SampleOffset`: the xxHash64 of the labels as `stringlabels` +/// encodes them, each name and value prefixed by its length, over `u64::MAX`. +fn sample_offset(metric: &MetricName) -> f64 { + let mut data = Vec::new(); + for (name, value) in labels_with_name(metric) { + // Prometheus label sets hold no empty value. + if value.is_empty() { + continue; + } + for text in [&name, &value] { + let len = text.len(); + if len < 255 { + data.push(len as u8); + } else { + data.extend([255, len as u8, (len >> 8) as u8, (len >> 16) as u8]); + } + data.extend_from_slice(text.as_bytes()); + } + } + twox_hash::XxHash64::oneshot(0, &data) as f64 / u64::MAX as f64 +} + /// `scalar(v)`: the value of the only series present at each point, NaN otherwise. pub fn scalar(schema: &SeriesSchema, series: &[Series]) -> Result { single_field(schema, "scalar")?; @@ -361,6 +486,25 @@ fn rank(a: f64, b: f64, top: bool) -> Ordering { } } +/// The `k` of `topk`, `bottomk` and `limitk` as Prometheus reads it: nothing for `k` below 1, an +/// error for NaN or a value out of int64, otherwise `k` truncated and capped at the number of +/// input series. +fn k_param(k: f64, series: usize) -> Result> { + if k < 1.0 { + return Ok(None); + } + if k.is_nan() { + return Err(DataFusionError::Execution("Parameter value is NaN".into())); + } + // Prometheus' `maxInt64`, the largest float64 below 2^63. + if k >= 9_223_372_036_854_774_784.0 { + return Err(DataFusionError::Execution(format!( + "Scalar value {k} overflows int64" + ))); + } + Ok(Some(k.trunc().min(series as f64) as usize)) +} + /// Label pairs identifying a group; empty values are absent, as in Prometheus. type GroupKey = Vec<(Arc, Arc)>; diff --git a/src/promql/src/select/limit_cases.txt b/src/promql/src/select/limit_cases.txt new file mode 100644 index 00000000000..a9ab4a27208 --- /dev/null +++ b/src/promql/src/select/limit_cases.txt @@ -0,0 +1,1372 @@ +# Generated by promql-compat cmd/narthex-golden-vector built for amd64 (Prometheus v3.15.0 +# engine, seed 1, 120 cases per kind, -experimental limit). Each case lists its operation, the grid, the +# input series and either the result series or the error. Points are `grid index:hex bits`. +case limit limit_ratio NaN by __name__,host,job,zone +grid 100000 10000 6 +series __name__=a,host=h2,job=y ; 1:7ff8000000000001 +series __name__=a,host=h1,job=y,zone=z1 ; 5:c079dc0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 1:4078980000000000 2:406ad00000000000 3:c08b8e0000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 4:c0795c0000000000 5:7ff8000000000001 +error Ratio value is NaN +end +case limit limit_ratio 0.9 by __name__,job,zone +grid 100000 10000 1 +series __name__=a,host=h1,job=y ; 0:408ab00000000000 +series __name__=a,host=h2,job=x ; +series __name__=a,host=h2,job=y ; 0:4072120000000000 +series __name__=a,host=h1,job=x ; +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=b,host=h1,job=y ; 0:c08d650000000000 +result __name__=a,host=h1,job=y ; 0:408ab00000000000 +result __name__=a,host=h2,job=y ; 0:4072120000000000 +result __name__=b,host=h1,job=y ; 0:c08d650000000000 +end +case limit limit_ratio -0.5 without __name__,host +grid 100000 10000 6 +series __name__=a,host=h2,job=y,zone=z1 ; 4:407fa60000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 5:fff0000000000000 +series __name__=a,host=h2,job=x ; 1:c0888a0000000000 3:407dfa0000000000 4:c089040000000000 5:c085460000000000 +series __name__=a,host=h1,job=x ; 0:4073480000000000 1:7e37e43c8800759c +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=b,host=h2,job=y ; 2:407ad60000000000 +series __name__=b,host=h1,job=x ; 0:c068f40000000000 1:bff4000000000000 3:c0740c0000000000 4:403a200000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 3:7ff8000000000001 4:c08e530000000000 5:4072a60000000000 +result __name__=a,host=h2,job=x ; 1:c0888a0000000000 3:407dfa0000000000 4:c089040000000000 5:c085460000000000 +result __name__=b,host=h2,job=y ; 2:407ad60000000000 +end +case limit limit_ratio 0 by job,zone +grid 100000 10000 12 +series __name__=a,host=h2,job=x ; 1:c0631c0000000000 3:c08c910000000000 4:fff0000000000000 5:c077260000000000 6:c088fd0000000000 7:c07db40000000000 8:c0729c0000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 4:c072a80000000000 5:4075700000000000 6:40833f0000000000 7:408c540000000000 8:4084b40000000000 9:c07c500000000000 +series __name__=a,host=h2,job=y ; 1:4051e80000000000 2:4063a40000000000 4:7ff0000000000000 6:c066a40000000000 9:c0886b0000000000 +series __name__=b,host=h2,job=y,zone=z2 ; 6:407f680000000000 7:c08e6b0000000000 8:c08c900000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 10:407b8a0000000000 +series __name__=b,host=h2,job=y ; 0:406e800000000000 1:408bc00000000000 2:4052800000000000 4:4012000000000000 5:407e820000000000 +series __name__=b,host=h2,job=x ; +end +case limit limitk 0 without host +grid 100000 10000 9 +series __name__=a,host=h1,job=y,zone=z1 ; 5:c06a840000000000 6:fff0000000000000 7:7ff8000000000001 8:c074900000000000 +series __name__=a,host=h1,job=x ; 2:c08dde0000000000 3:c080f70000000000 5:c05b700000000000 7:7ff8000000000001 8:4080a70000000000 +series __name__=a,host=h2,job=y ; 5:c085a80000000000 8:c0616c0000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 2:c087ad0000000000 3:c088cb0000000000 4:7e37e43c8800759c 5:c0893a0000000000 +series __name__=b,host=h1,job=x ; 6:c07bb20000000000 +end +case limit limit_ratio 1.5 by __name__,host,zone +grid 100000 10000 1 +series __name__=a,host=h2,job=y,zone=z1 ; 0:408db20000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:7ff8000000000001 +series __name__=a,host=h1,job=x ; 0:c089610000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:fff0000000000000 +series __name__=b,host=h2,job=y ; +series __name__=b,host=h2,job=y,zone=z1 ; 0:c052300000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 0:c075de0000000000 +result __name__=a,host=h1,job=x ; 0:c089610000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 0:7ff8000000000001 +result __name__=a,host=h2,job=y,zone=z1 ; 0:408db20000000000 +result __name__=b,host=h1,job=x,zone=z2 ; 0:c075de0000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 0:fff0000000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 0:c052300000000000 +end +case limit limitk -1 without __name__,host,job,zone +grid 100000 10000 10 +series __name__=a,host=h2,job=y,zone=z1 ; 0:c07e160000000000 2:c085d60000000000 3:406b840000000000 4:7ff0000000000000 5:c085140000000000 +series __name__=a,host=h2,job=x ; 9:4089a80000000000 +series __name__=a,host=h1,job=y ; 5:408dda0000000000 +series __name__=a,host=h1,job=x ; 3:c0872d0000000000 4:4083600000000000 +series __name__=b,host=h2,job=y ; 7:4054500000000000 +series __name__=b,host=h1,job=y ; 7:4072080000000000 8:4073880000000000 +end +case limit limitk 0 without host +grid 100000 10000 7 +series __name__=a,host=h1,job=x ; 3:c07b340000000000 4:406ba00000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 4:4056f00000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 4:c08ac20000000000 +series __name__=a,host=h1,job=y ; 6:c050300000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 1:c047100000000000 2:c07cee0000000000 4:c08aab0000000000 5:c08cab0000000000 +series __name__=b,host=h1,job=y ; 0:c081500000000000 1:c080240000000000 2:c07ee00000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 5:fff0000000000000 6:c0878c0000000000 +end +case limit limitk 0 none - +grid 100000 10000 5 +series __name__=a,host=h1,job=y ; 0:c075a00000000000 +series __name__=b,host=h1,job=y ; 2:4077a00000000000 +end +case limit limitk 1 by job +grid 100000 10000 3 +series __name__=a,host=h2,job=y ; 0:402ac00000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 2:408f390000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 1:408c220000000000 +series __name__=a,host=h1,job=y ; +series __name__=a,host=h2,job=x ; 1:c069080000000000 2:4071920000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:4072a60000000000 1:408eae0000000000 2:c089030000000000 +series __name__=b,host=h2,job=x ; 2:407d1a0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 1:4080690000000000 2:408bb80000000000 +series __name__=b,host=h1,job=y ; 1:c08f1e0000000000 2:c086590000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 0:7ff0000000000000 1:4081dd0000000000 +series __name__=b,host=h2,job=x,zone=z2 ; 0:408ece0000000000 1:4056880000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 2:408f390000000000 +result __name__=a,host=h2,job=x ; 2:4071920000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 1:408c220000000000 +result __name__=a,host=h2,job=y ; 0:402ac00000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 1:408eae0000000000 +result __name__=b,host=h2,job=x,zone=z2 ; 0:408ece0000000000 +end +case limit limit_ratio 0.5 none - +grid 100000 10000 7 +series __name__=a,host=h2,job=y ; +series __name__=a,host=h2,job=y,zone=z1 ; 0:408d360000000000 1:4089930000000000 2:c083d70000000000 3:4078200000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 6:c08df90000000000 +series __name__=b,host=h2,job=y ; 5:4084890000000000 6:c08cc40000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 0:408d360000000000 1:4089930000000000 2:c083d70000000000 3:4078200000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 6:c08df90000000000 +end +case limit limitk 1.5 by host,job +grid 100000 10000 1 +series __name__=a,host=h1,job=x ; 0:4081210000000000 +series __name__=a,host=h2,job=x ; 0:4081dd0000000000 +series __name__=b,host=h2,job=x ; +series __name__=b,host=h1,job=y ; +series __name__=b,host=h1,job=x ; 0:c083b90000000000 +result __name__=a,host=h1,job=x ; 0:4081210000000000 +result __name__=a,host=h2,job=x ; 0:4081dd0000000000 +end +case limit limitk 1.5 without __name__,zone +grid 100000 10000 8 +series __name__=a,host=h1,job=x ; 6:4081d10000000000 +series __name__=a,host=h2,job=y ; +series __name__=a,host=h2,job=x,zone=z1 ; 4:40793e0000000000 6:4087570000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:c065fc0000000000 +series __name__=b,host=h1,job=x ; 6:40846d0000000000 7:7ff8000000000001 +series __name__=b,host=h1,job=x,zone=z1 ; +result __name__=a,host=h1,job=x ; 6:4081d10000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 4:40793e0000000000 6:4087570000000000 +result __name__=b,host=h1,job=x ; 7:7ff8000000000001 +result __name__=b,host=h2,job=x,zone=z1 ; 0:c065fc0000000000 +end +case limit limit_ratio 0.9 none - +grid 100000 10000 11 +series __name__=a,host=h2,job=y ; 10:4073de0000000000 +series __name__=b,host=h2,job=y ; 7:406cc40000000000 +series __name__=b,host=h1,job=x ; 7:c06f500000000000 8:c08c310000000000 +result __name__=a,host=h2,job=y ; 10:4073de0000000000 +result __name__=b,host=h1,job=x ; 7:c06f500000000000 8:c08c310000000000 +result __name__=b,host=h2,job=y ; 7:406cc40000000000 +end +case limit limit_ratio 1 without zone +grid 100000 10000 2 +series __name__=a,host=h2,job=y ; 0:7e37e43c8800759c +series __name__=a,host=h1,job=y ; +series __name__=a,host=h2,job=x ; 1:407e2a0000000000 +series __name__=b,host=h2,job=x ; 0:7ff0000000000000 1:408da70000000000 +series __name__=b,host=h1,job=y ; 0:c088c60000000000 +series __name__=b,host=h2,job=y ; 1:4081880000000000 +result __name__=a,host=h2,job=x ; 1:407e2a0000000000 +result __name__=a,host=h2,job=y ; 0:7e37e43c8800759c +result __name__=b,host=h1,job=y ; 0:c088c60000000000 +result __name__=b,host=h2,job=x ; 0:7ff0000000000000 1:408da70000000000 +result __name__=b,host=h2,job=y ; 1:4081880000000000 +end +case limit limitk 0 without host,job,zone +grid 100000 10000 10 +series __name__=a,host=h2,job=x,zone=z1 ; 4:c087520000000000 5:4064540000000000 6:40879c0000000000 7:0 8:4082580000000000 +series __name__=a,host=h1,job=y ; 8:c088640000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 0:c052f80000000000 1:c0709c0000000000 3:c08e060000000000 4:4079680000000000 5:c061200000000000 6:c077520000000000 7:40822a0000000000 9:4079ea0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:c071ec0000000000 +series __name__=b,host=h2,job=x ; 0:c08de50000000000 1:c08d6e0000000000 3:c08d530000000000 +end +case limit limit_ratio -0.5 by host +grid 100000 10000 12 +series __name__=a,host=h1,job=y ; 3:7ff8000000000001 4:c089990000000000 6:c066800000000000 +series __name__=a,host=h2,job=y ; 1:7ff0000000000000 3:407d4e0000000000 4:c07cfa0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 6:c086c20000000000 +series __name__=a,host=h1,job=x ; 8:4081ca0000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 4:4085720000000000 5:c08a4a0000000000 +result __name__=a,host=h1,job=y ; 3:7ff8000000000001 4:c089990000000000 6:c066800000000000 +result __name__=a,host=h2,job=y ; 1:7ff0000000000000 3:407d4e0000000000 4:c07cfa0000000000 +end +case limit limitk -1 none - +grid 100000 10000 9 +series __name__=a,host=h1,job=x,zone=z1 ; 1:4089b40000000000 2:c07a7c0000000000 4:c041400000000000 5:4086be0000000000 7:4084730000000000 8:c06be80000000000 +series __name__=a,host=h1,job=y ; 0:0 +series __name__=b,host=h1,job=y ; +series __name__=b,host=h1,job=y,zone=z2 ; 3:4084c10000000000 4:c072220000000000 5:c06cb00000000000 6:7ff8000000000001 7:4055200000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 3:7ff8000000000001 4:c04c300000000000 6:c0820b0000000000 +series __name__=b,host=h1,job=x,zone=z2 ; +end +case limit limitk 3 none - +grid 100000 10000 6 +series __name__=a,host=h2,job=x,zone=z1 ; 3:408b9d0000000000 4:fff0000000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 1:40837b0000000000 2:40680c0000000000 4:404f600000000000 +series __name__=b,host=h2,job=x ; 2:4087400000000000 3:c083360000000000 4:c07fd40000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 3:408b9d0000000000 4:fff0000000000000 +result __name__=b,host=h2,job=x ; 2:4087400000000000 3:c083360000000000 4:c07fd40000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 1:40837b0000000000 2:40680c0000000000 4:404f600000000000 +end +case limit limit_ratio 0.5 without __name__ +grid 100000 10000 4 +series __name__=a,host=h1,job=x ; 2:407fae0000000000 +series __name__=b,host=h1,job=x ; 0:c072d40000000000 +result __name__=a,host=h1,job=x ; 2:407fae0000000000 +result __name__=b,host=h1,job=x ; 0:c072d40000000000 +end +case limit limit_ratio -0.5 without __name__,job +grid 100000 10000 2 +series __name__=a,host=h2,job=y ; 0:408d630000000000 +series __name__=b,host=h2,job=y ; 1:7ff0000000000000 +series __name__=b,host=h2,job=y,zone=z2 ; 1:4071840000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:0 +result __name__=a,host=h2,job=y ; 0:408d630000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 1:0 +result __name__=b,host=h2,job=y ; 1:7ff0000000000000 +end +case limit limit_ratio 0.3 none - +grid 100000 10000 4 +series __name__=a,host=h2,job=y ; +series __name__=a,host=h2,job=x ; 3:7e37e43c8800759c +series __name__=a,host=h1,job=x ; 2:c083650000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 3:4081e50000000000 +series __name__=b,host=h1,job=x ; 0:40852b0000000000 1:4058780000000000 +series __name__=b,host=h2,job=x ; 3:7ff8000000000001 +series __name__=b,host=h2,job=x,zone=z2 ; 3:c0810c0000000000 +result __name__=b,host=h1,job=x ; 0:40852b0000000000 1:4058780000000000 +result __name__=b,host=h2,job=x ; 3:7ff8000000000001 +end +case limit limitk 1.5 none - +grid 100000 10000 10 +series __name__=a,host=h1,job=x,zone=z1 ; 7:7ff8000000000001 9:c076960000000000 +series __name__=a,host=h2,job=x ; 4:7ff0000000000000 5:407aaa0000000000 +series __name__=a,host=h2,job=y ; 6:c088eb0000000000 +series __name__=b,host=h2,job=x ; 4:c075060000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 8:405dd80000000000 +result __name__=a,host=h1,job=x,zone=z1 ; 7:7ff8000000000001 9:c076960000000000 +result __name__=a,host=h2,job=x ; 4:7ff0000000000000 5:407aaa0000000000 +result __name__=a,host=h2,job=y ; 6:c088eb0000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 8:405dd80000000000 +end +case limit limit_ratio 1.5 none - +grid 100000 10000 9 +series __name__=a,host=h2,job=y ; 4:c073ae0000000000 +series __name__=a,host=h2,job=x ; 6:fff0000000000000 7:c087ff0000000000 +series __name__=a,host=h1,job=x ; 3:4062fc0000000000 4:7ff8000000000001 5:c08bc10000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 7:c08a6e0000000000 8:408a5d0000000000 +series __name__=b,host=h2,job=x ; +series __name__=b,host=h1,job=x ; 7:7e37e43c8800759c +result __name__=a,host=h1,job=x ; 3:4062fc0000000000 4:7ff8000000000001 5:c08bc10000000000 +result __name__=a,host=h2,job=x ; 6:fff0000000000000 7:c087ff0000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 7:c08a6e0000000000 8:408a5d0000000000 +result __name__=a,host=h2,job=y ; 4:c073ae0000000000 +result __name__=b,host=h1,job=x ; 7:7e37e43c8800759c +end +case limit limit_ratio -0.5 none - +grid 100000 10000 11 +series __name__=a,host=h2,job=x ; 0:40802b0000000000 1:c087bb0000000000 3:c079d00000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 9:408e5e0000000000 10:4087c30000000000 +series __name__=b,host=h2,job=x ; 5:4076820000000000 6:4051700000000000 7:7ff8000000000001 +result __name__=a,host=h2,job=x ; 0:40802b0000000000 1:c087bb0000000000 3:c079d00000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 9:408e5e0000000000 10:4087c30000000000 +end +case limit limitk 2 without - +grid 100000 10000 2 +series __name__=a,host=h1,job=x ; 1:c081900000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:fff0000000000000 +series __name__=b,host=h1,job=x ; 1:c084590000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 1:c0825e0000000000 +series __name__=b,host=h1,job=y ; 1:c0773a0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:4084d70000000000 +result __name__=a,host=h1,job=x ; 1:c081900000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 0:fff0000000000000 +result __name__=b,host=h1,job=x ; 1:c084590000000000 +result __name__=b,host=h1,job=x,zone=z2 ; 1:c0825e0000000000 +result __name__=b,host=h1,job=y ; 1:c0773a0000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 0:4084d70000000000 +end +case limit limit_ratio 1.5 by job +grid 100000 10000 1 +series __name__=a,host=h2,job=y ; 0:c077d80000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 0:c077a40000000000 +series __name__=a,host=h1,job=x ; 0:405d880000000000 +series __name__=b,host=h2,job=y ; 0:c0883e0000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 0:c086890000000000 +result __name__=a,host=h1,job=x ; 0:405d880000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 0:c077a40000000000 +result __name__=a,host=h2,job=y ; 0:c077d80000000000 +result __name__=b,host=h1,job=x,zone=z2 ; 0:c086890000000000 +result __name__=b,host=h2,job=y ; 0:c0883e0000000000 +end +case limit limit_ratio 0 none - +grid 100000 10000 3 +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=b,host=h2,job=x,zone=z2 ; 1:4076880000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 1:c081500000000000 +series __name__=b,host=h2,job=x ; +end +case limit limit_ratio 0 without job +grid 100000 10000 8 +series __name__=a,host=h2,job=y ; 7:c07e260000000000 +series __name__=a,host=h1,job=y ; 2:c080820000000000 3:0 4:c082c60000000000 5:405e980000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 4:c08e6a0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:40735e0000000000 +series __name__=b,host=h2,job=y ; 5:c06e2c0000000000 6:7ff0000000000000 +series __name__=b,host=h1,job=y ; 4:7ff8000000000001 +end +case limit limit_ratio NaN without host,job,zone +grid 100000 10000 11 +series __name__=a,host=h1,job=y,zone=z1 ; +series __name__=a,host=h2,job=x ; 0:4089af0000000000 1:c088900000000000 2:405aa80000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 6:4078d20000000000 7:4084890000000000 8:40683c0000000000 9:4087510000000000 10:c086f20000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 1:c063240000000000 2:7e37e43c8800759c 3:4063c80000000000 4:4072c60000000000 +series __name__=b,host=h2,job=x ; 10:4083e60000000000 +error Ratio value is NaN +end +case limit limit_ratio NaN without host,job,zone +grid 100000 10000 11 +series __name__=a,host=h2,job=y ; 8:4084880000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 6:c06fb80000000000 7:c07ba40000000000 +series __name__=b,host=h2,job=y ; 7:7ff8000000000001 8:40853c0000000000 10:c0821e0000000000 +error Ratio value is NaN +end +case limit limit_ratio -1 without job +grid 100000 10000 7 +series __name__=a,host=h1,job=y,zone=z1 ; 3:7ff8000000000001 4:407cfa0000000000 5:407b9e0000000000 +series __name__=a,host=h2,job=x ; 6:0 +series __name__=a,host=h2,job=y,zone=z1 ; 2:40837e0000000000 +series __name__=a,host=h2,job=y ; 2:c082630000000000 3:c06bb80000000000 4:4082e10000000000 +series __name__=b,host=h2,job=y,zone=z1 ; +series __name__=b,host=h2,job=x ; 1:c0899f0000000000 3:40853d0000000000 4:4089390000000000 5:408e4a0000000000 6:7e37e43c8800759c +result __name__=a,host=h1,job=y,zone=z1 ; 3:7ff8000000000001 4:407cfa0000000000 5:407b9e0000000000 +result __name__=a,host=h2,job=x ; 6:0 +result __name__=a,host=h2,job=y ; 2:c082630000000000 3:c06bb80000000000 4:4082e10000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 2:40837e0000000000 +result __name__=b,host=h2,job=x ; 1:c0899f0000000000 3:40853d0000000000 4:4089390000000000 5:408e4a0000000000 6:7e37e43c8800759c +end +case limit limitk NaN by __name__,host,job,zone +grid 100000 10000 1 +series __name__=a,host=h1,job=y ; 0:407a180000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 0:c085b70000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 0:4076400000000000 +series __name__=b,host=h1,job=y ; 0:4073d40000000000 +series __name__=b,host=h2,job=y ; +error Parameter value is NaN +end +case limit limit_ratio -0.3 by host +grid 100000 10000 6 +series __name__=a,host=h1,job=y,zone=z1 ; 0:7ff8000000000001 1:c088480000000000 2:4081130000000000 +series __name__=a,host=h2,job=y ; 0:4082da0000000000 1:4089250000000000 2:c08f260000000000 3:4081ba0000000000 4:c086560000000000 5:40868c0000000000 +series __name__=b,host=h2,job=y ; 3:c0858b0000000000 4:c085d50000000000 +series __name__=b,host=h1,job=y ; 4:c0870e0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:4084e20000000000 2:c084150000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 1:4084e20000000000 2:c084150000000000 +end +case limit limit_ratio 0 none - +grid 100000 10000 9 +series __name__=a,host=h2,job=y,zone=z1 ; 8:4060000000000000 +series __name__=a,host=h1,job=x ; 6:c066380000000000 7:7ff8000000000001 +series __name__=a,host=h2,job=x ; 3:c067700000000000 4:fff0000000000000 6:408a7c0000000000 7:407d960000000000 +series __name__=a,host=h1,job=x,zone=z1 ; +series __name__=a,host=h2,job=x,zone=z1 ; 3:407d940000000000 4:7ff8000000000001 +series __name__=b,host=h2,job=y,zone=z1 ; +series __name__=b,host=h1,job=x,zone=z1 ; 2:c056080000000000 3:408e490000000000 4:c042c00000000000 5:c053a80000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 6:c086520000000000 7:400a000000000000 8:c086fd0000000000 +series __name__=b,host=h1,job=x ; 8:c06ff40000000000 +end +case limit limitk 0 none - +grid 100000 10000 8 +series __name__=a,host=h2,job=x ; 6:4076cc0000000000 7:c066800000000000 +series __name__=b,host=h2,job=x ; 1:c0842b0000000000 2:c08df50000000000 3:4088430000000000 5:c08b9a0000000000 6:c0789e0000000000 +end +case limit limit_ratio 0.9 by __name__ +grid 100000 10000 8 +series __name__=a,host=h2,job=x ; 5:0 +series __name__=a,host=h2,job=y,zone=z1 ; 2:c063f00000000000 3:4077140000000000 4:4049d00000000000 5:c080600000000000 +series __name__=b,host=h2,job=x ; 1:4089270000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 1:c055e00000000000 3:c067d40000000000 +result __name__=a,host=h2,job=x ; 5:0 +result __name__=a,host=h2,job=y,zone=z1 ; 2:c063f00000000000 3:4077140000000000 4:4049d00000000000 5:c080600000000000 +result __name__=b,host=h2,job=x ; 1:4089270000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 1:c055e00000000000 3:c067d40000000000 +end +case limit limitk 3 none - +grid 100000 10000 8 +series __name__=a,host=h2,job=y,zone=z1 ; 7:408a630000000000 +series __name__=a,host=h2,job=y ; 5:c072620000000000 +series __name__=a,host=h1,job=x ; +series __name__=a,host=h1,job=y ; 0:4042000000000000 +series __name__=b,host=h1,job=x ; 1:408d840000000000 2:c082d80000000000 3:7ff8000000000001 +series __name__=b,host=h2,job=x ; 4:c07db20000000000 6:407a220000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 2:407aba0000000000 3:c06ef40000000000 4:c083b40000000000 5:405c680000000000 6:c087080000000000 +result __name__=a,host=h1,job=y ; 0:4042000000000000 +result __name__=a,host=h2,job=y ; 5:c072620000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 7:408a630000000000 +result __name__=b,host=h1,job=x ; 1:408d840000000000 2:c082d80000000000 3:7ff8000000000001 +result __name__=b,host=h2,job=x ; 4:c07db20000000000 6:407a220000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 2:407aba0000000000 3:c06ef40000000000 4:c083b40000000000 5:405c680000000000 6:c087080000000000 +end +case limit limitk 3 none - +grid 100000 10000 2 +series __name__=a,host=h2,job=y ; 1:c062f40000000000 +series __name__=a,host=h2,job=y,zone=z1 ; +series __name__=a,host=h2,job=x,zone=z1 ; 0:c082e80000000000 1:c064680000000000 +series __name__=a,host=h2,job=x ; 0:c074e60000000000 +series __name__=a,host=h1,job=y ; 1:c0851b0000000000 +series __name__=a,host=h1,job=x ; +series __name__=b,host=h2,job=x,zone=z1 ; 0:c072ae0000000000 +series __name__=b,host=h2,job=y ; 1:c080e90000000000 +result __name__=a,host=h1,job=y ; 1:c0851b0000000000 +result __name__=a,host=h2,job=x ; 0:c074e60000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 0:c082e80000000000 1:c064680000000000 +result __name__=a,host=h2,job=y ; 1:c062f40000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 0:c072ae0000000000 +end +case limit limit_ratio -0.5 by host +grid 100000 10000 7 +series __name__=a,host=h2,job=x,zone=z1 ; 2:406aa00000000000 +series __name__=a,host=h1,job=y ; 3:4066a00000000000 4:c086b20000000000 5:407e0c0000000000 +series __name__=b,host=h1,job=y ; 0:407aac0000000000 1:c077080000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 6:c065600000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 3:4051380000000000 +series __name__=b,host=h1,job=y,zone=z2 ; +result __name__=a,host=h1,job=y ; 3:4066a00000000000 4:c086b20000000000 5:407e0c0000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 2:406aa00000000000 +end +case limit limitk 2 none - +grid 100000 10000 9 +series __name__=a,host=h2,job=x ; 4:c08e180000000000 5:7e37e43c8800759c +series __name__=a,host=h1,job=x ; 6:c0830b0000000000 7:4089e80000000000 +series __name__=a,host=h2,job=y ; 0:4083010000000000 1:c066640000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 6:40862c0000000000 +series __name__=a,host=h1,job=y ; 3:4077840000000000 +series __name__=b,host=h2,job=y,zone=z2 ; 6:406be00000000000 +series __name__=b,host=h1,job=y ; 7:4055a80000000000 +series __name__=b,host=h2,job=y ; 2:c073aa0000000000 3:c077f00000000000 4:4083630000000000 +result __name__=a,host=h1,job=x ; 6:c0830b0000000000 7:4089e80000000000 +result __name__=a,host=h1,job=y ; 3:4077840000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 6:40862c0000000000 +result __name__=a,host=h2,job=x ; 4:c08e180000000000 5:7e37e43c8800759c +result __name__=a,host=h2,job=y ; 0:4083010000000000 1:c066640000000000 +result __name__=b,host=h1,job=y ; 7:4055a80000000000 +result __name__=b,host=h2,job=y ; 2:c073aa0000000000 3:c077f00000000000 4:4083630000000000 +end +case limit limitk 1.5 without __name__ +grid 100000 10000 1 +series __name__=a,host=h2,job=y ; 0:7ff8000000000001 +series __name__=b,host=h1,job=x ; 0:c08a990000000000 +series __name__=b,host=h2,job=y ; 0:c06b000000000000 +result __name__=a,host=h2,job=y ; 0:7ff8000000000001 +result __name__=b,host=h1,job=x ; 0:c08a990000000000 +end +case limit limitk -1 by __name__,host +grid 100000 10000 4 +series __name__=a,host=h1,job=y ; +series __name__=a,host=h2,job=x ; 1:c07ea20000000000 2:0 3:c086e10000000000 +series __name__=a,host=h1,job=x ; 2:7ff8000000000001 3:405e680000000000 +series __name__=a,host=h2,job=y ; 3:403cc00000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 1:c052d00000000000 2:4087d80000000000 +series __name__=b,host=h2,job=y ; +series __name__=b,host=h2,job=x ; 1:407f180000000000 2:408b490000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:4088240000000000 1:4084e00000000000 2:c07a960000000000 3:c069a00000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:4044100000000000 1:c065880000000000 2:407e0e0000000000 +series __name__=b,host=h1,job=x ; 3:c052d80000000000 +end +case limit limit_ratio 1 by host,job +grid 100000 10000 2 +series __name__=a,host=h1,job=x ; 1:407dc40000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 1:7ff8000000000001 +series __name__=b,host=h1,job=x ; 0:c087820000000000 +series __name__=b,host=h2,job=y ; 0:0 +series __name__=b,host=h1,job=y,zone=z1 ; 1:c075940000000000 +series __name__=b,host=h1,job=y ; 1:c058f00000000000 +result __name__=a,host=h1,job=x ; 1:407dc40000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 1:7ff8000000000001 +result __name__=b,host=h1,job=x ; 0:c087820000000000 +result __name__=b,host=h1,job=y ; 1:c058f00000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 1:c075940000000000 +result __name__=b,host=h2,job=y ; 0:0 +end +case limit limit_ratio -1 without - +grid 100000 10000 9 +series __name__=a,host=h1,job=y ; 8:40873f0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 3:c081420000000000 +series __name__=b,host=h1,job=x,zone=z1 ; +result __name__=a,host=h1,job=x,zone=z1 ; 3:c081420000000000 +result __name__=a,host=h1,job=y ; 8:40873f0000000000 +end +case limit limitk NaN none - +grid 100000 10000 3 +series __name__=a,host=h1,job=y,zone=z1 ; 1:c08b070000000000 +series __name__=a,host=h2,job=y ; 2:7ff0000000000000 +series __name__=a,host=h1,job=x ; 2:c082330000000000 +series __name__=a,host=h1,job=y ; 1:c08b810000000000 +series __name__=b,host=h2,job=y ; 1:7e37e43c8800759c 2:fff0000000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:7ff8000000000001 2:4063080000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 0:4075660000000000 +error Parameter value is NaN +end +case limit limitk 10 none - +grid 100000 10000 9 +series __name__=a,host=h2,job=y ; 7:405b400000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 6:405dd00000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:c077a60000000000 1:c08b2b0000000000 3:4089970000000000 +series __name__=b,host=h1,job=y ; 1:40833e0000000000 +series __name__=b,host=h2,job=y ; 4:407e480000000000 5:40752a0000000000 6:c020800000000000 7:c07bd60000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 8:c08f0f0000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 6:405dd00000000000 +result __name__=a,host=h2,job=y ; 7:405b400000000000 +result __name__=b,host=h1,job=y ; 1:40833e0000000000 +result __name__=b,host=h1,job=y,zone=z2 ; 8:c08f0f0000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 0:c077a60000000000 1:c08b2b0000000000 3:4089970000000000 +result __name__=b,host=h2,job=y ; 4:407e480000000000 5:40752a0000000000 6:c020800000000000 7:c07bd60000000000 +end +case limit limit_ratio -1 without host,zone +grid 100000 10000 10 +series __name__=a,host=h1,job=x ; 5:c075400000000000 6:c072600000000000 7:c05a900000000000 9:4089c90000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 7:406bd00000000000 +series __name__=b,host=h1,job=x ; 6:7e37e43c8800759c +result __name__=a,host=h1,job=x ; 5:c075400000000000 6:c072600000000000 7:c05a900000000000 9:4089c90000000000 +result __name__=b,host=h1,job=x ; 6:7e37e43c8800759c +result __name__=b,host=h2,job=x,zone=z1 ; 7:406bd00000000000 +end +case limit limit_ratio -0.5 by __name__ +grid 100000 10000 7 +series __name__=a,host=h2,job=x,zone=z1 ; 0:c08e130000000000 1:c064700000000000 2:4087fc0000000000 +series __name__=a,host=h2,job=x ; 6:4086a20000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 3:7ff8000000000001 4:408a320000000000 +series __name__=a,host=h1,job=x ; 5:c047100000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 3:c07aee0000000000 4:c082470000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 5:c029000000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:c050f00000000000 1:405ca80000000000 +series __name__=b,host=h2,job=x ; 6:c087b20000000000 +result __name__=a,host=h2,job=x ; 6:4086a20000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 0:c08e130000000000 1:c064700000000000 2:4087fc0000000000 +end +case limit limit_ratio 0.3 none - +grid 100000 10000 1 +series __name__=a,host=h2,job=x ; 0:c089820000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:c081140000000000 +series __name__=b,host=h1,job=y ; 0:7ff0000000000000 +series __name__=b,host=h2,job=x ; 0:c0721a0000000000 +result __name__=b,host=h2,job=x ; 0:c0721a0000000000 +end +case limit limit_ratio -1 none - +grid 100000 10000 3 +series __name__=a,host=h1,job=y,zone=z1 ; +series __name__=a,host=h1,job=y ; 1:7ff0000000000000 +series __name__=a,host=h1,job=x ; 1:c072800000000000 +series __name__=a,host=h2,job=y ; 2:7ff8000000000001 +series __name__=b,host=h2,job=y ; 1:c089740000000000 +series __name__=b,host=h1,job=x ; 0:c074c40000000000 1:c064b40000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 2:4082940000000000 +result __name__=a,host=h1,job=x ; 1:c072800000000000 +result __name__=a,host=h1,job=y ; 1:7ff0000000000000 +result __name__=a,host=h2,job=y ; 2:7ff8000000000001 +result __name__=b,host=h1,job=x ; 0:c074c40000000000 1:c064b40000000000 +result __name__=b,host=h2,job=y ; 1:c089740000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 2:4082940000000000 +end +case limit limitk 1.5 by host,zone +grid 100000 10000 6 +series __name__=a,host=h2,job=x ; 4:c0752c0000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 0:0 +series __name__=a,host=h1,job=x ; 3:c07b360000000000 +series __name__=b,host=h1,job=x ; 4:7e37e43c8800759c +series __name__=b,host=h2,job=y ; 5:c062340000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 5:7ff0000000000000 +result __name__=a,host=h1,job=x ; 3:c07b360000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 0:0 +result __name__=a,host=h2,job=x ; 4:c0752c0000000000 +result __name__=b,host=h1,job=x ; 4:7e37e43c8800759c +result __name__=b,host=h2,job=y ; 5:c062340000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 5:7ff0000000000000 +end +case limit limit_ratio -1.5 none - +grid 100000 10000 4 +series __name__=a,host=h2,job=x ; +series __name__=a,host=h2,job=y ; 1:4084200000000000 2:c086690000000000 3:c070ec0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 2:0 +series __name__=b,host=h2,job=y,zone=z1 ; 3:404c700000000000 +series __name__=b,host=h2,job=x ; 0:4089990000000000 1:c08e120000000000 2:407da40000000000 +series __name__=b,host=h1,job=y ; 1:c064e00000000000 2:c07e260000000000 3:4060600000000000 +result __name__=a,host=h2,job=y ; 1:4084200000000000 2:c086690000000000 3:c070ec0000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 2:0 +result __name__=b,host=h1,job=y ; 1:c064e00000000000 2:c07e260000000000 3:4060600000000000 +result __name__=b,host=h2,job=x ; 0:4089990000000000 1:c08e120000000000 2:407da40000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 3:404c700000000000 +end +case limit limit_ratio 1 without host,zone +grid 100000 10000 11 +series __name__=a,host=h2,job=y ; 10:c08d430000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 1:c044500000000000 2:7ff0000000000000 3:4071940000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 0:c063c80000000000 1:c08b5f0000000000 3:c086c20000000000 4:c071e40000000000 5:c089450000000000 6:4084b40000000000 8:c0889c0000000000 9:c08e350000000000 10:c0751e0000000000 +series __name__=a,host=h2,job=x ; 3:c080850000000000 4:c08c210000000000 5:c087fc0000000000 6:408d490000000000 8:c046f00000000000 +series __name__=b,host=h1,job=y ; 6:c07a260000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 5:4073500000000000 +result __name__=a,host=h1,job=x,zone=z1 ; 1:c044500000000000 2:7ff0000000000000 3:4071940000000000 +result __name__=a,host=h2,job=x ; 3:c080850000000000 4:c08c210000000000 5:c087fc0000000000 6:408d490000000000 8:c046f00000000000 +result __name__=a,host=h2,job=y ; 10:c08d430000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 0:c063c80000000000 1:c08b5f0000000000 3:c086c20000000000 4:c071e40000000000 5:c089450000000000 6:4084b40000000000 8:c0889c0000000000 9:c08e350000000000 10:c0751e0000000000 +result __name__=b,host=h1,job=x,zone=z1 ; 5:4073500000000000 +result __name__=b,host=h1,job=y ; 6:c07a260000000000 +end +case limit limitk 1 none - +grid 100000 10000 4 +series __name__=a,host=h1,job=y,zone=z1 ; 3:4083510000000000 +series __name__=a,host=h1,job=y ; 1:4072ca0000000000 +series __name__=a,host=h2,job=y ; 3:c0852b0000000000 +series __name__=b,host=h2,job=y ; 0:0 1:fff0000000000000 2:7ff8000000000001 +series __name__=b,host=h1,job=y,zone=z1 ; 2:c08e8d0000000000 3:7ff8000000000001 +series __name__=b,host=h1,job=y ; 2:c07d680000000000 3:c0863f0000000000 +result __name__=a,host=h1,job=y ; 1:4072ca0000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 3:4083510000000000 +result __name__=b,host=h2,job=y ; 0:0 2:7ff8000000000001 +end +case limit limit_ratio 0 by __name__,host,zone +grid 100000 10000 9 +series __name__=a,host=h2,job=x ; 4:c08cd80000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 2:c063540000000000 3:40754e0000000000 4:4086db0000000000 5:c05ba80000000000 6:c052200000000000 7:4084fd0000000000 8:c059800000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:4071460000000000 2:4081220000000000 +series __name__=b,host=h2,job=x ; 2:4081560000000000 3:c07a380000000000 4:406b740000000000 5:407e520000000000 6:c08de10000000000 7:407b460000000000 +end +case limit limitk 1 without job +grid 100000 10000 8 +series __name__=a,host=h1,job=x ; 6:c04d200000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 6:c086770000000000 7:4082900000000000 +series __name__=a,host=h2,job=y ; 1:4061080000000000 2:7ff8000000000001 3:c08c200000000000 4:4082a60000000000 +series __name__=a,host=h1,job=y ; 5:c08a560000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 3:0 5:c07a8c0000000000 +series __name__=b,host=h1,job=y ; +series __name__=b,host=h1,job=y,zone=z1 ; 3:4071b60000000000 4:c046d00000000000 +series __name__=b,host=h1,job=x ; +series __name__=b,host=h1,job=y,zone=z2 ; 6:c077980000000000 7:c0778a0000000000 +result __name__=a,host=h1,job=x ; 6:c04d200000000000 +result __name__=a,host=h1,job=y ; 5:c08a560000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 3:0 5:c07a8c0000000000 +result __name__=a,host=h2,job=y ; 1:4061080000000000 2:7ff8000000000001 3:c08c200000000000 4:4082a60000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 6:c086770000000000 7:4082900000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 4:c046d00000000000 +result __name__=b,host=h1,job=y,zone=z2 ; 6:c077980000000000 7:c0778a0000000000 +end +case limit limit_ratio 0.5 by host,job,zone +grid 100000 10000 4 +series __name__=a,host=h2,job=y ; 2:c075e40000000000 +series __name__=a,host=h1,job=y ; 2:4082130000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 0:408ac60000000000 1:4042d00000000000 2:c08daf0000000000 3:40736c0000000000 +series __name__=a,host=h2,job=x ; 1:7ff8000000000001 2:4085af0000000000 3:c074820000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:407d660000000000 1:40837d0000000000 +series __name__=b,host=h2,job=y ; 3:4084f00000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 0:408ac60000000000 1:4042d00000000000 2:c08daf0000000000 3:40736c0000000000 +end +case limit limit_ratio 0.3 without host +grid 100000 10000 11 +series __name__=a,host=h2,job=y,zone=z1 ; 10:4077ba0000000000 +series __name__=a,host=h1,job=y ; 0:408cce0000000000 1:408bd00000000000 3:4084330000000000 5:407ff00000000000 6:c0770a0000000000 7:fff0000000000000 8:7ff0000000000000 9:406ec40000000000 +series __name__=a,host=h2,job=x ; 4:7ff8000000000001 5:c06e840000000000 6:c088c20000000000 7:40813f0000000000 +series __name__=b,host=h1,job=x ; 2:4088940000000000 3:4040500000000000 4:c06d680000000000 5:408dd70000000000 6:c0894b0000000000 7:7e37e43c8800759c 9:4075060000000000 10:4086f40000000000 +series __name__=b,host=h2,job=y,zone=z2 ; 9:40881f0000000000 10:4076bc0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 10:c085570000000000 +result __name__=b,host=h1,job=x ; 2:4088940000000000 3:4040500000000000 4:c06d680000000000 5:408dd70000000000 6:c0894b0000000000 7:7e37e43c8800759c 9:4075060000000000 10:4086f40000000000 +result __name__=b,host=h2,job=y,zone=z2 ; 9:40881f0000000000 10:4076bc0000000000 +end +case limit limit_ratio 1.5 none - +grid 100000 10000 8 +series __name__=a,host=h1,job=x,zone=z1 ; 3:4065f80000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 5:c08bd20000000000 6:408c3d0000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 4:c08bb40000000000 7:408ccd0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 4:c08cea0000000000 5:c08d320000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 3:c08df70000000000 5:7ff8000000000001 6:c089d20000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 2:c06d300000000000 3:40864f0000000000 5:407b0e0000000000 7:4089760000000000 +result __name__=a,host=h1,job=x,zone=z1 ; 3:4065f80000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 4:c08bb40000000000 7:408ccd0000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 5:c08bd20000000000 6:408c3d0000000000 +result __name__=b,host=h1,job=x,zone=z1 ; 4:c08cea0000000000 5:c08d320000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 3:c08df70000000000 5:7ff8000000000001 6:c089d20000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 2:c06d300000000000 3:40864f0000000000 5:407b0e0000000000 7:4089760000000000 +end +case limit limit_ratio 0.3 without - +grid 100000 10000 7 +series __name__=a,host=h2,job=x ; 3:c0864b0000000000 4:c06a080000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 6:4081db0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 5:4078fc0000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 3:c016000000000000 4:c06d140000000000 5:406bd40000000000 +series __name__=b,host=h2,job=x ; 0:7ff0000000000000 1:c083350000000000 2:c07be60000000000 3:408b590000000000 4:c083f50000000000 5:c088240000000000 +result __name__=b,host=h2,job=x ; 0:7ff0000000000000 1:c083350000000000 2:c07be60000000000 3:408b590000000000 4:c083f50000000000 5:c088240000000000 +end +case limit limitk NaN without __name__,job,zone +grid 100000 10000 5 +series __name__=a,host=h1,job=y ; +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=b,host=h2,job=x,zone=z1 ; 3:40754e0000000000 +error Parameter value is NaN +end +case limit limitk 0 none - +grid 100000 10000 11 +series __name__=a,host=h2,job=y ; 7:c04b400000000000 8:4085340000000000 9:c0742c0000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 10:c08bc70000000000 +series __name__=a,host=h1,job=y ; 3:c088ea0000000000 4:4076660000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 10:7ff8000000000001 +series __name__=a,host=h2,job=x ; 0:406b0c0000000000 1:4087650000000000 +series __name__=b,host=h2,job=y ; 1:40805c0000000000 2:c085350000000000 3:c08ab20000000000 +series __name__=b,host=h1,job=x ; 2:40750a0000000000 3:7e37e43c8800759c 5:c06d440000000000 7:c036600000000000 8:4060e80000000000 9:c0845c0000000000 +series __name__=b,host=h2,job=x ; 7:c0812f0000000000 8:40846e0000000000 9:c080930000000000 +series __name__=b,host=h1,job=y ; 2:c079b40000000000 +end +case limit limit_ratio -1 by host +grid 100000 10000 6 +series __name__=a,host=h2,job=y ; 4:407c360000000000 +series __name__=a,host=h2,job=x ; 0:c081410000000000 1:c068180000000000 +series __name__=a,host=h1,job=y ; 2:4061d80000000000 3:4078c20000000000 +series __name__=b,host=h2,job=y ; 1:c089f60000000000 +series __name__=b,host=h2,job=y,zone=z2 ; 1:c053d00000000000 2:4072180000000000 3:4072040000000000 +series __name__=b,host=h1,job=y ; 2:c082ac0000000000 3:c05e780000000000 +result __name__=a,host=h1,job=y ; 2:4061d80000000000 3:4078c20000000000 +result __name__=a,host=h2,job=x ; 0:c081410000000000 1:c068180000000000 +result __name__=a,host=h2,job=y ; 4:407c360000000000 +result __name__=b,host=h1,job=y ; 2:c082ac0000000000 3:c05e780000000000 +result __name__=b,host=h2,job=y ; 1:c089f60000000000 +result __name__=b,host=h2,job=y,zone=z2 ; 1:c053d00000000000 2:4072180000000000 3:4072040000000000 +end +case limit limitk 2 without host,job +grid 100000 10000 8 +series __name__=a,host=h2,job=y ; 3:c0879b0000000000 4:c07b4a0000000000 5:4085d90000000000 +series __name__=b,host=h2,job=y ; 4:7ff8000000000001 5:c063a80000000000 +result __name__=a,host=h2,job=y ; 3:c0879b0000000000 4:c07b4a0000000000 5:4085d90000000000 +result __name__=b,host=h2,job=y ; 4:7ff8000000000001 5:c063a80000000000 +end +case limit limit_ratio 0.9 none - +grid 100000 10000 3 +series __name__=a,host=h2,job=x,zone=z1 ; 1:7ff8000000000001 +series __name__=a,host=h1,job=y,zone=z1 ; +series __name__=a,host=h1,job=x ; 2:4083010000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:7e37e43c8800759c 1:4085e60000000000 2:4074e00000000000 +series __name__=b,host=h1,job=x,zone=z1 ; +series __name__=b,host=h2,job=x,zone=z1 ; 1:c060ec0000000000 +series __name__=b,host=h1,job=x ; 1:408d5f0000000000 2:7ff8000000000001 +result __name__=a,host=h1,job=x ; 2:4083010000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 1:7ff8000000000001 +result __name__=b,host=h1,job=x ; 1:408d5f0000000000 2:7ff8000000000001 +result __name__=b,host=h1,job=y,zone=z1 ; 0:7e37e43c8800759c 1:4085e60000000000 2:4074e00000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 1:c060ec0000000000 +end +case limit limit_ratio 0.5 by host +grid 100000 10000 11 +series __name__=a,host=h1,job=x ; 8:0 +series __name__=b,host=h1,job=x ; +series __name__=b,host=h2,job=y,zone=z1 ; 8:c072360000000000 9:4084ff0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 8:7ff8000000000001 10:c086d20000000000 +series __name__=b,host=h2,job=x ; 8:7ff0000000000000 9:c08a000000000000 10:c077c80000000000 +result __name__=a,host=h1,job=x ; 8:0 +result __name__=b,host=h1,job=x,zone=z1 ; 8:7ff8000000000001 10:c086d20000000000 +result __name__=b,host=h2,job=x ; 8:7ff0000000000000 9:c08a000000000000 10:c077c80000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 8:c072360000000000 9:4084ff0000000000 +end +case limit limit_ratio 0.5 without __name__ +grid 100000 10000 4 +series __name__=a,host=h2,job=x ; 2:c07bd20000000000 3:c0692c0000000000 +series __name__=a,host=h1,job=y ; 3:4084de0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 1:407c320000000000 2:408e5a0000000000 3:c07be00000000000 +series __name__=a,host=h1,job=x ; 2:c0807f0000000000 3:4052480000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:c062280000000000 1:4081f80000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 3:408bdb0000000000 +result __name__=a,host=h1,job=x ; 2:c0807f0000000000 3:4052480000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 1:407c320000000000 2:408e5a0000000000 3:c07be00000000000 +result __name__=b,host=h1,job=x,zone=z1 ; 0:c062280000000000 1:4081f80000000000 +end +case limit limitk 3 by __name__ +grid 100000 10000 2 +series __name__=a,host=h1,job=y,zone=z1 ; 1:7e37e43c8800759c +series __name__=b,host=h1,job=y,zone=z1 ; 1:c0816c0000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 1:7e37e43c8800759c +result __name__=b,host=h1,job=y,zone=z1 ; 1:c0816c0000000000 +end +case limit limit_ratio -1.5 by host +grid 100000 10000 6 +series __name__=a,host=h1,job=y ; +series __name__=a,host=h2,job=x ; 4:c0862b0000000000 +series __name__=b,host=h1,job=x ; 2:7ff0000000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:4081a30000000000 +series __name__=b,host=h1,job=y ; 2:c080030000000000 +result __name__=a,host=h2,job=x ; 4:c0862b0000000000 +result __name__=b,host=h1,job=x ; 2:7ff0000000000000 +result __name__=b,host=h1,job=y ; 2:c080030000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 0:4081a30000000000 +end +case limit limitk 3 none - +grid 100000 10000 11 +series __name__=a,host=h2,job=x,zone=z1 ; 7:c070be0000000000 8:4079560000000000 9:7e37e43c8800759c +series __name__=a,host=h1,job=x ; 5:c089950000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 1:4075ce0000000000 2:408a680000000000 4:4043800000000000 5:c068ec0000000000 6:4044200000000000 7:fff0000000000000 8:407e900000000000 +series __name__=b,host=h1,job=x ; 7:c06a280000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 1:407ed20000000000 3:c07a5e0000000000 4:7ff0000000000000 6:c08e910000000000 +result __name__=a,host=h1,job=x ; 5:c089950000000000 +result __name__=a,host=h1,job=x,zone=z1 ; 1:4075ce0000000000 2:408a680000000000 4:4043800000000000 5:c068ec0000000000 6:4044200000000000 7:fff0000000000000 8:407e900000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 7:c070be0000000000 8:4079560000000000 9:7e37e43c8800759c +result __name__=b,host=h1,job=x ; 7:c06a280000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 1:407ed20000000000 3:c07a5e0000000000 4:7ff0000000000000 6:c08e910000000000 +end +case limit limitk 2 none - +grid 100000 10000 4 +series __name__=a,host=h2,job=y ; +series __name__=a,host=h2,job=x,zone=z1 ; 0:4068d80000000000 2:c06c540000000000 3:c08f070000000000 +series __name__=a,host=h2,job=x ; 0:407e180000000000 +series __name__=a,host=h1,job=y ; 0:c086600000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 1:408a2d0000000000 2:4064d00000000000 3:c087510000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 3:4064f00000000000 +result __name__=a,host=h2,job=x ; 0:407e180000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 0:4068d80000000000 2:c06c540000000000 3:c08f070000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 1:408a2d0000000000 2:4064d00000000000 3:c087510000000000 +end +case limit limitk -1 by __name__,zone +grid 100000 10000 6 +series __name__=a,host=h2,job=x ; 4:4051e00000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 0:408bf60000000000 1:407acc0000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 5:4076c80000000000 +series __name__=b,host=h2,job=y ; 3:c063f00000000000 4:c07aa20000000000 +end +case limit limitk 3 without host,zone +grid 100000 10000 3 +series __name__=a,host=h1,job=y ; 0:4079fc0000000000 1:4087970000000000 2:407aaa0000000000 +series __name__=a,host=h1,job=x ; 2:4050c00000000000 +series __name__=b,host=h1,job=y ; 1:40888f0000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 1:7ff8000000000001 2:c089030000000000 +result __name__=a,host=h1,job=x ; 2:4050c00000000000 +result __name__=a,host=h1,job=y ; 0:4079fc0000000000 1:4087970000000000 2:407aaa0000000000 +result __name__=b,host=h1,job=y ; 1:40888f0000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 1:7ff8000000000001 2:c089030000000000 +end +case limit limitk 10 none - +grid 100000 10000 10 +series __name__=a,host=h1,job=x ; 3:406f140000000000 4:40723e0000000000 5:c05c300000000000 6:4085570000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:4074080000000000 1:c075020000000000 2:c08def0000000000 4:0 5:7ff8000000000001 6:4068d00000000000 +series __name__=a,host=h2,job=y ; 9:c084020000000000 +series __name__=b,host=h2,job=y ; 6:40718c0000000000 7:c08efe0000000000 +series __name__=b,host=h1,job=x ; 3:c08df70000000000 4:404a500000000000 5:c08ed00000000000 6:4083640000000000 +result __name__=a,host=h1,job=x ; 3:406f140000000000 4:40723e0000000000 5:c05c300000000000 6:4085570000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 0:4074080000000000 1:c075020000000000 2:c08def0000000000 4:0 5:7ff8000000000001 6:4068d00000000000 +result __name__=a,host=h2,job=y ; 9:c084020000000000 +result __name__=b,host=h1,job=x ; 3:c08df70000000000 4:404a500000000000 5:c08ed00000000000 6:4083640000000000 +result __name__=b,host=h2,job=y ; 6:40718c0000000000 7:c08efe0000000000 +end +case limit limitk 10 without host +grid 100000 10000 1 +series __name__=a,host=h1,job=y ; 0:40858b0000000000 +series __name__=a,host=h1,job=x ; 0:0 +series __name__=a,host=h2,job=x ; 0:c080310000000000 +series __name__=a,host=h2,job=y ; +series __name__=a,host=h2,job=x,zone=z1 ; 0:7e37e43c8800759c +series __name__=a,host=h2,job=y,zone=z1 ; 0:4083970000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 0:4085320000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:4085340000000000 +result __name__=a,host=h1,job=x ; 0:0 +result __name__=a,host=h1,job=y ; 0:40858b0000000000 +result __name__=a,host=h2,job=x ; 0:c080310000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 0:7e37e43c8800759c +result __name__=a,host=h2,job=y,zone=z1 ; 0:4083970000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 0:4085340000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 0:4085320000000000 +end +case limit limitk 3 by __name__,job +grid 100000 10000 5 +series __name__=a,host=h1,job=y,zone=z1 ; 0:c075a20000000000 1:c082bc0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 4:c0878f0000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 0:c075a20000000000 1:c082bc0000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 4:c0878f0000000000 +end +case limit limitk 2 by __name__,zone +grid 100000 10000 11 +series __name__=a,host=h1,job=y,zone=z1 ; 5:40830d0000000000 6:407bfa0000000000 7:4085050000000000 +series __name__=a,host=h2,job=x ; 1:405fb00000000000 3:4083340000000000 5:c089590000000000 6:4081250000000000 7:7ff8000000000001 +series __name__=a,host=h1,job=x ; 2:4033400000000000 3:c074020000000000 4:4070220000000000 5:c085a90000000000 6:c08ccc0000000000 8:4029c00000000000 +series __name__=a,host=h1,job=y ; 8:c061c80000000000 9:4087c30000000000 10:4079940000000000 +series __name__=a,host=h2,job=y ; 9:c080c00000000000 10:7ff0000000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 3:c07e520000000000 4:40771c0000000000 5:c072e00000000000 6:40891a0000000000 7:c073300000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 2:c066780000000000 4:c08c940000000000 5:c080ca0000000000 6:40844f0000000000 7:4079d80000000000 +result __name__=a,host=h1,job=x ; 2:4033400000000000 3:c074020000000000 4:4070220000000000 5:c085a90000000000 6:c08ccc0000000000 8:4029c00000000000 +result __name__=a,host=h1,job=y ; 8:c061c80000000000 9:4087c30000000000 10:4079940000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 5:40830d0000000000 6:407bfa0000000000 7:4085050000000000 +result __name__=a,host=h2,job=x ; 1:405fb00000000000 3:4083340000000000 5:c089590000000000 6:4081250000000000 7:7ff8000000000001 +result __name__=a,host=h2,job=y ; 9:c080c00000000000 10:7ff0000000000000 +result __name__=b,host=h1,job=x,zone=z1 ; 3:c07e520000000000 4:40771c0000000000 5:c072e00000000000 6:40891a0000000000 7:c073300000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 2:c066780000000000 4:c08c940000000000 5:c080ca0000000000 6:40844f0000000000 7:4079d80000000000 +end +case limit limit_ratio NaN none - +grid 100000 10000 8 +series __name__=a,host=h1,job=x,zone=z1 ; 4:c027400000000000 5:c075cc0000000000 +series __name__=a,host=h1,job=x ; 5:c08a8f0000000000 6:4089760000000000 7:c08d7c0000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 3:407f020000000000 4:0 6:c08d7d0000000000 +series __name__=a,host=h2,job=x ; 5:7ff0000000000000 6:408a740000000000 +series __name__=b,host=h1,job=y,zone=z1 ; +series __name__=b,host=h1,job=y ; +series __name__=b,host=h1,job=x ; 5:4073ce0000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 6:40859b0000000000 +error Ratio value is NaN +end +case limit limitk 3 by __name__,host +grid 100000 10000 5 +series __name__=a,host=h1,job=y,zone=z1 ; 2:4082250000000000 3:4084e80000000000 +series __name__=a,host=h1,job=x,zone=z1 ; +series __name__=a,host=h2,job=y ; 1:7e37e43c8800759c 2:4086f20000000000 3:c076c20000000000 4:4087440000000000 +series __name__=a,host=h1,job=x ; 3:c07de20000000000 4:c076540000000000 +series __name__=b,host=h1,job=y ; 4:4077240000000000 +series __name__=b,host=h2,job=y ; 0:40746c0000000000 1:0 2:4076260000000000 3:c0824e0000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 0:c042200000000000 1:4069ac0000000000 2:408d5a0000000000 3:c0746e0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:c067c80000000000 +series __name__=b,host=h1,job=x ; 4:7ff8000000000001 +result __name__=a,host=h1,job=x ; 3:c07de20000000000 4:c076540000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 2:4082250000000000 3:4084e80000000000 +result __name__=a,host=h2,job=y ; 1:7e37e43c8800759c 2:4086f20000000000 3:c076c20000000000 4:4087440000000000 +result __name__=b,host=h1,job=x ; 4:7ff8000000000001 +result __name__=b,host=h1,job=y ; 4:4077240000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 0:c067c80000000000 +result __name__=b,host=h1,job=y,zone=z2 ; 0:c042200000000000 1:4069ac0000000000 2:408d5a0000000000 3:c0746e0000000000 +result __name__=b,host=h2,job=y ; 0:40746c0000000000 1:0 2:4076260000000000 3:c0824e0000000000 +end +case limit limitk 1 without host +grid 100000 10000 7 +series __name__=a,host=h2,job=x ; 6:0 +series __name__=a,host=h2,job=y ; 5:c086680000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 6:c087a30000000000 +series __name__=b,host=h2,job=x ; 2:7ff8000000000001 3:c080290000000000 4:c0890f0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 4:c065440000000000 +result __name__=a,host=h2,job=x ; 6:0 +result __name__=a,host=h2,job=x,zone=z1 ; 6:c087a30000000000 +result __name__=a,host=h2,job=y ; 5:c086680000000000 +result __name__=b,host=h2,job=x ; 2:7ff8000000000001 3:c080290000000000 4:c0890f0000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 4:c065440000000000 +end +case limit limitk 0 without - +grid 100000 10000 3 +series __name__=a,host=h2,job=x ; 1:c061f80000000000 2:c07ada0000000000 +series __name__=a,host=h2,job=y ; 1:c048a00000000000 2:c06b2c0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; +series __name__=a,host=h1,job=x,zone=z1 ; +series __name__=a,host=h2,job=x,zone=z1 ; 0:4063140000000000 +series __name__=b,host=h2,job=x ; 1:408d090000000000 2:7e37e43c8800759c +series __name__=b,host=h1,job=y ; 0:408e0f0000000000 1:c081700000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:4076ac0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:407bda0000000000 2:c070240000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 2:407e180000000000 +end +case limit limitk NaN by __name__,job +grid 100000 10000 5 +series __name__=a,host=h1,job=y,zone=z1 ; 3:7ff8000000000001 +series __name__=a,host=h1,job=x ; 2:c08d430000000000 3:c06a4c0000000000 4:7ff8000000000001 +series __name__=b,host=h1,job=x ; 3:fff0000000000000 +series __name__=b,host=h1,job=y ; +series __name__=b,host=h2,job=x ; 0:7ff8000000000001 +series __name__=b,host=h1,job=x,zone=z2 ; 1:407d200000000000 2:c08ea90000000000 +error Parameter value is NaN +end +case limit limit_ratio 1.5 without __name__,host,zone +grid 100000 10000 5 +series __name__=a,host=h2,job=y,zone=z1 ; 4:4065840000000000 +series __name__=a,host=h1,job=x ; 2:c060180000000000 3:7ff0000000000000 +series __name__=a,host=h1,job=y ; 0:4081400000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 3:406d3c0000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 2:4078ba0000000000 +result __name__=a,host=h1,job=x ; 2:c060180000000000 3:7ff0000000000000 +result __name__=a,host=h1,job=y ; 0:4081400000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 4:4065840000000000 +result __name__=b,host=h1,job=x,zone=z2 ; 3:406d3c0000000000 +result __name__=b,host=h2,job=y,zone=z1 ; 2:4078ba0000000000 +end +case limit limitk 0 none - +grid 100000 10000 10 +series __name__=a,host=h1,job=x,zone=z1 ; 2:c05dd00000000000 5:0 7:4080880000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 1:c080550000000000 +series __name__=b,host=h2,job=y ; 5:40888d0000000000 6:4078de0000000000 7:4084d60000000000 8:4071940000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 2:404cf00000000000 +series __name__=b,host=h1,job=y ; 7:407e3c0000000000 8:40834f0000000000 +end +case limit limit_ratio -0.5 by host +grid 100000 10000 9 +series __name__=a,host=h1,job=y,zone=z1 ; 5:40824d0000000000 6:4080070000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 7:fff0000000000000 +series __name__=a,host=h1,job=x ; +series __name__=a,host=h2,job=x ; 1:40839f0000000000 2:406d2c0000000000 3:408b070000000000 4:c045400000000000 5:7e37e43c8800759c 6:c074620000000000 +series __name__=b,host=h1,job=y ; 1:405f580000000000 2:c070e20000000000 +series __name__=b,host=h2,job=x ; 4:c0800e0000000000 5:4084af0000000000 6:408f0a0000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 5:c0801e0000000000 +result __name__=a,host=h2,job=x ; 1:40839f0000000000 2:406d2c0000000000 3:408b070000000000 4:c045400000000000 5:7e37e43c8800759c 6:c074620000000000 +end +case limit limitk 1.5 without - +grid 100000 10000 9 +series __name__=a,host=h1,job=x,zone=z1 ; 6:c084e10000000000 7:40700e0000000000 8:c08e210000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 7:c076fc0000000000 8:c057680000000000 +result __name__=a,host=h1,job=x,zone=z1 ; 6:c084e10000000000 7:40700e0000000000 8:c08e210000000000 +end +case limit limit_ratio -1.5 without __name__,job +grid 100000 10000 11 +series __name__=a,host=h2,job=x ; 9:408d0c0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 1:c054980000000000 +series __name__=b,host=h2,job=x ; +series __name__=b,host=h1,job=x,zone=z1 ; 2:4051500000000000 3:7e37e43c8800759c 4:407f160000000000 5:c063700000000000 8:c08efb0000000000 9:4062640000000000 10:7ff8000000000001 +result __name__=a,host=h2,job=x ; 9:408d0c0000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 1:c054980000000000 +result __name__=b,host=h1,job=x,zone=z1 ; 2:4051500000000000 3:7e37e43c8800759c 4:407f160000000000 5:c063700000000000 8:c08efb0000000000 9:4062640000000000 10:7ff8000000000001 +end +case limit limit_ratio NaN without host +grid 100000 10000 3 +series __name__=a,host=h2,job=x ; 2:4061c00000000000 +series __name__=a,host=h1,job=x ; +series __name__=a,host=h2,job=y ; +series __name__=b,host=h1,job=x ; 2:4030800000000000 +series __name__=b,host=h2,job=y,zone=z2 ; 0:0 +series __name__=b,host=h2,job=y,zone=z1 ; 2:c075fa0000000000 +error Ratio value is NaN +end +case limit limitk 3 none - +grid 100000 10000 1 +series __name__=a,host=h1,job=x ; 0:c049000000000000 +series __name__=a,host=h1,job=y ; 0:c08e380000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 0:0 +series __name__=a,host=h2,job=y ; 0:c05c080000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 0:c0759e0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:4058200000000000 +series __name__=b,host=h2,job=y,zone=z1 ; +series __name__=b,host=h1,job=y,zone=z1 ; +series __name__=b,host=h2,job=x,zone=z1 ; 0:fff0000000000000 +series __name__=b,host=h1,job=x,zone=z2 ; +result __name__=a,host=h1,job=x ; 0:c049000000000000 +result __name__=a,host=h1,job=x,zone=z1 ; 0:0 +result __name__=a,host=h1,job=y ; 0:c08e380000000000 +end +case limit limit_ratio -0.3 by host,zone +grid 100000 10000 4 +series __name__=a,host=h2,job=x ; 3:c08e960000000000 +series __name__=a,host=h1,job=y ; +series __name__=a,host=h1,job=x ; 1:0 +series __name__=a,host=h2,job=y ; 1:c07e320000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 2:c06a800000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 2:c080d50000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 2:40699c0000000000 +series __name__=b,host=h2,job=y ; 3:c066640000000000 +series __name__=b,host=h1,job=x ; 1:c07e960000000000 3:c08ad70000000000 +result __name__=a,host=h2,job=x ; 3:c08e960000000000 +end +case limit limit_ratio 0.3 by job +grid 100000 10000 1 +series __name__=a,host=h2,job=y,zone=z1 ; +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=b,host=h2,job=y,zone=z1 ; 0:4085180000000000 +series __name__=b,host=h2,job=x,zone=z1 ; +result __name__=b,host=h2,job=y,zone=z1 ; 0:4085180000000000 +end +case limit limit_ratio 0.5 without job,zone +grid 100000 10000 3 +series __name__=a,host=h1,job=x ; 0:406a480000000000 1:c0897d0000000000 +series __name__=a,host=h2,job=y ; +series __name__=a,host=h1,job=y ; +series __name__=b,host=h1,job=x,zone=z1 ; 0:c0619c0000000000 +series __name__=b,host=h2,job=y ; 0:4051100000000000 1:c078da0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:c081c70000000000 +series __name__=b,host=h2,job=x ; 1:4078f60000000000 2:0 +result __name__=a,host=h1,job=x ; 0:406a480000000000 1:c0897d0000000000 +result __name__=b,host=h1,job=x,zone=z1 ; 0:c0619c0000000000 +result __name__=b,host=h2,job=x ; 1:4078f60000000000 2:0 +end +case limit limitk 0 none - +grid 100000 10000 12 +series __name__=a,host=h1,job=y ; 8:7ff0000000000000 +series __name__=a,host=h2,job=y ; 5:7e37e43c8800759c +series __name__=b,host=h2,job=y,zone=z1 ; 10:4066a00000000000 11:4083ce0000000000 +end +case limit limit_ratio -1 without __name__,zone +grid 100000 10000 1 +series __name__=a,host=h2,job=y ; 0:7e37e43c8800759c +series __name__=a,host=h2,job=x ; 0:c08b560000000000 +series __name__=b,host=h1,job=y ; 0:4063c40000000000 +series __name__=b,host=h2,job=y ; 0:c08a2d0000000000 +series __name__=b,host=h2,job=x ; 0:0 +result __name__=a,host=h2,job=x ; 0:c08b560000000000 +result __name__=a,host=h2,job=y ; 0:7e37e43c8800759c +result __name__=b,host=h1,job=y ; 0:4063c40000000000 +result __name__=b,host=h2,job=x ; 0:0 +result __name__=b,host=h2,job=y ; 0:c08a2d0000000000 +end +case limit limitk 1 without - +grid 100000 10000 6 +series __name__=a,host=h2,job=x ; 5:c08dfc0000000000 +series __name__=a,host=h1,job=x ; 0:404b100000000000 1:c08b410000000000 4:c0663c0000000000 +series __name__=b,host=h2,job=x ; 1:c072c60000000000 2:4085340000000000 3:c07ff20000000000 +series __name__=b,host=h1,job=x ; 4:408aab0000000000 5:4087870000000000 +result __name__=a,host=h1,job=x ; 0:404b100000000000 1:c08b410000000000 4:c0663c0000000000 +result __name__=a,host=h2,job=x ; 5:c08dfc0000000000 +result __name__=b,host=h1,job=x ; 5:4087870000000000 +result __name__=b,host=h2,job=x ; 1:c072c60000000000 2:4085340000000000 3:c07ff20000000000 +end +case limit limitk 0 none - +grid 100000 10000 6 +series __name__=a,host=h1,job=y ; +series __name__=a,host=h1,job=y,zone=z1 ; 4:7ff0000000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 4:7e37e43c8800759c +series __name__=b,host=h1,job=y ; 5:4085c70000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 2:4084e10000000000 +end +case limit limitk NaN none - +grid 100000 10000 2 +series __name__=a,host=h2,job=y ; 1:4084a00000000000 +series __name__=a,host=h2,job=x ; 1:c061540000000000 +series __name__=a,host=h1,job=y ; +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=a,host=h1,job=y,zone=z1 ; 0:c0804c0000000000 +series __name__=b,host=h1,job=y ; 1:c084760000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:c08be50000000000 +error Parameter value is NaN +end +case limit limitk 1 none - +grid 100000 10000 1 +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=a,host=h2,job=x ; 0:7ff8000000000001 +series __name__=a,host=h1,job=x,zone=z1 ; +series __name__=a,host=h1,job=y ; 0:c082570000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:c0752e0000000000 +series __name__=b,host=h2,job=x ; 0:4089460000000000 +series __name__=b,host=h1,job=y,zone=z1 ; +series __name__=b,host=h2,job=x,zone=z1 ; 0:fff0000000000000 +result __name__=a,host=h2,job=x ; 0:7ff8000000000001 +end +case limit limit_ratio 1.5 none - +grid 100000 10000 11 +series __name__=a,host=h2,job=x ; +series __name__=a,host=h2,job=y ; +series __name__=a,host=h1,job=y ; 3:4087b10000000000 4:c08f300000000000 5:c081f90000000000 6:405c500000000000 7:c08aee0000000000 +series __name__=b,host=h1,job=y ; 3:c08e540000000000 4:4067f80000000000 5:0 +series __name__=b,host=h2,job=y,zone=z2 ; 0:7ff8000000000001 1:c085370000000000 3:40750a0000000000 4:c0617c0000000000 5:c076f20000000000 6:406f040000000000 7:7ff8000000000001 9:4055280000000000 10:406b7c0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 10:c085830000000000 +result __name__=a,host=h1,job=y ; 3:4087b10000000000 4:c08f300000000000 5:c081f90000000000 6:405c500000000000 7:c08aee0000000000 +result __name__=b,host=h1,job=y ; 3:c08e540000000000 4:4067f80000000000 5:0 +result __name__=b,host=h2,job=x,zone=z1 ; 10:c085830000000000 +result __name__=b,host=h2,job=y,zone=z2 ; 0:7ff8000000000001 1:c085370000000000 3:40750a0000000000 4:c0617c0000000000 5:c076f20000000000 6:406f040000000000 7:7ff8000000000001 9:4055280000000000 10:406b7c0000000000 +end +case limit limit_ratio 0.3 by __name__,job +grid 100000 10000 5 +series __name__=a,host=h1,job=y,zone=z1 ; +series __name__=a,host=h2,job=y ; 2:4089a70000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 2:40723c0000000000 3:c086f30000000000 4:4077d20000000000 +series __name__=a,host=h1,job=x ; 1:c0804b0000000000 2:0 +series __name__=b,host=h2,job=x ; 3:c082f40000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 4:4086160000000000 +series __name__=b,host=h1,job=x ; 3:7ff0000000000000 4:c070440000000000 +result __name__=b,host=h1,job=x ; 3:7ff0000000000000 4:c070440000000000 +result __name__=b,host=h2,job=x ; 3:c082f40000000000 +end +case limit limit_ratio -1.5 none - +grid 100000 10000 10 +series __name__=a,host=h2,job=x,zone=z1 ; 4:4052480000000000 5:c0896e0000000000 6:4068900000000000 7:c083a50000000000 +series __name__=b,host=h2,job=x ; 0:4083640000000000 1:c08a6b0000000000 2:405a480000000000 3:c08c510000000000 4:c085420000000000 5:4072a40000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:4075800000000000 1:c06c7c0000000000 2:4089d70000000000 3:fff0000000000000 4:c070f60000000000 +series __name__=b,host=h2,job=y ; 1:4085a30000000000 2:4087760000000000 3:7e37e43c8800759c +result __name__=a,host=h2,job=x,zone=z1 ; 4:4052480000000000 5:c0896e0000000000 6:4068900000000000 7:c083a50000000000 +result __name__=b,host=h2,job=x ; 0:4083640000000000 1:c08a6b0000000000 2:405a480000000000 3:c08c510000000000 4:c085420000000000 5:4072a40000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 0:4075800000000000 1:c06c7c0000000000 2:4089d70000000000 3:fff0000000000000 4:c070f60000000000 +result __name__=b,host=h2,job=y ; 1:4085a30000000000 2:4087760000000000 3:7e37e43c8800759c +end +case limit limit_ratio 0.9 by job +grid 100000 10000 12 +series __name__=a,host=h1,job=y ; 5:c069ec0000000000 6:7ff0000000000000 7:c041900000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 11:c07a720000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:40727c0000000000 3:406a940000000000 +series __name__=b,host=h1,job=y ; 4:40713e0000000000 5:c072660000000000 6:7e37e43c8800759c 7:7ff8000000000001 8:c072040000000000 +result __name__=a,host=h1,job=y ; 5:c069ec0000000000 6:7ff0000000000000 7:c041900000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 11:c07a720000000000 +result __name__=b,host=h1,job=y ; 4:40713e0000000000 5:c072660000000000 6:7e37e43c8800759c 7:7ff8000000000001 8:c072040000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 1:40727c0000000000 3:406a940000000000 +end +case limit limitk -1 none - +grid 100000 10000 5 +series __name__=a,host=h1,job=x,zone=z1 ; 1:4088e80000000000 2:40876c0000000000 3:c0878e0000000000 4:408b6e0000000000 +series __name__=a,host=h1,job=y ; 3:7ff8000000000001 +series __name__=a,host=h1,job=y,zone=z1 ; 1:407a980000000000 2:c04a900000000000 +series __name__=b,host=h1,job=y ; 2:405e280000000000 +series __name__=b,host=h1,job=x,zone=z1 ; +end +case limit limitk 0 without __name__,zone +grid 100000 10000 8 +series __name__=a,host=h2,job=x,zone=z1 ; 3:c087530000000000 4:408cad0000000000 +series __name__=a,host=h2,job=x ; 1:4035600000000000 2:40889f0000000000 3:4071880000000000 4:c0829f0000000000 5:406ae80000000000 +series __name__=a,host=h2,job=y ; 2:407f3c0000000000 3:c089c30000000000 4:c04e000000000000 5:7e37e43c8800759c 6:406f600000000000 7:c07d7e0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 0:4084450000000000 1:407f080000000000 +series __name__=b,host=h1,job=x ; 5:405e680000000000 6:4076a80000000000 7:fff0000000000000 +series __name__=b,host=h2,job=y ; 2:c021c00000000000 4:c084650000000000 5:c051c00000000000 6:c07c180000000000 7:4050c80000000000 +end +case limit limit_ratio 0.5 by host,zone +grid 100000 10000 12 +series __name__=a,host=h2,job=y,zone=z1 ; 7:4087260000000000 10:407c720000000000 +series __name__=a,host=h2,job=x ; 10:40797e0000000000 +series __name__=b,host=h2,job=y ; 11:c07f420000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 7:4087260000000000 10:407c720000000000 +end +case limit limit_ratio 0.9 none - +grid 100000 10000 10 +series __name__=a,host=h1,job=x ; +series __name__=b,host=h1,job=x ; 6:c08dd70000000000 7:40753a0000000000 8:405d100000000000 9:4069f00000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 1:c087a90000000000 2:c069640000000000 3:c087800000000000 4:408b400000000000 5:407d920000000000 6:c083600000000000 7:c07d3a0000000000 8:c081c90000000000 9:406c940000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 6:4087230000000000 7:c060d40000000000 8:408b6a0000000000 9:40842a0000000000 +result __name__=b,host=h1,job=x ; 6:c08dd70000000000 7:40753a0000000000 8:405d100000000000 9:4069f00000000000 +result __name__=b,host=h1,job=x,zone=z2 ; 1:c087a90000000000 2:c069640000000000 3:c087800000000000 4:408b400000000000 5:407d920000000000 6:c083600000000000 7:c07d3a0000000000 8:c081c90000000000 9:406c940000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 6:4087230000000000 7:c060d40000000000 8:408b6a0000000000 9:40842a0000000000 +end +case limit limitk -1 without job +grid 100000 10000 5 +series __name__=a,host=h1,job=x ; 3:c07e780000000000 4:c07fc80000000000 +series __name__=a,host=h2,job=x ; 1:c052000000000000 +series __name__=a,host=h1,job=y ; 1:c06e580000000000 2:408f0f0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 1:c07d7e0000000000 2:4063a40000000000 +series __name__=b,host=h1,job=x ; 3:c08bb80000000000 +series __name__=b,host=h1,job=y,zone=z1 ; +end +case limit limit_ratio -0.5 without __name__,zone +grid 100000 10000 8 +series __name__=a,host=h1,job=y,zone=z1 ; 3:c08abd0000000000 4:c08a940000000000 +series __name__=a,host=h1,job=y ; 0:4087470000000000 2:4088490000000000 3:4076f40000000000 +series __name__=b,host=h1,job=y ; 5:4087230000000000 +series __name__=b,host=h2,job=x ; 2:0 4:4045300000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 3:7ff0000000000000 5:408b780000000000 7:c085310000000000 +result __name__=a,host=h1,job=y ; 0:4087470000000000 2:4088490000000000 3:4076f40000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 3:7ff0000000000000 5:408b780000000000 7:c085310000000000 +end +case limit limitk 10 none - +grid 100000 10000 9 +series __name__=a,host=h1,job=x ; 3:c07f000000000000 4:c087f90000000000 5:407d620000000000 6:405f680000000000 7:4082420000000000 +series __name__=a,host=h2,job=x ; 1:406a880000000000 2:40872e0000000000 3:c071880000000000 4:40768c0000000000 +series __name__=a,host=h1,job=y ; 7:c03a800000000000 8:c0851c0000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 7:4025800000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 8:c063d00000000000 +series __name__=b,host=h1,job=x ; 6:c073c20000000000 7:c06aec0000000000 8:c080330000000000 +result __name__=a,host=h1,job=x ; 3:c07f000000000000 4:c087f90000000000 5:407d620000000000 6:405f680000000000 7:4082420000000000 +result __name__=a,host=h1,job=y ; 7:c03a800000000000 8:c0851c0000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 7:4025800000000000 +result __name__=a,host=h2,job=x ; 1:406a880000000000 2:40872e0000000000 3:c071880000000000 4:40768c0000000000 +result __name__=b,host=h1,job=x ; 6:c073c20000000000 7:c06aec0000000000 8:c080330000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 8:c063d00000000000 +end +case limit limit_ratio 0 without host +grid 100000 10000 10 +series __name__=a,host=h2,job=x,zone=z1 ; 8:40820b0000000000 +series __name__=a,host=h2,job=x ; 2:c082b20000000000 +series __name__=a,host=h1,job=x ; +series __name__=b,host=h2,job=x,zone=z1 ; 4:c068080000000000 5:4089be0000000000 +series __name__=b,host=h2,job=y ; 1:407c9e0000000000 2:408a140000000000 3:40848b0000000000 +series __name__=b,host=h2,job=x ; 9:40754e0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 5:4071720000000000 6:c085190000000000 7:c084510000000000 8:c082160000000000 +end +case limit limitk 10 none - +grid 100000 10000 6 +series __name__=a,host=h1,job=x,zone=z1 ; 3:40854d0000000000 4:4080900000000000 +series __name__=a,host=h2,job=y ; +series __name__=a,host=h1,job=x ; 1:c067280000000000 2:4066d00000000000 +series __name__=b,host=h2,job=y ; 3:0 +series __name__=b,host=h1,job=x ; 0:c07fc80000000000 +result __name__=a,host=h1,job=x ; 1:c067280000000000 2:4066d00000000000 +result __name__=a,host=h1,job=x,zone=z1 ; 3:40854d0000000000 4:4080900000000000 +result __name__=b,host=h1,job=x ; 0:c07fc80000000000 +result __name__=b,host=h2,job=y ; 3:0 +end +case limit limit_ratio -0.3 none - +grid 100000 10000 8 +series __name__=a,host=h2,job=y ; 7:0 +series __name__=a,host=h1,job=y,zone=z1 ; +series __name__=a,host=h2,job=x ; 3:408f0b0000000000 +series __name__=b,host=h1,job=y ; 2:c08dc40000000000 +series __name__=b,host=h2,job=x ; 3:4076540000000000 4:c088df0000000000 5:c059a80000000000 +series __name__=b,host=h2,job=x,zone=z2 ; 4:c08cd70000000000 5:4089ad0000000000 +result __name__=a,host=h2,job=x ; 3:408f0b0000000000 +end +case limit limit_ratio -1 without host,job,zone +grid 100000 10000 6 +series __name__=a,host=h2,job=x ; 5:c08ae60000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 1:c055700000000000 2:0 +series __name__=a,host=h1,job=y ; +series __name__=a,host=h1,job=x ; 2:fff0000000000000 +series __name__=a,host=h2,job=y ; 3:40736a0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; +result __name__=a,host=h1,job=x ; 2:fff0000000000000 +result __name__=a,host=h1,job=x,zone=z1 ; 1:c055700000000000 2:0 +result __name__=a,host=h2,job=x ; 5:c08ae60000000000 +result __name__=a,host=h2,job=y ; 3:40736a0000000000 +end +case limit limit_ratio 1.5 without zone +grid 100000 10000 4 +series __name__=a,host=h2,job=y ; 3:c0857a0000000000 +series __name__=a,host=h1,job=x ; 2:c084060000000000 +series __name__=a,host=h2,job=x ; 3:40854f0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 1:4076840000000000 2:c06f540000000000 3:0 +series __name__=b,host=h1,job=x ; 0:c08dcc0000000000 1:c07f840000000000 2:404d400000000000 +series __name__=b,host=h2,job=x ; 2:c054900000000000 3:7ff0000000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 1:4086660000000000 2:c08e020000000000 +series __name__=b,host=h2,job=y ; +series __name__=b,host=h2,job=y,zone=z1 ; 3:c083a30000000000 +result __name__=a,host=h1,job=x ; 2:c084060000000000 +result __name__=a,host=h2,job=x ; 3:40854f0000000000 +result __name__=a,host=h2,job=y ; 3:c0857a0000000000 +result __name__=b,host=h1,job=x ; 0:c08dcc0000000000 1:c07f840000000000 2:404d400000000000 +result __name__=b,host=h1,job=x,zone=z1 ; 1:4086660000000000 2:c08e020000000000 +result __name__=b,host=h2,job=x ; 2:c054900000000000 3:7ff0000000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 1:4076840000000000 2:c06f540000000000 3:0 +result __name__=b,host=h2,job=y,zone=z1 ; 3:c083a30000000000 +end +case limit limit_ratio NaN without __name__,job +grid 100000 10000 10 +series __name__=a,host=h1,job=y ; 2:4079280000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 3:c085cc0000000000 4:c08ef40000000000 5:c05d800000000000 6:c08f260000000000 7:c06bfc0000000000 +series __name__=a,host=h2,job=y ; 1:407fec0000000000 2:c069a00000000000 +series __name__=b,host=h2,job=x ; 4:4075d60000000000 5:4070080000000000 +series __name__=b,host=h1,job=x ; 3:c07a480000000000 5:7ff8000000000001 +series __name__=b,host=h1,job=y,zone=z1 ; 1:7e37e43c8800759c 2:c05ab00000000000 3:c0798c0000000000 4:c072160000000000 5:40835a0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 5:c060d40000000000 6:c085260000000000 7:c071820000000000 +series __name__=b,host=h2,job=y ; 6:4086fa0000000000 7:c063bc0000000000 8:406ab40000000000 9:c086160000000000 +error Ratio value is NaN +end +case limit limit_ratio -1 without __name__,zone +grid 100000 10000 10 +series __name__=a,host=h1,job=y,zone=z1 ; 1:c08a660000000000 2:c082d60000000000 4:c051500000000000 5:406d040000000000 6:7ff8000000000001 7:c0612c0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 3:0 5:408b220000000000 6:c07e5e0000000000 +series __name__=b,host=h1,job=y ; 1:7e37e43c8800759c 2:4081920000000000 4:407ed40000000000 5:4067000000000000 7:c086ea0000000000 8:c084630000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 0:7ff8000000000001 2:c0856a0000000000 3:c0759e0000000000 4:c074200000000000 5:7ff8000000000001 6:7ff8000000000001 7:c084a10000000000 8:c088830000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 1:c08a660000000000 2:c082d60000000000 4:c051500000000000 5:406d040000000000 6:7ff8000000000001 7:c0612c0000000000 +result __name__=b,host=h1,job=y ; 1:7e37e43c8800759c 2:4081920000000000 4:407ed40000000000 5:4067000000000000 7:c086ea0000000000 8:c084630000000000 +result __name__=b,host=h1,job=y,zone=z1 ; 3:0 5:408b220000000000 6:c07e5e0000000000 +result __name__=b,host=h1,job=y,zone=z2 ; 0:7ff8000000000001 2:c0856a0000000000 3:c0759e0000000000 4:c074200000000000 5:7ff8000000000001 6:7ff8000000000001 7:c084a10000000000 8:c088830000000000 +end +case limit limit_ratio 1.5 by __name__,job +grid 100000 10000 1 +series __name__=a,host=h1,job=x ; 0:407f8a0000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:7ff8000000000001 +series __name__=a,host=h1,job=y ; 0:7ff0000000000000 +series __name__=a,host=h2,job=y ; 0:fff0000000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:c072320000000000 +series __name__=b,host=h1,job=y,zone=z1 ; +series __name__=b,host=h2,job=y ; 0:c067b80000000000 +result __name__=a,host=h1,job=x ; 0:407f8a0000000000 +result __name__=a,host=h1,job=y ; 0:7ff0000000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 0:7ff8000000000001 +result __name__=a,host=h2,job=y ; 0:fff0000000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 0:c072320000000000 +result __name__=b,host=h2,job=y ; 0:c067b80000000000 +end +case limit limitk 1 none - +grid 100000 10000 12 +series __name__=a,host=h2,job=y,zone=z1 ; 0:403a200000000000 1:408af00000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 8:c066740000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 6:c0633c0000000000 7:40758a0000000000 +series __name__=b,host=h2,job=x,zone=z2 ; +series __name__=b,host=h2,job=y,zone=z1 ; 0:408e220000000000 +series __name__=b,host=h2,job=y ; 0:408ce30000000000 1:c07f5e0000000000 2:c076880000000000 3:7ff0000000000000 4:c08a240000000000 5:fff0000000000000 7:4081450000000000 8:4061400000000000 9:407cec0000000000 +series __name__=b,host=h2,job=x ; 1:c073280000000000 2:4072240000000000 4:c05bc00000000000 5:408ab60000000000 6:40810e0000000000 9:c08cfc0000000000 10:40749e0000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 8:c066740000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 0:403a200000000000 1:408af00000000000 +result __name__=b,host=h2,job=x ; 10:40749e0000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 6:c0633c0000000000 7:40758a0000000000 +result __name__=b,host=h2,job=y ; 2:c076880000000000 3:7ff0000000000000 4:c08a240000000000 5:fff0000000000000 9:407cec0000000000 +end +case limit limitk 1 none - +grid 100000 10000 7 +series __name__=a,host=h2,job=x ; 0:7ff8000000000001 1:4088b50000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:408e740000000000 3:407a740000000000 4:7ff8000000000001 5:408f0d0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 4:7e37e43c8800759c +series __name__=a,host=h1,job=x ; 5:c0815e0000000000 6:40700a0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 1:c081b20000000000 +series __name__=b,host=h1,job=x ; 1:40724c0000000000 +result __name__=a,host=h1,job=x ; 6:40700a0000000000 +result __name__=a,host=h2,job=x ; 0:7ff8000000000001 1:4088b50000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 3:407a740000000000 4:7ff8000000000001 5:408f0d0000000000 +end diff --git a/src/promql/src/select/tests.rs b/src/promql/src/select/tests.rs index 568ed4c4b5c..0cc2763bf64 100644 --- a/src/promql/src/select/tests.rs +++ b/src/promql/src/select/tests.rs @@ -24,14 +24,16 @@ use datatypes::series::time::{EvalGrid, GridRange, GridSpec, TimeAxis}; use datatypes::series::{Label, MetricName}; use super::{ - Grouping, LabelMatcher, MatchOp, SortOrder, absent, absent_labels, natural_less, scalar, - sort_instant, topk, + Grouping, LabelMatcher, MatchOp, SortOrder, absent, absent_labels, limit_ratio, limitk, + natural_less, sample_offset, scalar, sort_instant, topk, }; use crate::golden::fold_pieces; use crate::grid_series::reference::{ - Dense, Labels, Points, assert_pieces_eq, assert_result_eq, piece_ranges, run_ranges, - sparse_series, + Dense, Labels, OwnedHistogram, Points, assert_pieces_eq, assert_result_eq, piece_ranges, + run_ranges, sparse_series, }; +use crate::grid_series::{GridSample, GridSeriesBuilder}; +use crate::histogram_eval::float_histogram::FloatHistogram; fn schema(points: u64, fields: usize) -> SeriesSchema { SeriesSchema { @@ -117,42 +119,20 @@ fn names(list: &str) -> Vec> { /// header of `prometheus_cases.txt`. #[test] fn select_operators_match_prometheus() { - let text = include_str!("prometheus_cases.txt"); - let mut checked = 0; - for case in text.split("end\n").filter(|case| case.contains("case ")) { - let lines: Vec<&str> = case.lines().filter(|line| !line.starts_with('#')).collect(); - let spec: Vec<&str> = lines[0].split_whitespace().skip(1).collect(); - let points: usize = lines[1].split_whitespace().nth(3).unwrap().parse().unwrap(); - let schema = schema(points as u64, 1); - let mut inputs = Vec::new(); - let mut expected: BTreeMap = BTreeMap::new(); - for line in &lines[2..] { - let (kind, rest) = line.split_once(' ').unwrap(); - let (labels, values) = rest.split_once(" ;").unwrap(); - match kind { - "series" => inputs.push((metric(labels), dense(points, values))), - "result" => { - expected.insert(labels.to_string(), dense(points, values)); - } - other => panic!("unexpected line {other} in {case}"), - } - } - let series: Vec = inputs - .iter() - .filter_map(|(metric, dense)| build(&schema, metric.clone(), dense)) - .collect(); - - let actual: Vec = match spec[0] { + let checked = check_cases( + include_str!("prometheus_cases.txt"), + |spec, schema, series| match spec[0] { "topk" => { - let grouping = match spec[3] { - "without" => Grouping::Without(names(spec[4])), - "by" => Grouping::By(names(spec[4])), - _ => Grouping::By(Vec::new()), - }; let k: f64 = spec[2].parse().unwrap(); - topk(k, spec[1] == "topk", &grouping, &schema, &series).unwrap() + topk( + k, + spec[1] == "topk", + &grouping(spec[3], spec[4]), + schema, + series, + ) } - "scalar" => vec![scalar(&schema, &series).unwrap()], + "scalar" => Ok(vec![scalar(schema, series).unwrap()]), "absent" => { let matchers: Vec = spec .get(1) @@ -189,12 +169,156 @@ fn select_operators_match_prometheus() { }) .cloned() .collect(); - absent(&schema, &selected, absent_labels(&matchers).unwrap()) + Ok(absent(schema, &selected, absent_labels(&matchers).unwrap()) .unwrap() .into_iter() - .collect() + .collect()) } other => panic!("unknown case {other}"), + }, + ); + assert!(checked > 200, "{checked} result series checked"); +} + +/// `limitk` and `limit_ratio` evaluated by the Prometheus v3.15.0 engine; see the header of +/// `limit_cases.txt`. +#[test] +fn limit_operators_match_prometheus() { + let checked = check_cases(include_str!("limit_cases.txt"), |spec, schema, series| { + let param: f64 = spec[2].parse().unwrap(); + match spec[1] { + "limitk" => limitk(param, &grouping(spec[3], spec[4]), schema, series), + _ => limit_ratio(param, schema, series), + } + }); + assert!(checked > 200, "{checked} result series checked"); +} + +/// The labels of the fixtures are short; these need the long length prefix of `stringlabels`. +/// Prometheus' offsets were computed with promql-compat `cmd/narthex-golden-labelhash`. +#[test] +fn sample_offset_hashes_labels_like_prometheus() { + let cases = [ + ("__name__=a,job=x".to_string(), 0x3fe1c2f8b3f15aa8), + ( + format!("__name__=a,long={}", "v".repeat(300)), + 0x3fca51ed01e04434, + ), + ( + format!( + "__name__=a,{}={},zone={}", + "n".repeat(254), + "v".repeat(255), + "z".repeat(70000) + ), + 0x3fc3bf72b8300ba3, + ), + // A Prometheus label set has no empty value, so an empty label is no label. + ("__name__=a,empty=,job=x".to_string(), 0x3fe1c2f8b3f15aa8), + ]; + for (labels, offset) in cases { + assert_eq!(sample_offset(&metric(&labels)).to_bits(), offset); + } +} + +/// `limitk` and `limit_ratio` select series, so histogram samples pass through, and +/// `limit_ratio` keeps every field of the series it keeps. +#[test] +fn limit_operators_keep_histogram_samples() { + let histogram = + OwnedHistogram::parse("0/0/0/3ff0000000000000/3ff0000000000000/0/1_1/3ff0000000000000///"); + let sample = || { + GridSample::Histogram(Box::new( + FloatHistogram::try_from_view(&histogram.view()).unwrap(), + )) + }; + let kinds = |series: &Series, field: usize| -> Vec<(usize, &str)> { + let samples = &series.fields.as_slice()[field]; + series + .time + .positions() + .map(|(point, row)| { + let kind = match samples.sample(row) { + SampleRef::Missing => "missing", + SampleRef::Float(_) => "float", + SampleRef::Histogram(_) => "histogram", + }; + (point, kind) + }) + .collect() + }; + + let two_fields = schema(3, 2); + let mut builder = GridSeriesBuilder::try_new(Arc::new(two_fields.clone())).unwrap(); + builder + .push_samples(0, &[Some(GridSample::Float(1.0)), Some(sample())]) + .unwrap(); + builder.push_samples(2, &[None, Some(sample())]).unwrap(); + let series = builder.finish(metric("__name__=a")).unwrap().unwrap(); + let kept = limit_ratio(1.0, &two_fields, std::slice::from_ref(&series)).unwrap(); + assert_eq!(kept.len(), 1); + assert_eq!(kinds(&kept[0], 0), [(0, "float"), (2, "missing")]); + assert_eq!(kinds(&kept[0], 1), [(0, "histogram"), (2, "histogram")]); + + let one_field = schema(3, 1); + let mut builder = GridSeriesBuilder::try_new(Arc::new(one_field.clone())).unwrap(); + builder.push_samples(1, &[Some(sample())]).unwrap(); + let series = builder.finish(metric("__name__=a")).unwrap().unwrap(); + let kept = limitk(1.0, &Grouping::By(Vec::new()), &one_field, &[series]).unwrap(); + assert_eq!(kept.len(), 1); + assert_eq!(kinds(&kept[0], 0), [(1, "histogram")]); +} + +fn grouping(kind: &str, labels: &str) -> Grouping { + match kind { + "without" => Grouping::Without(names(labels)), + "by" => Grouping::By(names(labels)), + _ => Grouping::By(Vec::new()), + } +} + +/// Evaluates each case of a fixture with `eval` and returns how many result series matched; a +/// case with an `error` line must fail with that message. +fn check_cases( + text: &str, + eval: impl Fn(&[&str], &SeriesSchema, &[Series]) -> Result, DataFusionError>, +) -> usize { + let mut checked = 0; + for case in text.split("end\n").filter(|case| case.contains("case ")) { + let lines: Vec<&str> = case.lines().filter(|line| !line.starts_with('#')).collect(); + let spec: Vec<&str> = lines[0].split_whitespace().skip(1).collect(); + let points: usize = lines[1].split_whitespace().nth(3).unwrap().parse().unwrap(); + let schema = schema(points as u64, 1); + let mut inputs = Vec::new(); + let mut expected: BTreeMap = BTreeMap::new(); + let mut error = None; + for line in &lines[2..] { + if let Some(message) = line.strip_prefix("error ") { + error = Some(message); + continue; + } + let (kind, rest) = line.split_once(' ').unwrap(); + let (labels, values) = rest.split_once(" ;").unwrap(); + match kind { + "series" => inputs.push((metric(labels), dense(points, values))), + "result" => { + expected.insert(labels.to_string(), dense(points, values)); + } + other => panic!("unexpected line {other} in {case}"), + } + } + let series: Vec = inputs + .iter() + .filter_map(|(metric, dense)| build(&schema, metric.clone(), dense)) + .collect(); + + let actual = match (eval(&spec, &schema, &series), error) { + (Ok(actual), None) => actual, + (Err(actual), Some(expected)) => { + assert_eq!(actual.message(), expected, "{case}"); + continue; + } + (actual, expected) => panic!("{case}\ngot {actual:?}, expected error {expected:?}"), }; // A result arrives as one series over the runs of valued positions; the fixtures pin the @@ -213,7 +337,7 @@ fn select_operators_match_prometheus() { checked += 1; } } - assert!(checked > 200, "{checked} result series checked"); + checked } /// The fixture's label rendering: `name=value` pairs in name order, `-` when empty. diff --git a/src/promql/src/vector_match.rs b/src/promql/src/vector_match.rs index 5e49080fb87..eab40a3f64e 100644 --- a/src/promql/src/vector_match.rs +++ b/src/promql/src/vector_match.rs @@ -25,12 +25,12 @@ use std::collections::{HashMap, HashSet}; use std::sync::Arc; use datafusion::error::{DataFusionError, Result}; -use datatypes::series::MetricName; use datatypes::series::histogram::{CounterResetHint, HistogramView}; use datatypes::series::samples::{RowCursor, SampleRef, Series, SeriesSchema}; use datatypes::series::time::{EvalGrid, GridRunPair, TimeAxis}; +use datatypes::series::{Label, MetricName}; -use crate::grid_series::{GridSample, GridSeriesBuilder, METADATA_LABELS}; +use crate::grid_series::{GridSample, GridSeriesBuilder, METADATA_LABELS, external, owned}; use crate::histogram_eval::float_histogram::FloatHistogram; #[cfg(test)] @@ -110,8 +110,30 @@ pub struct BinaryMatching { pub return_bool: bool, pub labels: MatchingLabels, pub cardinality: Cardinality, + pub fill: FillValues, } +/// The values of `fill`, `fill_left` and `fill_right`, which stand in for a sample that has no +/// match on the other side. +/// +/// Prometheus applies them after it swaps the operands of `group_right`, so there `fill_left` +/// stands in for a missing right-hand sample and `fill_right` for a missing left-hand one. +#[derive(Clone, Copy, Debug, Default)] +pub struct FillValues { + pub lhs: Option, + pub rhs: Option, +} + +// Compared by bits: a NaN fill equals itself, and `fill(-0)` differs from `fill(0)` (`1 / fill`). +impl PartialEq for FillValues { + fn eq(&self, other: &Self) -> bool { + let bits = |value: Option| value.map(f64::to_bits); + bits(self.lhs) == bits(other.lhs) && bits(self.rhs) == bits(other.rhs) + } +} + +impl Eq for FillValues {} + /// A PromQL set operator between two instant vectors. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum SetOp { @@ -135,7 +157,8 @@ pub fn binary_output_schema(lhs: &SeriesSchema, rhs: &SeriesSchema) -> Result (rhs, lhs, &include[..], true), }; let points = grid.timestamps().len(); - // Prometheus short-circuits a point where either side is empty, before any check. - let both_present: Vec = lhs + let fill = matching.fill; + // Prometheus short-circuits a point where either side is empty, before any check; with a fill + // value only a point where both are empty. + let filling = fill.lhs.is_some() || fill.rhs.is_some(); + let evaluated: Vec = lhs .presence(points) .into_iter() .zip(rhs.presence(points)) - .map(|(lhs, rhs)| lhs && rhs) + .map(|(lhs, rhs)| if filling { lhs || rhs } else { lhs && rhs }) .collect(); let one_groups = group(one, &matching.labels); let mut one_duplicate: Option<(usize, &GroupKey)> = None; for (key, members) in &one_groups { - if let Some(point) = overlap(one, members, |point| both_present[point]) + if let Some(point) = overlap(one, members, |point| evaluated[point]) && one_duplicate.is_none_or(|(first, _)| point < first) { one_duplicate = Some((point, key)); @@ -193,23 +219,23 @@ fn binary_field( } let drop_name = !matching.op.is_comparison() || matching.return_bool; - let mut results = Results::default(); - let group_keys: Vec<&GroupKey> = one_groups.keys().collect(); - let group_ids: HashMap<&GroupKey, usize> = group_keys - .iter() - .enumerate() - .map(|(id, key)| (*key, id)) - .collect(); - // One-to-one: a match group may be matched once per point; Prometheus counts a filtered - // comparison as a match too, but not an operation that failed. - let mut matched: HashSet<(usize, usize)> = HashSet::new(); - let mut implicit_many_to_one: Option<(usize, &GroupKey)> = None; + let mut pairs = Pairs { + matching, + one_is_left, + results: Results::default(), + group_keys: Vec::new(), + group_ids: HashMap::new(), + matched: (matching.cardinality == Cardinality::OneToOne || fill.lhs.is_some()) + .then(HashSet::new), + implicit_many_to_one: None, + }; for (many_index, many_series) in many.series.iter().enumerate() { let key = group_key(&many_series.metric, &matching.labels); - let Some(candidates) = one_groups.get(&key) else { + let candidates = one_groups.get(&key).map_or(&[][..], Vec::as_slice); + if candidates.is_empty() && fill.rhs.is_none() { continue; - }; - let group_id = group_ids[&key]; + } + let group = pairs.group_id(&key); for &one_index in candidates { let metric = result_metric( &many_series.metric, @@ -237,36 +263,65 @@ fn binary_field( .at(pair.other_row + offset) .expect("a row never goes back"), ); - if matches!(many_value, SampleRef::Missing) - || matches!(one_value, SampleRef::Missing) - { - continue; - } - let (lhs_value, rhs_value) = if one_is_left { - (one_value, many_value) - } else { - (many_value, one_value) - }; - let Some((result, keep)) = elem_binop(matching.op, lhs_value, rhs_value)? - else { - continue; - }; - if matching.cardinality == Cardinality::OneToOne - && !matched.insert((group_id, point)) - && implicit_many_to_one.is_none_or(|(first, _)| point < first) - { - implicit_many_to_one = Some((point, group_keys[group_id])); - } - let value = if matching.return_bool { - Some(GridSample::Float(if keep { 1.0 } else { 0.0 })) - } else { - keep.then_some(result) - }; - results.insert(&metric, group_id, point, value); + pairs.apply(group, &metric, point, many_value, one_value)?; + } + } + } + if let Some(value) = fill.rhs { + let metric = result_metric( + &many_series.metric, + &metric_of(&key)?, + matching, + include, + drop_name, + )?; + let mut cursor = many.cursor(many_index); + let mut candidate_cursors: Vec> = + candidates.iter().map(|&index| one.cursor(index)).collect(); + for (point, row) in many.positions(many_index) { + let sample = cursor.at(row).expect("a row never goes back"); + let matched = candidates + .iter() + .zip(&mut candidate_cursors) + .any(|(&index, cursor)| one.present(index, point, cursor)); + if !matched { + pairs.apply(group, &metric, point, sample, SampleRef::Float(value))?; } } } } + // Prometheus fills the many side after every match of the step, for the samples of the one + // side that no operation matched. + if let Some(value) = fill.lhs { + for (one_index, one_series) in one.series.iter().enumerate() { + let key = group_key(&one_series.metric, &matching.labels); + let group = pairs.group_id(&key); + let metric = result_metric( + &metric_of(&key)?, + &one_series.metric, + matching, + include, + drop_name, + )?; + let mut cursor = one.cursor(one_index); + for (point, row) in one.positions(one_index) { + if !pairs + .matched + .as_ref() + .is_some_and(|matched| matched.contains(&(group, point))) + { + let sample = cursor.at(row).expect("a row never goes back"); + pairs.apply(group, &metric, point, SampleRef::Float(value), sample)?; + } + } + } + } + let Pairs { + mut results, + group_keys, + implicit_many_to_one, + .. + } = pairs; // Prometheus fails at the first failing step. Within a step it checks the one side, then // matches, and only after the operator checks that result label sets are unique. if let Some((point, key)) = one_duplicate { @@ -283,7 +338,8 @@ fn binary_field( ), )); } - if let Some((point, key)) = implicit_many_to_one { + if let Some((point, group)) = implicit_many_to_one { + let key = &group_keys[group]; errors.push(( point, 1, @@ -319,6 +375,89 @@ fn binary_field( Ok(results) } +/// The matched pairs of one field and the state Prometheus checks them against. +struct Pairs<'a> { + matching: &'a BinaryMatching, + one_is_left: bool, + results: Results, + group_keys: Vec, + group_ids: HashMap, + /// The match groups an operation matched at a point, kept where Prometheus consults them: + /// one-to-one matching, and filling the many side. A filtered comparison counts as a match, + /// an operation that failed does not. + matched: Option>, + implicit_many_to_one: Option<(usize, usize)>, +} + +impl Pairs<'_> { + /// The id of the match group `key`, which stands for it in `matched` and in the results. + fn group_id(&mut self, key: &GroupKey) -> usize { + if let Some(&id) = self.group_ids.get(key) { + return id; + } + let id = self.group_keys.len(); + self.group_keys.push(key.clone()); + self.group_ids.insert(key.clone(), id); + id + } + + /// Applies the operator to a sample of each side at `point`; a missing sample is no pair. + fn apply( + &mut self, + group: usize, + metric: &MetricName, + point: usize, + many_value: SampleRef<'_>, + one_value: SampleRef<'_>, + ) -> Result<()> { + if matches!(many_value, SampleRef::Missing) || matches!(one_value, SampleRef::Missing) { + return Ok(()); + } + let (lhs_value, rhs_value) = if self.one_is_left { + (one_value, many_value) + } else { + (many_value, one_value) + }; + let Some((result, keep)) = elem_binop(self.matching.op, lhs_value, rhs_value)? else { + return Ok(()); + }; + // One-to-one: a match group may be matched once per point. + if let Some(matched) = &mut self.matched + && !matched.insert((group, point)) + && self.matching.cardinality == Cardinality::OneToOne + && self + .implicit_many_to_one + .is_none_or(|(first, _)| point < first) + { + self.implicit_many_to_one = Some((point, group)); + } + let value = if self.matching.return_bool { + Some(GridSample::Float(if keep { 1.0 } else { 0.0 })) + } else { + keep.then_some(result) + }; + self.results.insert(metric, group, point, value); + Ok(()) + } +} + +/// The labels Prometheus gives a fill sample: the match group of the sample it pairs with. +fn metric_of(key: &GroupKey) -> Result { + let mut name = None; + let mut labels = Vec::with_capacity(key.len()); + for (label, value) in key { + if &**label == "__name__" { + name = Some(value.clone()); + } else { + labels.push(Label { + name: label.clone(), + value: value.clone(), + }); + } + } + MetricName::try_new(name, labels).map_err(external) +} + fn earliest_error(errors: Vec<(usize, u8, String)>) -> Result<()> { match errors .into_iter() @@ -687,17 +826,6 @@ impl<'a> Operand<'a> { } } -/// `sample` as an owned value; `None` when missing. -fn owned(sample: SampleRef<'_>) -> Result> { - Ok(match sample { - SampleRef::Missing => None, - SampleRef::Float(value) => Some(GridSample::Float(value)), - SampleRef::Histogram(view) => Some(GridSample::Histogram(Box::new( - FloatHistogram::try_from_view(&view)?, - ))), - }) -} - /// Prometheus `vectorElemBinop` over present samples: the value and whether to keep it, or /// `None` when Prometheus reports the pair as an annotation and skips it without counting the /// match: an operator the sample types do not support, or an addition or subtraction of diff --git a/src/promql/src/vector_match/fill_cases.txt b/src/promql/src/vector_match/fill_cases.txt new file mode 100644 index 00000000000..3d6213c2c89 --- /dev/null +++ b/src/promql/src/vector_match/fill_cases.txt @@ -0,0 +1,2021 @@ +# Generated by promql-compat cmd/narthex-golden-vector built for amd64 (Prometheus v3.15.0 +# engine, seed 1, 200 cases per kind, -experimental fill). Each case lists its operation, the grid, the +# input series and either the result series or the error. Points are `grid index:hex bits`. +case binary - false ignoring zone one - 1 1 +grid 100000 10000 6 +series __name__=a,host=h2,job=y ; 1:7ff8000000000001 +series __name__=a,host=h1,job=y,zone=z1 ; 5:c079dc0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 1:4078980000000000 2:406ad00000000000 3:c08b8e0000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 4:c0795c0000000000 5:7ff8000000000001 +result host=h1,job=x ; 1:4078880000000000 2:406ab00000000000 3:c08b960000000000 +result host=h1,job=y ; 4:40796c0000000000 5:7ff8000000000001 +result host=h2,job=y ; 1:7ff8000000000001 +end +case binary <= true on job,zone left - NaN NaN +grid 100000 10000 3 +series __name__=a,host=h1,job=y,zone=z1 ; 2:407a5e0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 0:c0763e0000000000 1:4075320000000000 +series __name__=a,host=h1,job=x ; 0:c07b560000000000 +series __name__=a,host=h2,job=y ; +series __name__=a,host=h2,job=x ; 0:c08f130000000000 1:4083b60000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 1:407fa60000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:4066580000000000 +series __name__=b,host=h2,job=x ; 2:c087190000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:4053880000000000 +result host=h1,job=x ; 0:0 +result host=h1,job=x,zone=z1 ; 0:3ff0000000000000 1:3ff0000000000000 +result host=h1,job=y,zone=z1 ; 2:0 +result host=h2,job=x ; 0:0 1:0 +result job=x ; 2:0 +result job=y,zone=z1 ; 1:0 +end +case binary < true on host,zone,__name__ left job Inf Inf +grid 100000 10000 7 +series __name__=a,host=h2,job=x ; 3:c08ba10000000000 5:c0897e0000000000 6:4085ca0000000000 +series __name__=b,host=h2,job=x,zone=z2 ; 5:408c1e0000000000 6:c08e030000000000 +result host=h2 ; 3:3ff0000000000000 5:3ff0000000000000 6:3ff0000000000000 +result host=h2,job=x,zone=z2 ; 5:0 6:0 +end +case binary / false ignoring zone left job - NaN +grid 100000 10000 7 +series __name__=a,host=h1,job=y,zone=z1 ; 3:c08e530000000000 +series __name__=b,host=h2,job=y ; 5:7ff8000000000001 +series __name__=b,host=h1,job=y,zone=z1 ; 4:c08e150000000000 5:c060d40000000000 6:4073e00000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 1:c0659c0000000000 +result host=h1,job=y,zone=z1 ; 3:7ff8000000000001 +end +case binary <= true none - one - - 1 +grid 100000 10000 4 +series __name__=a,host=h2,job=x ; 1:c025400000000000 2:c067180000000000 +series __name__=b,host=h2,job=x ; 3:4086d30000000000 +result host=h2,job=x ; 1:3ff0000000000000 2:3ff0000000000000 +end +case binary - false ignoring job left host,job 0 -2.5 +grid 100000 10000 4 +series __name__=a,host=h1,job=y ; 2:7ff8000000000001 3:4050b80000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 2:4085500000000000 3:4088f60000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 2:408cc80000000000 +series __name__=a,host=h1,job=x ; 1:c071360000000000 +series __name__=b,host=h1,job=y ; 3:c07f7a0000000000 +result host=h1 ; 1:c0710e0000000000 2:7ff8000000000001 +result host=h1,job=y ; 3:4081d40000000000 +result host=h1,zone=z1 ; 2:4085640000000000 3:40890a0000000000 +result host=h2,zone=z1 ; 2:408cdc0000000000 +end +case binary != true none - one - 1 1 +grid 100000 10000 5 +series __name__=a,host=h2,job=x ; 2:7ff8000000000001 +series __name__=a,host=h1,job=x,zone=z1 ; 3:fff0000000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:c065ec0000000000 1:4085910000000000 2:7ff0000000000000 3:40883d0000000000 +series __name__=a,host=h1,job=y ; 3:406dc00000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 3:c0708e0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:4083440000000000 +result host=h1,job=x,zone=z1 ; 3:3ff0000000000000 +result host=h1,job=y ; 3:3ff0000000000000 +result host=h2,job=x ; 2:3ff0000000000000 +result host=h2,job=x,zone=z1 ; 0:3ff0000000000000 1:3ff0000000000000 2:3ff0000000000000 3:3ff0000000000000 +end +case binary * false on zone one - Inf Inf +grid 100000 10000 12 +series __name__=a,host=h1,job=y ; 3:408ad50000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 10:4047200000000000 +series __name__=b,host=h1,job=y ; 7:40700c0000000000 8:7ff8000000000001 9:c073260000000000 +result - ; 3:7ff0000000000000 7:7ff0000000000000 8:7ff8000000000001 9:fff0000000000000 +result zone=z1 ; 10:7ff0000000000000 +end +case binary + false ignoring - one - 0 - +grid 100000 10000 3 +series __name__=a,host=h2,job=x ; 1:401a000000000000 +series __name__=a,host=h2,job=y ; 0:c07e840000000000 +series __name__=b,host=h2,job=x ; 2:4051880000000000 +series __name__=b,host=h2,job=y ; 2:c052300000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 1:c06d7c0000000000 +series __name__=b,host=h1,job=y ; 2:c0869d0000000000 +result host=h1,job=y ; 2:c0869d0000000000 +result host=h2,job=x ; 2:4051880000000000 +result host=h2,job=x,zone=z1 ; 1:c06d7c0000000000 +result host=h2,job=y ; 2:c052300000000000 +end +case binary != false on job,zone left - - Inf +grid 100000 10000 1 +series __name__=a,host=h1,job=x,zone=z1 ; 0:4086890000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 0:408bc10000000000 +series __name__=a,host=h2,job=y ; 0:4049700000000000 +series __name__=a,host=h2,job=x ; 0:c08a530000000000 +series __name__=a,host=h1,job=y ; 0:c064dc0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:4054600000000000 +series __name__=b,host=h2,job=y ; +series __name__=b,host=h1,job=x ; 0:c08e020000000000 +series __name__=b,host=h1,job=y ; +series __name__=b,host=h1,job=x,zone=z1 ; 0:408aa10000000000 +error found duplicate series for the match group {job="x", zone="z1"} on the right hand-side of the operation: [{__name__="b", host="h1", job="x", zone="z1"}, {__name__="b", host="h2", job="x", zone="z1"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary atan2 false on job right host -2.5 -2.5 +grid 100000 10000 9 +series __name__=a,host=h2,job=x,zone=z1 ; 6:c07a440000000000 7:c0852d0000000000 +series __name__=a,host=h1,job=x ; 1:408bd00000000000 2:c087690000000000 3:4053c00000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 0:0 1:c08aae0000000000 2:4089660000000000 +result host=h1,job=x ; 3:3ff9a38f0b33076c +result host=h1,job=x,zone=z2 ; 1:4002aeeae3b4f170 2:bfe7d474561401df +result host=h2,job=x ; 6:bff93a59110050e1 7:bff93117e1c9f2e5 +result job=x,zone=z2 ; 0:bff921fb54442d18 +end +case binary / false on host,zone one - 1 1 +grid 100000 10000 7 +series __name__=a,host=h2,job=x ; 1:c07bb60000000000 3:7ff0000000000000 4:40835f0000000000 +series __name__=b,host=h2,job=x,zone=z2 ; 0:c087120000000000 1:7e37e43c8800759c 2:40775e0000000000 3:c0839a0000000000 4:407f120000000000 5:c0869e0000000000 +series __name__=b,host=h1,job=x ; 4:c08e610000000000 5:c05c000000000000 6:408c490000000000 +series __name__=b,host=h2,job=x ; 0:c067400000000000 1:7ff8000000000001 2:c0756e0000000000 +result host=h1 ; 4:bf50da929d696f5c 5:bf82492492492492 6:3f5219f333a70c7b +result host=h2 ; 0:bf76058160581606 1:7ff8000000000001 2:bf67e45ff1114409 3:7ff0000000000000 4:40835f0000000000 +result host=h2,zone=z2 ; 0:bf56316a061182fe 1:1a56e1fc2f8f359 2:3f65e93ba8036c71 3:bf5a1ed059c9ec35 4:3f607a8f8b9e6a36 5:bf56a33d1a9deed8 +end +case binary != true ignoring host left host,job,zone -2.5 1 +grid 100000 10000 7 +series __name__=a,host=h2,job=x ; 0:c05d580000000000 1:c08b240000000000 2:4082c00000000000 5:407d1a0000000000 6:408cb50000000000 +series __name__=a,host=h1,job=x ; 3:c0797e0000000000 4:0 5:40744e0000000000 6:40841e0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 3:7e37e43c8800759c 4:408b010000000000 5:7ff8000000000001 +series __name__=b,host=h1,job=x ; 5:408a370000000000 6:c078900000000000 +error multiple matches for labels: grouping labels must ensure unique matches +end +case binary < false ignoring host,job,zone right job 1 1 +grid 100000 10000 12 +series __name__=a,host=h2,job=y ; 2:7ff8000000000001 4:c07dc00000000000 5:408d360000000000 +series __name__=b,host=h2,job=y ; 10:40843c0000000000 11:4076e20000000000 +result __name__=b,host=h2 ; 10:3ff0000000000000 11:3ff0000000000000 +result job=y ; 4:c07dc00000000000 +end +case binary <= true none - one - - 1 +grid 100000 10000 11 +series __name__=a,host=h2,job=x,zone=z1 ; 2:c0837b0000000000 3:4079ae0000000000 4:0 5:7ff8000000000001 6:4083470000000000 +series __name__=a,host=h1,job=x ; 9:c0802b0000000000 +series __name__=a,host=h2,job=x ; 4:4081dd0000000000 5:408d5e0000000000 6:c0834d0000000000 7:7ff0000000000000 8:408af60000000000 9:c083ec0000000000 10:c07ac00000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 4:4076d80000000000 5:4071320000000000 6:407c8a0000000000 +series __name__=a,host=h1,job=y ; 10:c053180000000000 +series __name__=b,host=h1,job=y,zone=z1 ; +result host=h1,job=x ; 9:3ff0000000000000 +result host=h1,job=y ; 10:3ff0000000000000 +result host=h1,job=y,zone=z1 ; 4:0 5:0 6:0 +result host=h2,job=x ; 4:0 5:0 6:3ff0000000000000 7:0 8:0 9:3ff0000000000000 10:3ff0000000000000 +result host=h2,job=x,zone=z1 ; 2:3ff0000000000000 3:0 4:3ff0000000000000 5:0 6:0 +end +case binary - false ignoring host left host,job -2.5 1 +grid 100000 10000 7 +series __name__=a,host=h2,job=x ; 3:4078760000000000 6:4082720000000000 +series __name__=a,host=h2,job=y ; 5:7ff8000000000001 +series __name__=b,host=h1,job=x ; 5:4087710000000000 6:4071c40000000000 +series __name__=b,host=h2,job=y ; 1:c06ef80000000000 2:c0811b0000000000 +series __name__=b,host=h2,job=x ; 3:c077000000000000 4:c053e80000000000 5:4077a20000000000 6:408b1b0000000000 +error found duplicate series for the match group {job="x"} on the right hand-side of the operation: [{__name__="b", host="h1", job="x"}, {__name__="b", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary == true on zone right job 1 -2.5 +grid 100000 10000 7 +series __name__=a,host=h1,job=y ; 2:40831e0000000000 3:7ff8000000000001 4:c084b80000000000 +series __name__=a,host=h2,job=y ; 0:c07aca0000000000 2:c0838f0000000000 4:c0769e0000000000 +series __name__=a,host=h1,job=x ; 1:c084be0000000000 2:0 3:4075260000000000 5:408cf10000000000 6:4081880000000000 +series __name__=a,host=h2,job=x ; 6:7ff8000000000001 +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=b,host=h2,job=y ; 2:4085920000000000 4:4086270000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 6:c083820000000000 +series __name__=b,host=h1,job=x ; 4:fff0000000000000 5:c0709c0000000000 +error found duplicate series for the match group {} on the left hand-side of the operation: [{__name__="a", host="h1", job="y"}, {__name__="a", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary > false none - one - NaN NaN +grid 100000 10000 8 +series __name__=a,host=h1,job=x ; 1:4079ea0000000000 2:c086b40000000000 3:408c0e0000000000 4:407b780000000000 5:405a280000000000 6:c074320000000000 +series __name__=a,host=h2,job=y ; 5:c08c210000000000 7:7e37e43c8800759c +series __name__=a,host=h2,job=x,zone=z1 ; 5:4086300000000000 6:c080970000000000 +series __name__=a,host=h2,job=x ; 5:4080390000000000 7:407d4e0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 3:c0864b0000000000 5:c014000000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 4:c080180000000000 +series __name__=b,host=h1,job=x ; 1:c07cf60000000000 2:40857f0000000000 4:4080340000000000 +result __name__=a,host=h1,job=x ; 1:4079ea0000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 5:4086300000000000 +end +case binary / false ignoring job,zone right job -2.5 NaN +grid 100000 10000 1 +series __name__=a,host=h2,job=y,zone=z1 ; 0:4086be0000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 0:c0898b0000000000 +series __name__=b,host=h1,job=y ; 0:c072680000000000 +result host=h1 ; 0:7ff8000000000001 +result host=h2,job=y,zone=z1 ; 0:bfec7dbfb7568f5e +end +case binary ^ false on job one - - 1 +grid 100000 10000 8 +series __name__=a,host=h1,job=x ; 2:408a630000000000 4:7ff8000000000001 5:4055200000000000 6:0 +series __name__=b,host=h1,job=x ; 2:c0820b0000000000 3:c079f00000000000 4:c076a20000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 6:fff0000000000000 +series __name__=b,host=h2,job=x ; 1:4063340000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 3:40881b0000000000 +error found duplicate series for the match group {job="x"} on the right hand-side of the operation: [{__name__="b", host="h1", job="x"}, {__name__="b", host="h2", job="x", zone="z1"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary > true ignoring zone left job 1 1 +grid 100000 10000 11 +series __name__=a,host=h1,job=y ; 2:7ff8000000000001 3:4087400000000000 4:c083360000000000 5:c07fd40000000000 6:4072c80000000000 7:407ac00000000000 8:40786c0000000000 9:c083620000000000 +series __name__=b,host=h1,job=y ; 7:fff0000000000000 8:4070b00000000000 10:c043e00000000000 +result host=h1,job=y ; 2:0 3:3ff0000000000000 4:0 5:0 6:3ff0000000000000 7:3ff0000000000000 8:3ff0000000000000 9:0 10:3ff0000000000000 +end +case binary * false on zone one - Inf Inf +grid 100000 10000 8 +series __name__=a,host=h2,job=y ; 4:7ff8000000000001 +series __name__=a,host=h1,job=x,zone=z1 ; 1:7ff0000000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 5:4062140000000000 +series __name__=a,host=h1,job=x ; 0:40613c0000000000 1:0 3:4064b80000000000 4:7ff8000000000001 5:408e320000000000 +series __name__=b,host=h1,job=y ; 6:c082940000000000 +error multiple matches for labels: many-to-one matching must be explicit (group_left/group_right) +end +case binary != true on zone one - 1 0 +grid 100000 10000 10 +series __name__=a,host=h2,job=y,zone=z1 ; 5:402e400000000000 6:c0700c0000000000 7:40852b0000000000 8:4058780000000000 +series __name__=a,host=h2,job=x ; 4:c033400000000000 5:4078820000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 2:c083d60000000000 +series __name__=a,host=h2,job=y ; 5:405d680000000000 +series __name__=b,host=h2,job=x ; 8:c043500000000000 +error multiple matches for labels: many-to-one matching must be explicit (group_left/group_right) +end +case binary != true ignoring zone right zone Inf Inf +grid 100000 10000 9 +series __name__=a,host=h2,job=x ; 6:c083e60000000000 +series __name__=b,host=h1,job=x ; 0:c07c740000000000 1:c055e00000000000 2:4050900000000000 4:c075060000000000 6:c03e200000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 2:c03c400000000000 4:405c580000000000 +series __name__=b,host=h2,job=x ; 4:c08a620000000000 6:fff0000000000000 7:c087ff0000000000 +error multiple matches for labels: grouping labels must ensure unique matches +end +case binary + false ignoring job right zone 0 Inf +grid 100000 10000 8 +series __name__=a,host=h2,job=x,zone=z1 ; 1:406cf80000000000 2:4071a40000000000 5:c08a6e0000000000 6:408a5d0000000000 +series __name__=a,host=h1,job=y ; 0:408eb30000000000 1:c085ad0000000000 2:4066e80000000000 3:407ea60000000000 5:c080320000000000 +series __name__=a,host=h2,job=y,zone=z1 ; +series __name__=b,host=h2,job=x ; 6:c07a260000000000 +result host=h1 ; 0:408eb30000000000 1:c085ad0000000000 2:4066e80000000000 3:407ea60000000000 5:c080320000000000 +result host=h2,job=x ; 6:7ff0000000000000 +result host=h2,zone=z1 ; 1:406cf80000000000 2:4071a40000000000 5:c08a6e0000000000 6:408a5d0000000000 +end +case binary / false ignoring job left zone - 1 +grid 100000 10000 7 +series __name__=a,host=h1,job=y,zone=z1 ; 6:7e37e43c8800759c +series __name__=b,host=h1,job=y ; 4:4051700000000000 +series __name__=b,host=h2,job=y ; 6:4080640000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 5:4089570000000000 6:407f2a0000000000 +result host=h1,job=y,zone=z1 ; 6:7da8884c045da7ef +end +case binary ^ false ignoring zone left host NaN NaN +grid 100000 10000 11 +series __name__=a,host=h1,job=y ; 3:c088050000000000 4:c0825e0000000000 5:fff0000000000000 6:4071800000000000 7:4083ee0000000000 8:c0773a0000000000 9:c08e590000000000 +series __name__=a,host=h2,job=x ; 5:407f1a0000000000 7:c076240000000000 8:40754a0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; +series __name__=a,host=h2,job=x,zone=z1 ; 9:c084030000000000 10:408c230000000000 +series __name__=a,host=h1,job=x ; 7:4071e60000000000 8:7ff0000000000000 9:c083990000000000 10:c059a80000000000 +series __name__=b,host=h2,job=x ; 1:40824b0000000000 5:7e37e43c8800759c 6:4078200000000000 7:c029000000000000 8:7ff8000000000001 9:408c9e0000000000 10:4083c80000000000 +series __name__=b,host=h1,job=y ; 3:4076080000000000 +series __name__=b,host=h2,job=y ; 7:40875b0000000000 8:c069d80000000000 9:402f400000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 10:c046200000000000 +result host=h1,job=x ; 7:7ff8000000000001 8:7ff8000000000001 9:7ff8000000000001 10:7ff8000000000001 +result host=h1,job=y ; 3:7ff8000000000001 4:7ff8000000000001 5:7ff8000000000001 6:7ff8000000000001 7:7ff8000000000001 8:7ff8000000000001 9:7ff8000000000001 +result host=h2,job=x ; 1:7ff8000000000001 5:7ff0000000000000 6:7ff8000000000001 7:7ff8000000000001 8:7ff8000000000001 +result host=h2,job=x,zone=z1 ; 9:7ff8000000000001 10:7ff0000000000000 +result host=h2,job=y ; 7:7ff8000000000001 8:7ff8000000000001 9:7ff8000000000001 +end +case binary atan2 false ignoring host,zone one - Inf 0 +grid 100000 10000 10 +series __name__=a,host=h1,job=y ; 1:7ff8000000000001 +series __name__=a,host=h1,job=x ; 3:405e980000000000 4:0 5:c08e6a0000000000 6:4008000000000000 +series __name__=a,host=h2,job=x ; +series __name__=a,host=h2,job=x,zone=z1 ; 7:7ff8000000000001 +series __name__=a,host=h1,job=y,zone=z1 ; 6:40832c0000000000 7:c051b80000000000 +series __name__=b,host=h2,job=x ; 0:4076d20000000000 1:c085f00000000000 2:c070740000000000 +result job=x ; 0:3ff921fb54442d18 1:3ff921fb54442d18 2:3ff921fb54442d18 3:3ff921fb54442d18 4:0 5:bff921fb54442d18 6:3ff921fb54442d18 7:7ff8000000000001 +result job=y ; 1:7ff8000000000001 6:3ff921fb54442d18 7:bff921fb54442d18 +end +case binary atan2 false on job left host Inf Inf +grid 100000 10000 7 +series __name__=a,host=h1,job=y,zone=z1 ; 4:7e37e43c8800759c +series __name__=a,host=h2,job=x ; 6:c0779c0000000000 +series __name__=a,host=h2,job=y ; 2:4084890000000000 3:40683c0000000000 +series __name__=a,host=h1,job=y ; 4:7ff8000000000001 5:404f400000000000 6:c078e40000000000 +series __name__=a,host=h1,job=x ; 3:40759a0000000000 4:40802c0000000000 +series __name__=b,host=h2,job=y ; 2:c0756e0000000000 3:c087bb0000000000 4:7ff8000000000001 5:406f180000000000 +series __name__=b,host=h1,job=x ; 0:405c080000000000 1:c08a590000000000 2:c06ba80000000000 3:408b9d0000000000 4:c085fb0000000000 6:c071a80000000000 +series __name__=b,host=h2,job=x ; +series __name__=b,host=h1,job=y ; +result host=h1,job=x ; 0:3ff921fb54442d18 1:3ff921fb54442d18 2:3ff921fb54442d18 3:3fd7dcc2324c75d2 4:40040ee9aa8e1ec7 6:c001b40f1bbfa192 +result host=h2,job=y ; 2:400069ea22eca411 3:4007220bb590d0da 4:7ff8000000000001 5:3fcf823194bd196f +result host=h2,job=y,zone=z1 ; 4:7ff8000000000001 +result job=y ; 6:8000000000000000 +end +case binary * false on job,zone right host Inf -2.5 +grid 100000 10000 8 +series __name__=a,host=h2,job=y ; 4:406f000000000000 5:40837e0000000000 7:c06bbc0000000000 +series __name__=a,host=h1,job=x ; 7:c06bb80000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 3:7ff8000000000001 4:40713e0000000000 5:4083990000000000 6:408e8a0000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 2:c07a780000000000 3:406a400000000000 4:4056380000000000 +series __name__=b,host=h1,job=x ; 5:7ff8000000000001 6:4084bf0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 5:c06f5c0000000000 7:7ff8000000000001 +series __name__=b,host=h2,job=y ; 1:c0746e0000000000 2:40870f0000000000 3:4083c60000000000 +result host=h1,job=x ; 7:fff0000000000000 +result host=h1,job=x,zone=z1 ; 3:7ff8000000000001 4:7ff0000000000000 5:c103348fe0000000 6:7ff0000000000000 +result host=h2,job=y ; 4:7ff0000000000000 5:7ff0000000000000 7:fff0000000000000 +result job=x ; 5:7ff8000000000001 6:c099eec000000000 +result job=x,zone=z1 ; 7:7ff8000000000001 +result job=y ; 1:4089898000000000 2:c09cd2c000000000 3:c098b78000000000 +result job=y,zone=z1 ; 2:40908b0000000000 3:c080680000000000 4:c06bc60000000000 +end +case binary % false ignoring host,job,zone right host,zone NaN NaN +grid 100000 10000 12 +series __name__=a,host=h2,job=y ; 1:4085090000000000 2:408b8b0000000000 4:4076ba0000000000 5:c083b20000000000 7:c088480000000000 8:4081130000000000 9:c080580000000000 10:c07dd60000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 5:c08de20000000000 6:7ff8000000000001 7:7ff0000000000000 8:40868c0000000000 9:4081ba0000000000 10:c076ce0000000000 +series __name__=a,host=h1,job=x ; 8:40756c0000000000 +series __name__=b,host=h1,job=x ; 4:c0870e0000000000 +series __name__=b,host=h2,job=x ; 2:c084150000000000 4:c078020000000000 5:c07e220000000000 +error multiple matches for labels: grouping labels must ensure unique matches +end +case binary + false ignoring - right host Inf - +grid 100000 10000 1 +series __name__=a,host=h2,job=y ; 0:c085f60000000000 +series __name__=a,host=h1,job=x ; 0:c067700000000000 +series __name__=b,host=h1,job=y,zone=z1 ; +series __name__=b,host=h1,job=x ; 0:4065d80000000000 +result host=h1,job=x ; 0:c029800000000000 +result host=h2,job=y ; 0:7ff0000000000000 +end +case binary > true on host,job,zone right - 0 - +grid 100000 10000 11 +series __name__=a,host=h1,job=x,zone=z1 ; 2:c0898e0000000000 3:408cb50000000000 4:c056080000000000 5:408e490000000000 6:c042c00000000000 7:c053a80000000000 8:fff0000000000000 +series __name__=a,host=h1,job=x ; 3:c069100000000000 +series __name__=a,host=h1,job=y ; 2:40828b0000000000 3:c0845d0000000000 4:c06ff40000000000 6:c01b800000000000 7:40846f0000000000 8:c0807f0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 7:4085780000000000 8:c085210000000000 9:c0700a0000000000 +series __name__=b,host=h1,job=x ; 5:c0789e0000000000 7:7ff8000000000001 +series __name__=b,host=h2,job=y ; 8:404d400000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 10:40864f0000000000 +result host=h1,job=x ; 3:0 +result host=h1,job=x,zone=z1 ; 2:0 3:3ff0000000000000 4:0 5:3ff0000000000000 6:0 7:0 8:0 +result host=h1,job=y ; 2:3ff0000000000000 3:0 4:0 6:0 7:3ff0000000000000 8:0 +end +case binary < false ignoring job,zone right - - 1 +grid 100000 10000 4 +series __name__=a,host=h1,job=y,zone=z1 ; 0:4087720000000000 1:4082dd0000000000 2:0 3:c07b700000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:c0705a0000000000 1:c0866e0000000000 +end +case binary + false none - one - NaN - +grid 100000 10000 12 +series __name__=a,host=h1,job=x ; 10:407b2c0000000000 +series __name__=a,host=h2,job=y ; 3:c08ea20000000000 +series __name__=a,host=h2,job=x ; 3:c08d240000000000 4:c07db20000000000 6:407a220000000000 7:fff0000000000000 8:4071e60000000000 9:4054b80000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 5:c083b40000000000 6:405c680000000000 7:c087080000000000 8:4085ac0000000000 +series __name__=b,host=h2,job=y ; 7:c08a650000000000 9:c047200000000000 10:4060980000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 9:c07d540000000000 10:4077dc0000000000 +series __name__=b,host=h2,job=y,zone=z2 ; 3:4083d10000000000 4:4057000000000000 5:c03a000000000000 6:4074a20000000000 7:4089040000000000 8:c0861f0000000000 +series __name__=b,host=h1,job=x ; 1:c08b870000000000 +result host=h1,job=x ; 1:7ff8000000000001 +result host=h2,job=x,zone=z1 ; 9:7ff8000000000001 10:7ff8000000000001 +result host=h2,job=y ; 7:7ff8000000000001 9:7ff8000000000001 10:7ff8000000000001 +result host=h2,job=y,zone=z1 ; 5:7ff8000000000001 6:7ff8000000000001 7:7ff8000000000001 8:7ff8000000000001 +result host=h2,job=y,zone=z2 ; 3:7ff8000000000001 4:7ff8000000000001 5:7ff8000000000001 6:7ff8000000000001 7:7ff8000000000001 8:7ff8000000000001 +end +case binary + false on - right host,job,zone NaN - +grid 100000 10000 1 +series __name__=a,host=h2,job=y,zone=z1 ; 0:0 +series __name__=a,host=h2,job=x,zone=z1 ; 0:c066d00000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:c071840000000000 +error found duplicate series for the match group {} on the left hand-side of the operation: [{__name__="a", host="h2", job="x", zone="z1"}, {__name__="a", host="h2", job="y", zone="z1"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary atan2 false on job one - 0 - +grid 100000 10000 8 +series __name__=a,host=h1,job=x ; 7:c089420000000000 +series __name__=a,host=h2,job=y ; 6:4082390000000000 7:7ff0000000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:4073f80000000000 1:4058980000000000 2:c07ad20000000000 3:c083740000000000 4:c085fc0000000000 5:4074740000000000 6:c07a3c0000000000 +series __name__=a,host=h1,job=y ; 0:c087d90000000000 1:c06f380000000000 2:c086380000000000 3:7ff8000000000001 4:c089710000000000 +series __name__=b,host=h2,job=y ; 2:c085140000000000 3:40794a0000000000 4:407d500000000000 6:40862c0000000000 7:4072140000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 2:408a6d0000000000 3:407f0a0000000000 4:406be00000000000 5:4077e40000000000 +series __name__=b,host=h1,job=y ; 5:c05aa80000000000 6:40764a0000000000 +error found duplicate series for the match group {job="y"} on the right hand-side of the operation: [{__name__="b", host="h1", job="y"}, {__name__="b", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary > false on host left zone 0 -2.5 +grid 100000 10000 1 +series __name__=a,host=h1,job=x ; 0:7ff0000000000000 +series __name__=a,host=h2,job=y ; 0:40853d0000000000 +series __name__=a,host=h2,job=x ; 0:7e37e43c8800759c +series __name__=b,host=h2,job=y ; 0:c058400000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 0:c08a290000000000 +series __name__=b,host=h2,job=x ; 0:c065f00000000000 +error found duplicate series for the match group {host="h2"} on the right hand-side of the operation: [{__name__="b", host="h2", job="y", zone="z1"}, {__name__="b", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary / false on zone left host - 0 +grid 100000 10000 4 +series __name__=a,host=h1,job=y ; 3:c084bb0000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 3:4088690000000000 +series __name__=a,host=h2,job=x ; +series __name__=b,host=h2,job=x,zone=z2 ; 0:4084610000000000 1:c063440000000000 +series __name__=b,host=h2,job=x ; 2:c0619c0000000000 +series __name__=b,host=h1,job=y ; 1:7ff8000000000001 2:c062d00000000000 +error found duplicate series for the match group {} on the right hand-side of the operation: [{__name__="b", host="h1", job="y"}, {__name__="b", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary >= true none - one - Inf Inf +grid 100000 10000 12 +series __name__=a,host=h1,job=x ; 1:c085100000000000 2:c0892e0000000000 3:c07b9c0000000000 4:c08eee0000000000 5:fff0000000000000 6:4085140000000000 8:7ff8000000000001 10:c07a040000000000 +series __name__=a,host=h1,job=y,zone=z1 ; +series __name__=b,host=h1,job=x ; 10:c087820000000000 +series __name__=b,host=h2,job=y ; 2:0 3:407ef60000000000 4:4066e80000000000 5:c082300000000000 6:c06d180000000000 7:4063040000000000 8:406e3c0000000000 9:c08b7b0000000000 +series __name__=b,host=h2,job=x ; +result host=h1,job=x ; 1:0 2:0 3:0 4:0 5:0 6:0 8:0 10:3ff0000000000000 +result host=h2,job=y ; 2:3ff0000000000000 3:3ff0000000000000 4:3ff0000000000000 5:3ff0000000000000 6:3ff0000000000000 7:3ff0000000000000 8:3ff0000000000000 9:3ff0000000000000 +end +case binary >= true none - one - 0 - +grid 100000 10000 8 +series __name__=a,host=h1,job=x,zone=z1 ; 4:c081a50000000000 5:40862a0000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 4:408c480000000000 +series __name__=b,host=h1,job=x,zone=z1 ; +result host=h1,job=x,zone=z2 ; 4:0 +end +case binary * false ignoring host left host,zone Inf Inf +grid 100000 10000 5 +series __name__=a,host=h2,job=x ; 1:c062d80000000000 2:4082790000000000 3:4080010000000000 +series __name__=b,host=h2,job=x ; 0:fff0000000000000 3:4084d20000000000 +result host=h2,job=x ; 0:fff0000000000000 3:4114d34d20000000 +result job=x ; 1:fff0000000000000 2:7ff0000000000000 +end +case binary + false on job,zone right - - Inf +grid 100000 10000 1 +series __name__=a,host=h1,job=x ; 0:c074c20000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:c0878a0000000000 +series __name__=a,host=h1,job=y ; 0:c0838a0000000000 +series __name__=b,host=h1,job=y ; +series __name__=b,host=h1,job=y,zone=z2 ; +end +case binary == true ignoring zone left job Inf Inf +grid 100000 10000 5 +series __name__=a,host=h2,job=y ; 2:c063e40000000000 4:4075380000000000 +series __name__=a,host=h1,job=x ; 4:c07ea40000000000 +series __name__=a,host=h2,job=x ; +series __name__=a,host=h1,job=y ; 2:408c550000000000 +series __name__=b,host=h1,job=x ; +series __name__=b,host=h2,job=y,zone=z1 ; 0:c087e00000000000 1:7ff0000000000000 2:0 +series __name__=b,host=h2,job=y ; 0:4060940000000000 1:c08b5e0000000000 +series __name__=b,host=h2,job=x ; 2:408c0a0000000000 3:c076120000000000 +error found duplicate series for the match group {host="h2", job="y"} on the right hand-side of the operation: [{__name__="b", host="h2", job="y", zone="z1"}, {__name__="b", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary / false ignoring host,job,zone one - -2.5 NaN +grid 100000 10000 11 +series __name__=a,host=h1,job=x ; 10:0 +series __name__=a,host=h1,job=x,zone=z1 ; 4:c08d580000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 8:c06ef40000000000 9:4087360000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 3:c067480000000000 4:7ff8000000000001 5:c07b1a0000000000 6:408e620000000000 7:c060d40000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 8:c08bf80000000000 9:c08e620000000000 +series __name__=b,host=h1,job=x ; 5:4083bb0000000000 6:c084f70000000000 7:c0702c0000000000 8:c086e70000000000 9:c07fc20000000000 10:40840b0000000000 +error found duplicate series for the match group {} on the right hand-side of the operation: [{__name__="b", host="h1", job="x", zone="z1"}, {__name__="b", host="h1", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary * false on job left zone 0 0 +grid 100000 10000 10 +series __name__=a,host=h2,job=x ; +series __name__=a,host=h2,job=x,zone=z1 ; 2:7ff0000000000000 4:c0806f0000000000 5:c081450000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 5:7ff8000000000001 +series __name__=b,host=h2,job=x,zone=z1 ; 0:c069ac0000000000 1:0 2:7ff8000000000001 3:c074c40000000000 4:c064b40000000000 5:404ba00000000000 6:40773a0000000000 7:4074c00000000000 +series __name__=b,host=h2,job=x ; 5:c05f500000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 7:c08b4e0000000000 +error found duplicate series for the match group {job="x"} on the right hand-side of the operation: [{__name__="b", host="h2", job="x", zone="z1"}, {__name__="b", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary < true ignoring job right zone - -2.5 +grid 100000 10000 11 +series __name__=a,host=h1,job=y ; 8:7e37e43c8800759c +series __name__=a,host=h2,job=y ; 6:c05e480000000000 7:c084800000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 1:c08c670000000000 2:407bd00000000000 3:0 4:4078840000000000 5:40781a0000000000 6:40849c0000000000 8:408ea10000000000 9:40743e0000000000 10:4075fa0000000000 +series __name__=b,host=h1,job=y ; 7:c08a420000000000 9:405f180000000000 +result host=h1,job=y ; 7:0 9:3ff0000000000000 +end +case binary % false on job left zone NaN NaN +grid 100000 10000 1 +series __name__=a,host=h1,job=y,zone=z1 ; +series __name__=b,host=h2,job=x,zone=z1 ; +end +case binary == true on host left - 0 0 +grid 100000 10000 7 +series __name__=a,host=h1,job=y,zone=z1 ; 6:7ff8000000000001 +series __name__=a,host=h1,job=x ; 3:c07cd00000000000 4:405c100000000000 5:4038200000000000 6:c082350000000000 +series __name__=a,host=h1,job=y ; 3:7ff8000000000001 4:4086b90000000000 5:c05f800000000000 +series __name__=a,host=h2,job=x ; 2:4078320000000000 3:c07b060000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 5:c071e40000000000 6:c089450000000000 +series __name__=b,host=h1,job=y ; +result host=h1,job=x ; 3:0 4:0 5:0 6:0 +result host=h1,job=y ; 3:0 4:0 5:0 +result host=h1,job=y,zone=z1 ; 6:0 +result host=h2,job=x ; 2:0 3:0 +end +case binary >= true none - one - - 0 +grid 100000 10000 1 +series __name__=a,host=h1,job=y,zone=z1 ; 0:c07d920000000000 +series __name__=a,host=h1,job=y ; +series __name__=b,host=h1,job=y ; 0:c086300000000000 +result host=h1,job=y,zone=z1 ; 0:0 +end +case binary * false ignoring - left host,job,zone - 1 +grid 100000 10000 6 +series __name__=a,host=h2,job=y,zone=z1 ; +series __name__=a,host=h2,job=x ; 1:406bc40000000000 2:c076f60000000000 4:408ab90000000000 +series __name__=a,host=h1,job=x ; 1:c085130000000000 +series __name__=a,host=h2,job=y ; 5:4063240000000000 +series __name__=b,host=h2,job=x ; 4:7e37e43c8800759c 5:406be00000000000 +result host=h1,job=x ; 1:c085130000000000 +result host=h2,job=x ; 1:406bc40000000000 2:c076f60000000000 4:7ed3f390ac72a237 +result host=h2,job=y ; 5:4063240000000000 +end +case binary * false none - one - - 1 +grid 100000 10000 11 +series __name__=a,host=h2,job=y ; +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=b,host=h2,job=x,zone=z1 ; 7:7e37e43c8800759c 10:c07d680000000000 +series __name__=b,host=h2,job=y ; 7:7ff8000000000001 8:405f200000000000 9:4085470000000000 +series __name__=b,host=h2,job=y,zone=z2 ; 2:c063540000000000 3:40754e0000000000 4:4086db0000000000 5:c05ba80000000000 6:c052200000000000 7:4084fd0000000000 8:c059800000000000 9:4083c20000000000 10:c08a990000000000 +end +case binary atan2 false ignoring job,zone,__name__ left - NaN Inf +grid 100000 10000 12 +series __name__=a,host=h1,job=x ; 4:408c340000000000 5:c071ea0000000000 7:c07d800000000000 +series __name__=a,host=h2,job=y ; 11:408ec80000000000 +series __name__=a,host=h2,job=x ; 2:c05a700000000000 3:407b000000000000 5:c078d40000000000 6:c084d50000000000 +series __name__=b,host=h2,job=y ; 6:c05e380000000000 8:c08c200000000000 9:4082a60000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 8:4088d10000000000 10:c0854c0000000000 +series __name__=b,host=h1,job=x ; 10:7ff8000000000001 +error found duplicate series for the match group {host="h2"} on the right hand-side of the operation: [{__name__="b", host="h2", job="y", zone="z1"}, {__name__="b", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary < false ignoring zone right zone 0 Inf +grid 100000 10000 9 +series __name__=a,host=h2,job=y ; 5:4086fd0000000000 6:408ced0000000000 8:c07d6e0000000000 +series __name__=a,host=h1,job=x ; 4:407b060000000000 5:c068b40000000000 6:c07bee0000000000 +series __name__=b,host=h2,job=y ; 4:4059c00000000000 5:4083760000000000 +series __name__=b,host=h1,job=x ; 2:c084730000000000 3:408ac60000000000 4:4042d00000000000 5:c08daf0000000000 6:40736c0000000000 7:40785a0000000000 +result __name__=b,host=h1,job=x ; 6:c07bee0000000000 +result host=h2,job=y ; 8:c07d6e0000000000 +end +case binary / false none - one - - Inf +grid 100000 10000 4 +series __name__=a,host=h2,job=x ; 3:c0846b0000000000 +series __name__=a,host=h1,job=y ; 1:fff0000000000000 2:4081260000000000 +series __name__=a,host=h1,job=x ; +series __name__=b,host=h2,job=x ; 3:c052200000000000 +result host=h1,job=y ; 1:fff8000000000000 2:0 +result host=h2,job=x ; 3:4022062de74862de +end +case binary + false ignoring host left host - 1 +grid 100000 10000 2 +series __name__=a,host=h1,job=y ; 0:7e37e43c8800759c 1:c066000000000000 +series __name__=a,host=h2,job=x ; +series __name__=a,host=h1,job=y,zone=z1 ; 1:7ff8000000000001 +series __name__=a,host=h2,job=y ; 0:c06aa80000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:408e4e0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:0 +series __name__=b,host=h2,job=x ; 0:c07a6c0000000000 +error multiple matches for labels: grouping labels must ensure unique matches +end +case binary == false ignoring job right host - 1 +grid 100000 10000 6 +series __name__=a,host=h2,job=y,zone=z1 ; 1:c08b920000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 5:4065f80000000000 +series __name__=a,host=h2,job=y ; 2:c081b20000000000 3:7ff0000000000000 4:c08b780000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 5:c053e80000000000 +series __name__=b,host=h1,job=y ; 3:c08cea0000000000 +series __name__=b,host=h2,job=y ; 4:40839f0000000000 +end +case binary == true none - one - 1 0 +grid 100000 10000 8 +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=b,host=h2,job=x,zone=z1 ; 3:407f220000000000 4:40823d0000000000 5:c077e00000000000 6:406da00000000000 +result host=h2,job=x,zone=z1 ; 3:0 4:0 5:0 6:0 +end +case binary atan2 false on - one - - Inf +grid 100000 10000 3 +series __name__=a,host=h2,job=y ; 0:408f3e0000000000 2:4045100000000000 +series __name__=a,host=h1,job=y ; 2:7ff0000000000000 +series __name__=a,host=h2,job=x ; 0:c07d6c0000000000 1:c083350000000000 2:c07be60000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 1:c088240000000000 +series __name__=b,host=h2,job=x ; 1:c048e00000000000 +error multiple matches for labels: many-to-one matching must be explicit (group_left/group_right) +end +case binary > true ignoring - left job - 0 +grid 100000 10000 6 +series __name__=a,host=h2,job=x ; 3:406e580000000000 +series __name__=b,host=h2,job=x ; 3:c07e2c0000000000 4:4079080000000000 +result host=h2,job=x ; 3:3ff0000000000000 +end +case binary <= false none - one - - 1 +grid 100000 10000 11 +series __name__=a,host=h1,job=x ; 8:408c2c0000000000 9:7ff8000000000001 +series __name__=a,host=h2,job=y,zone=z1 ; 3:c08b430000000000 4:4081930000000000 +series __name__=a,host=h1,job=y ; 6:404a100000000000 7:406b0c0000000000 8:4087650000000000 +series __name__=b,host=h1,job=x ; 1:40805c0000000000 2:c085350000000000 3:c08ab20000000000 +series __name__=b,host=h2,job=x ; 10:c046b00000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 6:c036600000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 3:c08b430000000000 +end +case binary - false on - one - - Inf +grid 100000 10000 4 +series __name__=a,host=h1,job=y ; 2:4033200000000000 +series __name__=a,host=h2,job=x ; 3:4065300000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 1:c079b40000000000 2:4067e40000000000 3:c07d680000000000 +series __name__=a,host=h1,job=y,zone=z1 ; +series __name__=b,host=h2,job=y ; 2:4083dc0000000000 3:405e300000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:4061d80000000000 +series __name__=b,host=h2,job=x ; 1:c08a940000000000 2:c0711c0000000000 +error found duplicate series for the match group {} on the right hand-side of the operation: [{__name__="b", host="h2", job="x"}, {__name__="b", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary < false none - one - -2.5 - +grid 100000 10000 5 +series __name__=a,host=h2,job=x ; 2:c08bc10000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 0:c085410000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 4:c078c20000000000 +series __name__=a,host=h2,job=y ; 0:c0879b0000000000 1:c07b4a0000000000 2:4085d90000000000 +series __name__=b,host=h2,job=x ; +series __name__=b,host=h1,job=x,zone=z1 ; 2:4045000000000000 +result host=h1,job=x,zone=z1 ; 2:c004000000000000 +end +case binary - false on host,zone left job 0 - +grid 100000 10000 11 +series __name__=a,host=h1,job=x ; 7:c083f60000000000 8:408b790000000000 9:c08b180000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 1:4081690000000000 2:c071360000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 1:4074e00000000000 2:c080a20000000000 3:c087250000000000 4:c082b40000000000 5:7ff8000000000001 7:4031600000000000 8:406a1c0000000000 9:c066f80000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:7ff8000000000001 +series __name__=b,host=h2,job=x,zone=z1 ; 4:c07bd60000000000 6:405c500000000000 +series __name__=b,host=h2,job=y ; 4:c06cd80000000000 5:4079080000000000 6:c08e010000000000 7:c087b80000000000 +result host=h1,job=y,zone=z1 ; 0:7ff8000000000001 +result host=h2,job=x,zone=z1 ; 4:c063240000000000 6:c05c500000000000 +result host=h2,job=y ; 4:406cd80000000000 5:c079080000000000 6:408e010000000000 7:4087b80000000000 +end +case binary + false ignoring job,zone right - - 0 +grid 100000 10000 7 +series __name__=a,host=h1,job=x ; 3:7ff8000000000001 +series __name__=a,host=h2,job=x,zone=z1 ; 0:0 1:40734a0000000000 2:c082680000000000 3:c051d00000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 4:7ff8000000000001 +series __name__=a,host=h1,job=y,zone=z1 ; 4:c082710000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 2:408e860000000000 4:4084ef0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 1:c07d940000000000 2:c0848b0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 2:c063c80000000000 3:7e37e43c8800759c +error found duplicate series for the match group {host="h1"} on the left hand-side of the operation: [{__name__="a", host="h1", job="x", zone="z1"}, {__name__="a", host="h1", job="y", zone="z1"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary - false on host one - NaN - +grid 100000 10000 1 +series __name__=a,host=h2,job=x,zone=z1 ; 0:0 +series __name__=a,host=h2,job=y,zone=z1 ; 0:4081920000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 0:c07cac0000000000 +series __name__=b,host=h1,job=y ; 0:c03da00000000000 +error multiple matches for labels: many-to-one matching must be explicit (group_left/group_right) +end +case binary * false on zone left - - -2.5 +grid 100000 10000 7 +series __name__=a,host=h1,job=y,zone=z1 ; 3:c081bd0000000000 4:fff0000000000000 5:c06e340000000000 +series __name__=a,host=h1,job=x ; 1:c080030000000000 3:c051780000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:4083a50000000000 +result host=h1,job=x ; 1:409403c000000000 3:4065d60000000000 +result host=h1,job=y,zone=z1 ; 3:40962c4000000000 4:7ff0000000000000 5:4082e08000000000 +end +case binary / false on host left - Inf 0 +grid 100000 10000 8 +series __name__=a,host=h1,job=x ; 5:7ff8000000000001 6:c088ee0000000000 +series __name__=a,host=h1,job=y ; 1:40756a0000000000 +series __name__=a,host=h2,job=y ; 6:7ff8000000000001 7:c08e8b0000000000 +series __name__=a,host=h2,job=x ; 2:40679c0000000000 3:408b9b0000000000 6:407e900000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 7:7e37e43c8800759c +series __name__=b,host=h1,job=x ; 1:4075760000000000 2:4080c00000000000 3:4047700000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 7:c03e600000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 1:c08e910000000000 +error found duplicate series for the match group {host="h1"} on the right hand-side of the operation: [{__name__="b", host="h1", job="x"}, {__name__="b", host="h1", job="y", zone="z2"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary > false ignoring host,job,zone right - - -2.5 +grid 100000 10000 12 +series __name__=a,host=h2,job=x,zone=z1 ; 0:4068d80000000000 2:c06c540000000000 3:c08f070000000000 +series __name__=a,host=h2,job=x ; 0:407e180000000000 3:c040800000000000 4:c0813c0000000000 +series __name__=b,host=h2,job=x ; 7:4062340000000000 8:408a2d0000000000 9:4064d00000000000 +series __name__=b,host=h2,job=y ; 5:c062340000000000 7:c069900000000000 8:c0735e0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 5:7ff8000000000001 6:4077b00000000000 7:7ff8000000000001 8:c054480000000000 9:c080050000000000 10:c082160000000000 +error found duplicate series for the match group {} on the left hand-side of the operation: [{__name__="a", host="h2", job="x", zone="z1"}, {__name__="a", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary != false on host,job,zone one - 1 - +grid 100000 10000 10 +series __name__=a,host=h2,job=y,zone=z1 ; 3:0 4:c085c60000000000 5:406e540000000000 6:c058b00000000000 7:c043a00000000000 8:7e37e43c8800759c 9:4079fc0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 4:c0730a0000000000 5:408add0000000000 7:c07bc00000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 2:7ff8000000000001 3:c077b20000000000 4:4084a40000000000 5:408dfc0000000000 6:7ff8000000000001 8:c069300000000000 +series __name__=b,host=h2,job=y ; 9:405fb00000000000 +result host=h1,job=y,zone=z1 ; 4:3ff0000000000000 5:3ff0000000000000 7:3ff0000000000000 +result host=h2,job=y ; 9:3ff0000000000000 +result host=h2,job=y,zone=z1 ; 2:3ff0000000000000 3:0 4:c085c60000000000 5:406e540000000000 6:c058b00000000000 8:7e37e43c8800759c +end +case binary == true ignoring - right - - 1 +grid 100000 10000 8 +series __name__=a,host=h2,job=y ; +series __name__=b,host=h2,job=x ; 1:40800c0000000000 2:40756e0000000000 +series __name__=b,host=h2,job=y ; 2:407a100000000000 5:c08efe0000000000 6:4051a00000000000 7:40750e0000000000 +result host=h2,job=x ; 1:0 2:0 +result host=h2,job=y ; 2:0 5:0 6:0 7:0 +end +case binary * false ignoring job one - Inf Inf +grid 100000 10000 10 +series __name__=a,host=h1,job=x ; 4:407e500000000000 5:4084930000000000 6:7ff8000000000001 7:c082e40000000000 8:0 9:c083b30000000000 +series __name__=a,host=h2,job=x ; 6:c086a90000000000 7:7ff8000000000001 +series __name__=a,host=h2,job=x,zone=z1 ; 7:7e37e43c8800759c 9:404c200000000000 +series __name__=a,host=h1,job=y ; 8:c081960000000000 9:c084c90000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 4:408f260000000000 5:40818f0000000000 6:c071600000000000 +series __name__=b,host=h1,job=x ; 6:c08e400000000000 +series __name__=b,host=h2,job=x ; 7:c0743c0000000000 8:40725c0000000000 +series __name__=b,host=h2,job=y ; 7:408d9c0000000000 8:c088c20000000000 +error found duplicate series for the match group {host="h2"} on the right hand-side of the operation: [{__name__="b", host="h2", job="x"}, {__name__="b", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary + false on job,zone left host 1 - +grid 100000 10000 7 +series __name__=a,host=h2,job=x ; 6:405fb00000000000 +series __name__=a,host=h1,job=x ; 3:c089590000000000 4:4081250000000000 5:7ff8000000000001 +series __name__=b,host=h1,job=x,zone=z1 ; 3:4070220000000000 4:c085a90000000000 +series __name__=b,host=h2,job=x ; 0:c06cd80000000000 1:c087f90000000000 2:4081ae0000000000 3:c05ca00000000000 4:408ca50000000000 5:c082a30000000000 6:c080c00000000000 +series __name__=b,host=h1,job=x ; 4:4061500000000000 5:c075460000000000 +error found duplicate series for the match group {job="x"} on the right hand-side of the operation: [{__name__="b", host="h1", job="x"}, {__name__="b", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary <= true ignoring job right job Inf - +grid 100000 10000 10 +series __name__=a,host=h2,job=x ; 5:c08c940000000000 6:c080ca0000000000 7:40844f0000000000 8:4079d80000000000 9:7ff8000000000001 +series __name__=a,host=h2,job=y ; 3:7e37e43c8800759c 4:405dd00000000000 5:4073b40000000000 +series __name__=a,host=h1,job=x ; 5:4076b20000000000 7:c081800000000000 8:c069f00000000000 9:40806f0000000000 +series __name__=a,host=h1,job=y,zone=z1 ; +series __name__=a,host=h1,job=y ; 0:7ff0000000000000 1:c070a20000000000 4:408a740000000000 5:4052980000000000 6:0 +series __name__=b,host=h2,job=y,zone=z2 ; 8:4080d70000000000 +series __name__=b,host=h2,job=y ; 4:c078020000000000 6:40859b0000000000 8:c058d00000000000 9:408b000000000000 +series __name__=b,host=h2,job=x,zone=z1 ; +error found duplicate series for the match group {host="h2"} on the left hand-side of the operation: [{__name__="a", host="h2", job="x"}, {__name__="a", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary / false ignoring zone,__name__ right host,job - 0 +grid 100000 10000 6 +series __name__=a,host=h1,job=x,zone=z1 ; 5:407f040000000000 +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=a,host=h2,job=y ; 2:c076c20000000000 3:7e37e43c8800759c 4:c08c8b0000000000 5:c082a30000000000 +series __name__=a,host=h2,job=x ; +series __name__=b,host=h1,job=x ; 5:c077520000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 3:40746c0000000000 4:0 5:4076260000000000 +result host=h1,job=x ; 5:bff5479c8412de20 +result host=h2,job=x,zone=z1 ; 3:0 4:fff8000000000000 5:0 +end +case binary == false none - one - - 0 +grid 100000 10000 4 +series __name__=a,host=h2,job=x ; 0:c076a40000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 3:4082b80000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 1:fff0000000000000 +series __name__=b,host=h2,job=x ; 1:c084d00000000000 2:7e37e43c8800759c +series __name__=b,host=h1,job=x,zone=z1 ; 0:4051c80000000000 1:40831f0000000000 +end +case binary / false ignoring host one - NaN 0 +grid 100000 10000 8 +series __name__=a,host=h1,job=x,zone=z1 ; 3:c04f800000000000 +series __name__=a,host=h1,job=x ; 2:7ff8000000000001 3:c081100000000000 4:c068f00000000000 6:c061f80000000000 7:c07ada0000000000 +series __name__=a,host=h2,job=y ; 5:c048a00000000000 +series __name__=b,host=h1,job=x ; 3:4080f40000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 2:40820e0000000000 3:7ff0000000000000 6:4070be0000000000 +series __name__=b,host=h2,job=y ; 4:7ff8000000000001 +series __name__=b,host=h2,job=x ; +result job=x ; 2:7ff8000000000001 3:bff01a6d01a6d01a 4:fff0000000000000 6:fff0000000000000 7:fff0000000000000 +result job=x,zone=z1 ; 2:7ff8000000000001 3:8000000000000000 6:7ff8000000000001 +result job=y ; 4:7ff8000000000001 5:fff0000000000000 +end +case binary - false ignoring job,zone left job,zone 1 - +grid 100000 10000 8 +series __name__=a,host=h2,job=x,zone=z1 ; 7:408a990000000000 +series __name__=a,host=h1,job=x ; 4:40826d0000000000 5:4079e00000000000 6:c0884f0000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 7:c083520000000000 +series __name__=b,host=h1,job=x ; 2:c07e100000000000 3:4089290000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:c08bea0000000000 1:c0879e0000000000 +result host=h1,job=x ; 2:407e200000000000 3:c089210000000000 +result host=h2,job=x,zone=z1 ; 0:408bf20000000000 1:4087a60000000000 +end +case binary <= true ignoring - left - - 0 +grid 100000 10000 2 +series __name__=a,host=h2,job=x ; +series __name__=a,host=h1,job=y,zone=z1 ; 1:c08d500000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:4087300000000000 1:7ff0000000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 0:4079660000000000 +series __name__=b,host=h2,job=x ; +result host=h1,job=y,zone=z1 ; 1:3ff0000000000000 +result host=h2,job=x,zone=z1 ; 0:0 1:0 +result host=h2,job=y,zone=z1 ; 0:0 +end +case binary atan2 false ignoring host,zone left - - 0 +grid 100000 10000 10 +series __name__=a,host=h2,job=x ; 3:408ced0000000000 4:c08e850000000000 6:408c2a0000000000 7:40661c0000000000 8:4080b30000000000 9:40803f0000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 5:0 7:4080880000000000 8:40787a0000000000 9:c089a60000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 9:7e37e43c8800759c +series __name__=b,host=h1,job=x,zone=z1 ; 8:c089d10000000000 +series __name__=b,host=h2,job=x ; 8:408a550000000000 +error found duplicate series for the match group {job="x"} on the right hand-side of the operation: [{__name__="b", host="h1", job="x", zone="z1"}, {__name__="b", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary < false ignoring host left job,zone 1 0 +grid 100000 10000 2 +series __name__=a,host=h1,job=y ; 0:c0871e0000000000 +series __name__=b,host=h1,job=y ; 0:7e37e43c8800759c 1:c061e00000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:c080ae0000000000 +result __name__=a,host=h1,job=y ; 0:c0871e0000000000 +end +case binary >= false ignoring host,job right host,zone NaN 1 +grid 100000 10000 6 +series __name__=a,host=h1,job=y,zone=z1 ; 2:c083350000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 3:c065f80000000000 4:c066500000000000 5:408f3d0000000000 +series __name__=a,host=h1,job=x ; 4:c067a80000000000 +series __name__=a,host=h2,job=y ; 2:4072720000000000 +series __name__=b,host=h1,job=x ; 4:405fd00000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 2:c088f70000000000 3:c08ed80000000000 +result __name__=b,host=h1,job=x,zone=z1 ; 2:c083350000000000 +result __name__=b,host=h2,job=x,zone=z1 ; 3:c065f80000000000 +end +case binary % false ignoring - left host,job,zone - 1 +grid 100000 10000 5 +series __name__=a,host=h2,job=x ; 0:c071020000000000 1:404ac00000000000 +series __name__=a,host=h1,job=y ; 2:7e37e43c8800759c +series __name__=a,host=h2,job=y,zone=z1 ; 2:c054980000000000 3:c067580000000000 4:c031a00000000000 +series __name__=a,host=h1,job=y,zone=z1 ; +series __name__=b,host=h1,job=y,zone=z2 ; 3:c081480000000000 +series __name__=b,host=h1,job=y ; 0:c08efb0000000000 +series __name__=b,host=h2,job=x ; 3:0 4:4048000000000000 +result host=h1,job=y ; 2:0 +result host=h2,job=x ; 0:bfc0000000000000 1:3fe0000000000000 +result host=h2,job=y,zone=z1 ; 2:bfd8000000000000 3:bfe8000000000000 4:bfe4000000000000 +end +case binary != true ignoring host,zone right job 1 1 +grid 100000 10000 8 +series __name__=a,host=h1,job=y ; 7:4071e00000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 6:c0673c0000000000 7:c087720000000000 +series __name__=a,host=h1,job=x ; 5:4061c00000000000 6:7ff8000000000001 +series __name__=b,host=h1,job=x,zone=z1 ; 3:c075fa0000000000 +error found duplicate series for the match group {job="x"} on the left hand-side of the operation: [{__name__="a", host="h1", job="x", zone="z1"}, {__name__="a", host="h1", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary > true on - left host 0 -2.5 +grid 100000 10000 7 +series __name__=a,host=h1,job=x ; 2:7ff0000000000000 +series __name__=a,host=h2,job=x ; 1:4089df0000000000 2:c066240000000000 3:4069580000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 1:c0759e0000000000 2:c07ab40000000000 3:c05ef80000000000 +series __name__=b,host=h2,job=x ; 1:c021c00000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 5:c080d60000000000 6:c080cd0000000000 +error found duplicate series for the match group {} on the right hand-side of the operation: [{__name__="b", host="h2", job="x", zone="z1"}, {__name__="b", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary >= true on job one - Inf - +grid 100000 10000 2 +series __name__=a,host=h2,job=y ; 1:c0893b0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 0:408c210000000000 +series __name__=a,host=h1,job=x ; 1:0 +series __name__=b,host=h2,job=y ; +series __name__=b,host=h2,job=y,zone=z1 ; 0:c065b00000000000 +series __name__=b,host=h1,job=x ; 0:c05ed80000000000 +result job=x ; 0:3ff0000000000000 +result job=y ; 0:3ff0000000000000 +end +case binary > true ignoring - left - 1 NaN +grid 100000 10000 7 +series __name__=a,host=h2,job=y ; 4:4057380000000000 +series __name__=a,host=h2,job=x ; 1:4089620000000000 +series __name__=b,host=h2,job=x,zone=z1 ; +series __name__=b,host=h2,job=x ; 2:c080570000000000 3:c083d20000000000 +series __name__=b,host=h2,job=y ; 1:4065f80000000000 3:c071ea0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 4:c030600000000000 5:c086ee0000000000 6:c051800000000000 +result host=h1,job=x,zone=z1 ; 4:3ff0000000000000 5:3ff0000000000000 6:3ff0000000000000 +result host=h2,job=x ; 1:0 2:3ff0000000000000 3:3ff0000000000000 +result host=h2,job=y ; 1:0 3:3ff0000000000000 4:0 +end +case binary atan2 false ignoring host right zone 1 1 +grid 100000 10000 11 +series __name__=a,host=h1,job=x ; 3:7ff0000000000000 4:4032800000000000 5:c084db0000000000 7:4045000000000000 8:c07eee0000000000 +series __name__=a,host=h1,job=y ; 0:408e680000000000 1:c074960000000000 2:7ff8000000000001 3:408e350000000000 5:c078da0000000000 7:c080c20000000000 8:7ff8000000000001 9:407c220000000000 +series __name__=a,host=h2,job=x ; 2:c089610000000000 4:406fa00000000000 6:c069700000000000 7:c075120000000000 8:406e980000000000 9:c082ff0000000000 10:c055480000000000 +series __name__=b,host=h2,job=x ; 2:4053600000000000 +series __name__=b,host=h1,job=x ; 3:4077600000000000 4:4087d20000000000 5:40664c0000000000 6:7ff8000000000001 7:407aae0000000000 8:c05d080000000000 9:4086a70000000000 10:c07e420000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 7:c088c50000000000 8:c08e090000000000 +error found duplicate series for the match group {job="x"} on the left hand-side of the operation: [{__name__="a", host="h1", job="x"}, {__name__="a", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary >= true on host right zone NaN - +grid 100000 10000 8 +series __name__=a,host=h1,job=x ; 4:c07afe0000000000 5:4083ab0000000000 +series __name__=b,host=h1,job=x ; 2:c089f00000000000 +series __name__=b,host=h2,job=y ; 0:7ff0000000000000 1:4085c60000000000 +result host=h1 ; 4:0 5:0 +end +case binary >= false on host,job left zone - 1 +grid 100000 10000 3 +series __name__=a,host=h2,job=y ; +series __name__=a,host=h1,job=y ; 1:408aab0000000000 2:4087870000000000 +series __name__=b,host=h1,job=y ; 2:4083f80000000000 +series __name__=b,host=h2,job=y ; 1:7ff8000000000001 +result __name__=a,host=h1,job=y ; 1:408aab0000000000 2:4087870000000000 +end +case binary + false none - one - NaN - +grid 100000 10000 10 +series __name__=a,host=h2,job=y ; 4:4088500000000000 5:c08c5a0000000000 6:c07e140000000000 8:4008000000000000 +series __name__=a,host=h2,job=x ; 6:4084e10000000000 +series __name__=a,host=h1,job=x ; 1:7ff8000000000001 2:406a440000000000 3:7ff0000000000000 4:c080da0000000000 5:4084a00000000000 6:408c0d0000000000 7:c06c800000000000 +series __name__=b,host=h1,job=y ; 3:407aba0000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 6:c08cbe0000000000 7:404cb00000000000 +series __name__=b,host=h2,job=y ; 9:4089120000000000 +result host=h1,job=y ; 3:7ff8000000000001 +result host=h2,job=y ; 9:7ff8000000000001 +result host=h2,job=y,zone=z1 ; 6:7ff8000000000001 7:7ff8000000000001 +end +case binary / false ignoring job right host,job NaN NaN +grid 100000 10000 11 +series __name__=a,host=h1,job=x,zone=z1 ; +series __name__=a,host=h1,job=y ; 7:c082570000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 6:4057b00000000000 8:c086f30000000000 9:408e4a0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 4:c08ee70000000000 5:c08da00000000000 6:4084cc0000000000 7:4053e00000000000 +result host=h1,job=y ; 7:7ff8000000000001 +result host=h1,zone=z1 ; 4:7ff8000000000001 5:7ff8000000000001 6:7ff8000000000001 7:7ff8000000000001 +result host=h2,job=x,zone=z1 ; 6:7ff8000000000001 8:7ff8000000000001 9:7ff8000000000001 +end +case binary % false on host,job right - - 1 +grid 100000 10000 2 +series __name__=a,host=h1,job=x,zone=z1 ; 0:7ff8000000000001 1:c0854c0000000000 +series __name__=a,host=h1,job=y,zone=z1 ; +series __name__=a,host=h1,job=x ; 1:c08ae10000000000 +series __name__=a,host=h2,job=y ; 1:c032400000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 1:407b320000000000 +series __name__=b,host=h1,job=x,zone=z2 ; +series __name__=b,host=h2,job=x,zone=z2 ; 0:c082480000000000 +series __name__=b,host=h1,job=x ; 1:fff0000000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:40750a0000000000 +error found duplicate series for the match group {host="h1", job="x"} on the left hand-side of the operation: [{__name__="a", host="h1", job="x", zone="z1"}, {__name__="a", host="h1", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary ^ false on host,__name__ one - Inf Inf +grid 100000 10000 11 +series __name__=a,host=h1,job=y,zone=z1 ; 6:406b7c0000000000 7:408ca10000000000 +series __name__=b,host=h1,job=x ; 8:c07f700000000000 9:7e37e43c8800759c +result host=h1 ; 6:7ff0000000000000 7:7ff0000000000000 8:0 9:7ff0000000000000 +end +case binary ^ false ignoring host,job,__name__ right host - -2.5 +grid 100000 10000 2 +series __name__=a,host=h2,job=y ; 1:c076740000000000 +series __name__=a,host=h2,job=x ; 0:4077d20000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 1:40872e0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 1:408ba60000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:4081050000000000 1:408e5c0000000000 +series __name__=b,host=h2,job=y ; 0:408c050000000000 +error multiple matches for labels: grouping labels must ensure unique matches +end +case binary - false none - one - NaN - +grid 100000 10000 5 +series __name__=a,host=h2,job=x,zone=z1 ; 3:c08b7a0000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 1:c083a50000000000 2:408ccf0000000000 +series __name__=a,host=h1,job=x ; +series __name__=b,host=h1,job=y,zone=z1 ; 1:c08c510000000000 2:c085420000000000 3:4072a40000000000 +series __name__=b,host=h2,job=x ; 3:7ff8000000000001 +result host=h1,job=y,zone=z1 ; 1:4071580000000000 2:4099088000000000 3:7ff8000000000001 +result host=h2,job=x ; 3:7ff8000000000001 +end +case binary - false ignoring zone right - 1 -2.5 +grid 100000 10000 1 +series __name__=a,host=h1,job=x,zone=z1 ; 0:c08b460000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:4071560000000000 +series __name__=b,host=h1,job=x ; 0:7e37e43c8800759c +result host=h1,job=x ; 0:fe37e43c8800759c +result host=h1,job=x,zone=z1 ; 0:c091f88000000000 +end +case binary < true on zone one - -2.5 - +grid 100000 10000 7 +series __name__=a,host=h2,job=y ; 2:7ff0000000000000 +series __name__=a,host=h1,job=y ; 0:c083860000000000 1:407b200000000000 2:40813f0000000000 3:c08c720000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 1:c086b30000000000 2:c075040000000000 3:406e600000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 4:40886f0000000000 5:7ff8000000000001 +series __name__=a,host=h1,job=y,zone=z1 ; 6:c08aec0000000000 +series __name__=a,host=h1,job=x ; 6:c081630000000000 +series __name__=b,host=h1,job=y ; 6:4087e80000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 5:c057e80000000000 +series __name__=b,host=h1,job=x ; 1:4076e40000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 3:4064f80000000000 4:c08dda0000000000 +result - ; 1:0 6:3ff0000000000000 +result zone=z1 ; 3:0 4:0 5:0 +end +case binary / false on job left zone Inf - +grid 100000 10000 10 +series __name__=a,host=h2,job=y ; 7:408cad0000000000 +series __name__=a,host=h2,job=x ; 3:4035600000000000 4:40889f0000000000 5:4071880000000000 6:c0829f0000000000 7:406ae80000000000 +series __name__=a,host=h1,job=y ; 8:7e37e43c8800759c +series __name__=b,host=h1,job=y ; 0:406f600000000000 1:c07d7e0000000000 2:c08cd50000000000 4:4084450000000000 5:407f080000000000 7:7ff8000000000001 8:4070940000000000 9:c087f40000000000 +series __name__=b,host=h2,job=x ; 4:c071080000000000 7:c07bf40000000000 8:c0698c0000000000 +result host=h1,job=y ; 8:7db70ef246f0470b +result host=h2,job=x ; 4:c0072159b7a99216 7:bfdecd335f28c856 +result host=h2,job=y ; 7:7ff8000000000001 +result job=x ; 8:fff0000000000000 +result job=y ; 0:7ff0000000000000 1:fff0000000000000 2:fff0000000000000 4:7ff0000000000000 5:7ff0000000000000 9:fff0000000000000 +end +case binary <= false on job,zone right - - Inf +grid 100000 10000 8 +series __name__=a,host=h2,job=x ; 5:40844e0000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 3:c072a40000000000 4:4064a00000000000 5:40797e0000000000 6:c086d30000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 5:c0805a0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 5:c076a80000000000 6:4088a20000000000 7:40833b0000000000 +end +case binary > false on - one - - NaN +grid 100000 10000 9 +series __name__=a,host=h2,job=x,zone=z1 ; 7:40669c0000000000 8:c06aa00000000000 +series __name__=b,host=h2,job=x ; 2:c064000000000000 3:c07ba00000000000 4:c0847f0000000000 +end +case binary - false ignoring job one - - 0 +grid 100000 10000 6 +series __name__=a,host=h1,job=x ; 0:c07f360000000000 +series __name__=a,host=h2,job=y ; +series __name__=b,host=h1,job=x ; 0:7ff0000000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 4:c07d7e0000000000 5:4063a40000000000 +result host=h1 ; 0:fff0000000000000 +end +case binary atan2 false none - one - 0 - +grid 100000 10000 1 +series __name__=a,host=h1,job=x ; 0:4083940000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 0:40870d0000000000 +series __name__=b,host=h2,job=y,zone=z1 ; +end +case binary atan2 false ignoring zone left job -2.5 -2.5 +grid 100000 10000 2 +series __name__=a,host=h2,job=x,zone=z1 ; 1:408cf40000000000 +series __name__=a,host=h1,job=x ; 0:407d0c0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 0:4045300000000000 +series __name__=a,host=h2,job=x ; 0:7ff8000000000001 +series __name__=b,host=h1,job=x ; 1:c07d480000000000 +result host=h1,job=x ; 0:3ff93803d00c19aa 1:c009170da933f265 +result host=h2,job=x ; 0:7ff8000000000001 +result host=h2,job=x,zone=z1 ; 1:3ff92d08b928356f +result host=h2,job=y,zone=z1 ; 0:3ffa135a985b725c +end +case binary * false ignoring host,__name__ one - NaN NaN +grid 100000 10000 6 +series __name__=a,host=h2,job=x ; 0:4050a80000000000 1:c059a00000000000 +series __name__=a,host=h1,job=y ; 0:4079920000000000 2:4056400000000000 3:c08bb40000000000 4:4086850000000000 5:c06b7c0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 5:4080d80000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 1:40768c0000000000 2:4085530000000000 3:7e37e43c8800759c 4:c0851c0000000000 +result job=x ; 0:7ff8000000000001 1:7ff8000000000001 +result job=y ; 0:7ff8000000000001 2:7ff8000000000001 3:7ff8000000000001 4:7ff8000000000001 5:7ff8000000000001 +result job=y,zone=z1 ; 1:7ff8000000000001 2:7ff8000000000001 3:7ff8000000000001 4:7ff8000000000001 5:7ff8000000000001 +end +case binary * false ignoring host,job,zone left zone NaN 0 +grid 100000 10000 9 +series __name__=a,host=h1,job=y,zone=z1 ; 6:4088140000000000 7:c07fcc0000000000 +series __name__=b,host=h1,job=x ; 7:407db60000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 6:c07d0c0000000000 +series __name__=b,host=h1,job=y ; 5:40831e0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 8:c08d650000000000 +result - ; 5:7ff8000000000001 +result host=h1,job=y ; 7:c10d85b840000000 +result host=h1,job=y,zone=z1 ; 6:c115db2780000000 +result zone=z1 ; 8:7ff8000000000001 +end +case binary - false on - left zone Inf 1 +grid 100000 10000 1 +series __name__=a,host=h2,job=y ; +series __name__=a,host=h1,job=x ; +series __name__=b,host=h1,job=x,zone=z1 ; 0:c05af00000000000 +series __name__=b,host=h1,job=x ; +series __name__=b,host=h2,job=y,zone=z2 ; 0:40819b0000000000 +series __name__=b,host=h1,job=x,zone=z2 ; +error found duplicate series for the match group {} on the right hand-side of the operation: [{__name__="b", host="h1", job="x", zone="z1"}, {__name__="b", host="h2", job="y", zone="z2"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary + false ignoring host,zone left host Inf Inf +grid 100000 10000 4 +series __name__=a,host=h2,job=y,zone=z1 ; 0:c07d1e0000000000 1:404a600000000000 2:40833b0000000000 +series __name__=a,host=h1,job=y ; 1:40790a0000000000 3:c07b740000000000 +series __name__=a,host=h1,job=x ; 1:408a390000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 0:c055f80000000000 1:404d200000000000 +result host=h1,job=y ; 1:407cae0000000000 +result host=h1,job=y,zone=z1 ; 0:c0814e0000000000 1:405bc00000000000 +result job=x ; 1:7ff0000000000000 +result job=y ; 3:7ff0000000000000 +result job=y,zone=z1 ; 2:7ff0000000000000 +end +case binary ^ false ignoring host,job left host Inf Inf +grid 100000 10000 8 +series __name__=a,host=h1,job=y ; 1:408eaf0000000000 2:c082bf0000000000 4:c084230000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 4:408da20000000000 5:c039400000000000 +series __name__=b,host=h2,job=x ; +series __name__=b,host=h1,job=y ; 4:c06dac0000000000 5:40749e0000000000 6:c008000000000000 7:40897d0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 4:c08cd70000000000 5:4089ad0000000000 +result host=h1 ; 5:7ff0000000000000 6:0 7:7ff0000000000000 +result host=h1,job=y ; 4:7ff8000000000001 +result host=h1,zone=z1 ; 4:0 5:7ff0000000000000 +result host=h1,zone=z2 ; 4:7ff0000000000000 5:0 +result job=y ; 1:7ff0000000000000 2:7ff0000000000000 +end +case binary >= true ignoring job left job,zone NaN -2.5 +grid 100000 10000 5 +series __name__=a,host=h2,job=y,zone=z1 ; 4:c054a00000000000 +series __name__=a,host=h2,job=y ; 4:0 +series __name__=a,host=h1,job=y ; 1:c08a4c0000000000 2:c08ec30000000000 +series __name__=a,host=h1,job=x ; +series __name__=a,host=h1,job=y,zone=z1 ; 2:4068380000000000 +series __name__=a,host=h2,job=x ; 2:406dcc0000000000 +series __name__=b,host=h1,job=x ; 1:c049c00000000000 2:c0700c0000000000 3:4086740000000000 4:c084060000000000 +series __name__=b,host=h2,job=x ; 2:c021400000000000 3:404d200000000000 4:7ff8000000000001 +result host=h1,job=x ; 1:0 2:0 3:0 4:0 +result host=h1,zone=z1 ; 2:3ff0000000000000 +result host=h2,job=x ; 2:3ff0000000000000 3:0 4:0 +result host=h2,zone=z1 ; 4:0 +end +case binary - false ignoring job right zone 0 1 +grid 100000 10000 12 +series __name__=a,host=h1,job=x ; 3:c081730000000000 4:c06c480000000000 5:40804b0000000000 6:4076540000000000 7:c08d830000000000 8:406aa80000000000 9:c086930000000000 10:c06f980000000000 11:c08d840000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 7:4034600000000000 10:c0689c0000000000 +series __name__=a,host=h2,job=y ; 7:c083a30000000000 9:4022c00000000000 10:c089150000000000 +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=a,host=h1,job=y ; 4:408b130000000000 5:c07ff80000000000 6:408bd20000000000 7:c040100000000000 8:7e37e43c8800759c +series __name__=b,host=h2,job=x,zone=z1 ; 3:4086080000000000 4:4052b00000000000 5:c089030000000000 6:c072660000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 2:40823a0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; +series __name__=b,host=h2,job=y,zone=z1 ; 9:4084130000000000 10:c089ac0000000000 +error found duplicate series for the match group {host="h1"} on the left hand-side of the operation: [{__name__="a", host="h1", job="x"}, {__name__="a", host="h1", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary * false on job right host - Inf +grid 100000 10000 2 +series __name__=a,host=h2,job=x ; 0:c078860000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 1:4078ba0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 0:407f460000000000 1:c071d60000000000 +series __name__=a,host=h1,job=x ; 1:4081040000000000 +series __name__=a,host=h2,job=y ; 0:4089140000000000 1:c08cd50000000000 +series __name__=b,host=h2,job=y ; +series __name__=b,host=h2,job=x ; 1:7e37e43c8800759c +series __name__=b,host=h1,job=y ; 0:408ece0000000000 +error found duplicate series for the match group {job="x"} on the left hand-side of the operation: [{__name__="a", host="h1", job="x", zone="z1"}, {__name__="a", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary >= true ignoring host,job left zone -2.5 - +grid 100000 10000 6 +series __name__=a,host=h2,job=y ; 1:c081f30000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 3:407ed40000000000 4:4067000000000000 +result zone=z1 ; 3:0 4:0 +end +case binary == false on host,zone right job -2.5 - +grid 100000 10000 9 +series __name__=a,host=h1,job=y ; 2:408ccc0000000000 5:c0856a0000000000 6:c0759e0000000000 7:c074200000000000 8:7ff8000000000001 +series __name__=b,host=h1,job=y ; 2:c088bd0000000000 3:4060900000000000 4:40849e0000000000 5:404c600000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:7ff8000000000001 1:c07f700000000000 3:7ff0000000000000 4:4028c00000000000 5:c08d9f0000000000 7:4081e50000000000 +end +case binary < false on job left - -2.5 - +grid 100000 10000 1 +series __name__=a,host=h2,job=y,zone=z1 ; 0:407b800000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:c04b800000000000 +series __name__=b,host=h2,job=y ; +series __name__=b,host=h2,job=x,zone=z1 ; 0:408bc40000000000 +result __name__=a,host=h2,job=x,zone=z1 ; 0:c04b800000000000 +end +case binary <= true ignoring zone,__name__ right host,zone - 0 +grid 100000 10000 10 +series __name__=a,host=h2,job=y,zone=z1 ; +series __name__=b,host=h2,job=y,zone=z1 ; 9:c06bd40000000000 +result host=h2,job=y ; 9:0 +end +case binary > false on zone one - 0 - +grid 100000 10000 2 +series __name__=a,host=h2,job=x,zone=z1 ; 0:407cec0000000000 1:0 +series __name__=b,host=h2,job=x,zone=z1 ; 0:40828d0000000000 1:fff0000000000000 +result zone=z1 ; 1:0 +end +case binary > false on host,__name__ right job,zone 0 0 +grid 100000 10000 11 +series __name__=a,host=h1,job=y,zone=z1 ; 7:4080ff0000000000 8:404ba00000000000 +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=b,host=h1,job=y ; 8:fff0000000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 6:4083800000000000 8:408f0d0000000000 9:4050380000000000 +series __name__=b,host=h2,job=x ; 9:4089a40000000000 10:7e37e43c8800759c +error multiple matches for labels: grouping labels must ensure unique matches +end +case binary atan2 false ignoring host,job right - NaN NaN +grid 100000 10000 11 +series __name__=a,host=h2,job=y ; 7:405fe80000000000 9:4073e80000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 9:7ff8000000000001 +series __name__=a,host=h1,job=x ; 9:c080f60000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 5:4089700000000000 7:c07d800000000000 8:fff0000000000000 +series __name__=b,host=h2,job=y ; 10:c0876d0000000000 +error found duplicate series for the match group {} on the left hand-side of the operation: [{__name__="a", host="h1", job="x"}, {__name__="a", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary atan2 false none - one - Inf - +grid 100000 10000 1 +series __name__=a,host=h1,job=x ; +series __name__=a,host=h1,job=y,zone=z1 ; 0:7ff8000000000001 +series __name__=b,host=h1,job=x ; +series __name__=b,host=h1,job=y,zone=z2 ; 0:c020400000000000 +series __name__=b,host=h2,job=y ; 0:c08e720000000000 +series __name__=b,host=h2,job=x ; 0:c067100000000000 +result host=h1,job=y,zone=z2 ; 0:3ff921fb54442d18 +result host=h2,job=x ; 0:3ff921fb54442d18 +result host=h2,job=y ; 0:3ff921fb54442d18 +end +case binary * false on - left host,job,zone NaN - +grid 100000 10000 2 +series __name__=a,host=h2,job=x,zone=z1 ; 0:406cc00000000000 1:fff0000000000000 +series __name__=a,host=h1,job=x ; +series __name__=a,host=h1,job=x,zone=z1 ; +series __name__=a,host=h2,job=y ; 1:c07b620000000000 +series __name__=b,host=h1,job=y ; +end +case binary / false none - one - -2.5 - +grid 100000 10000 7 +series __name__=a,host=h1,job=y,zone=z1 ; 5:408b300000000000 +series __name__=a,host=h2,job=x ; 1:408e830000000000 2:c081390000000000 +series __name__=a,host=h1,job=x ; 3:c07fda0000000000 4:4089050000000000 5:407f580000000000 +series __name__=a,host=h1,job=y ; 5:c078900000000000 +series __name__=b,host=h1,job=x ; +series __name__=b,host=h1,job=y,zone=z1 ; 0:c07e560000000000 +series __name__=b,host=h2,job=x ; 1:406e040000000000 3:c07ab40000000000 +series __name__=b,host=h2,job=y ; 6:c07f680000000000 +result host=h1,job=y,zone=z1 ; 0:3f7518dae1dee769 +result host=h2,job=x ; 1:401043b2b4f8efe0 3:3f77f79c8936602b +result host=h2,job=y ; 6:3f7460cbc7f5cf9a +end +case binary == false on zone one - - NaN +grid 100000 10000 2 +series __name__=a,host=h1,job=x,zone=z1 ; 0:408c160000000000 1:40748e0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:4048d00000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:4088790000000000 1:4084db0000000000 +error found duplicate series for the match group {zone="z1"} on the right hand-side of the operation: [{__name__="b", host="h1", job="x", zone="z1"}, {__name__="b", host="h1", job="y", zone="z1"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary - false on zone one - - -2.5 +grid 100000 10000 8 +series __name__=a,host=h1,job=x,zone=z1 ; 7:c065ec0000000000 +series __name__=a,host=h1,job=y ; 2:4082c30000000000 3:4073fa0000000000 4:c083b30000000000 +series __name__=a,host=h2,job=y ; 5:c073ac0000000000 +series __name__=b,host=h2,job=y ; 7:4076c60000000000 +series __name__=b,host=h1,job=y ; 5:c08bac0000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 6:40816b0000000000 7:c085440000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 4:40896b0000000000 +result - ; 2:4082d70000000000 3:4074220000000000 4:c0839f0000000000 5:4081d60000000000 +result zone=z1 ; 7:c0659c0000000000 +end +case binary > true ignoring - right job - Inf +grid 100000 10000 6 +series __name__=a,host=h2,job=x ; +series __name__=b,host=h2,job=x,zone=z1 ; 3:403ae00000000000 4:c08a2b0000000000 +series __name__=b,host=h2,job=y ; 5:c086880000000000 +result host=h2,job=x,zone=z1 ; 3:3ff0000000000000 4:3ff0000000000000 +result host=h2,job=y ; 5:3ff0000000000000 +end +case binary < false none - one - Inf Inf +grid 100000 10000 6 +series __name__=a,host=h1,job=y,zone=z1 ; 3:c07ba80000000000 4:407c2e0000000000 5:4071340000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 1:406ac80000000000 2:c0783e0000000000 3:4085fb0000000000 4:c0661c0000000000 +series __name__=a,host=h2,job=x ; 1:c082670000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 5:407e0c0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 3:40738a0000000000 +result __name__=a,host=h1,job=y,zone=z1 ; 3:c07ba80000000000 4:407c2e0000000000 5:4071340000000000 +result __name__=a,host=h2,job=x ; 1:c082670000000000 +result __name__=a,host=h2,job=y,zone=z1 ; 1:406ac80000000000 2:c0783e0000000000 3:4085fb0000000000 4:c0661c0000000000 +end +case binary != false ignoring zone one - 0 NaN +grid 100000 10000 5 +series __name__=a,host=h1,job=x,zone=z1 ; 2:c084d10000000000 3:7ff8000000000001 +series __name__=a,host=h1,job=x ; 1:c08d200000000000 2:4052c80000000000 3:c08d1c0000000000 +series __name__=a,host=h2,job=x ; 3:c084800000000000 4:4085df0000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 1:4080070000000000 2:7ff8000000000001 +series __name__=b,host=h2,job=x,zone=z1 ; 4:c08e880000000000 +series __name__=b,host=h2,job=x ; 3:7ff8000000000001 +series __name__=b,host=h1,job=x,zone=z2 ; 3:c083d40000000000 +series __name__=b,host=h2,job=x,zone=z2 ; 2:c0833b0000000000 3:4082820000000000 +error multiple matches for labels: many-to-one matching must be explicit (group_left/group_right) +end +case binary * false ignoring host,job right job,zone 1 0 +grid 100000 10000 1 +series __name__=a,host=h1,job=x,zone=z1 ; +series __name__=a,host=h1,job=y,zone=z1 ; 0:7e37e43c8800759c +series __name__=a,host=h1,job=x ; 0:c082640000000000 +series __name__=a,host=h2,job=y ; 0:4075fc0000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 0:c058700000000000 +series __name__=b,host=h2,job=y ; 0:7ff8000000000001 +series __name__=b,host=h1,job=x ; 0:4069b40000000000 +error found duplicate series for the match group {} on the left hand-side of the operation: [{__name__="a", host="h1", job="x"}, {__name__="a", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary * false ignoring job,zone right job,zone - Inf +grid 100000 10000 10 +series __name__=a,host=h1,job=x ; 9:c082210000000000 +series __name__=a,host=h2,job=y ; 0:40861c0000000000 1:c081f00000000000 2:c082a30000000000 3:c07aea0000000000 4:408ae80000000000 5:407dc40000000000 6:c068f00000000000 7:4089c30000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 1:c081e50000000000 2:7e37e43c8800759c 3:0 4:408b4f0000000000 6:c012800000000000 7:7ff8000000000001 8:4079ba0000000000 9:c064780000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 2:7ff8000000000001 4:c073b80000000000 +series __name__=b,host=h1,job=y,zone=z1 ; +error found duplicate series for the match group {host="h2"} on the left hand-side of the operation: [{__name__="a", host="h2", job="y", zone="z1"}, {__name__="a", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary == true ignoring zone one - Inf - +grid 100000 10000 11 +series __name__=a,host=h2,job=x ; 8:c086c90000000000 9:c03ec00000000000 +series __name__=a,host=h1,job=y ; 1:7ff0000000000000 2:fff0000000000000 3:40814a0000000000 4:406a800000000000 6:c08a8c0000000000 7:40823c0000000000 8:c08c7a0000000000 9:7ff8000000000001 10:408ea00000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 1:408d470000000000 2:4059600000000000 3:4088ef0000000000 4:408cd90000000000 +series __name__=a,host=h1,job=x ; 9:7ff8000000000001 +series __name__=b,host=h1,job=x,zone=z2 ; 3:4076380000000000 4:c077080000000000 +result host=h1,job=x ; 3:0 4:0 +end +case binary == false ignoring - left - NaN - +grid 100000 10000 12 +series __name__=a,host=h2,job=x ; 11:4053d80000000000 +series __name__=a,host=h2,job=y ; 7:406cd00000000000 8:4088190000000000 9:40713a0000000000 10:7ff8000000000001 +series __name__=a,host=h1,job=y ; 9:c0745c0000000000 +series __name__=b,host=h1,job=x ; 7:c07e7c0000000000 8:c079ba0000000000 9:c08b860000000000 10:c082450000000000 +series __name__=b,host=h2,job=y ; 2:4077ea0000000000 3:fff0000000000000 4:408d780000000000 5:c07b4c0000000000 6:c083c90000000000 7:4089db0000000000 8:408a310000000000 9:4088510000000000 10:c088b60000000000 +end +case binary / false none - one - 0 Inf +grid 100000 10000 5 +series __name__=a,host=h1,job=y ; 0:0 1:c08d850000000000 +series __name__=b,host=h1,job=x ; 3:408cc60000000000 +series __name__=b,host=h1,job=y ; 0:4069d00000000000 1:40691c0000000000 2:4076040000000000 3:40875d0000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 2:c05bc00000000000 +result host=h1,job=x ; 3:0 +result host=h1,job=y ; 0:0 1:c012cf699e301c0a 2:0 3:0 +result host=h1,job=y,zone=z2 ; 2:8000000000000000 +end +case binary != true ignoring - left job NaN 1 +grid 100000 10000 6 +series __name__=a,host=h2,job=x ; 3:407b800000000000 +series __name__=a,host=h2,job=y ; 5:c073880000000000 +series __name__=a,host=h1,job=x ; 5:4084650000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 2:c07c3a0000000000 +series __name__=b,host=h1,job=x ; 2:408f370000000000 3:408d430000000000 4:407c000000000000 +series __name__=b,host=h2,job=x ; 1:c080730000000000 +result host=h1,job=x ; 2:3ff0000000000000 3:3ff0000000000000 4:3ff0000000000000 5:3ff0000000000000 +result host=h2,job=x ; 1:3ff0000000000000 3:3ff0000000000000 +result host=h2,job=x,zone=z1 ; 2:3ff0000000000000 +result host=h2,job=y ; 5:3ff0000000000000 +end +case binary ^ false ignoring host right host,zone - 0 +grid 100000 10000 6 +series __name__=a,host=h2,job=x ; 2:407a6a0000000000 +series __name__=a,host=h2,job=y ; 0:0 1:4080950000000000 2:4089ce0000000000 3:c079060000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 5:4070680000000000 +series __name__=b,host=h2,job=y ; 1:4058480000000000 2:4080f50000000000 +result host=h2,job=y ; 1:76e18773d32422b0 2:7ff0000000000000 +end +case binary - false ignoring - right job,zone NaN - +grid 100000 10000 5 +series __name__=a,host=h2,job=y ; 4:7ff8000000000001 +series __name__=a,host=h1,job=y ; 4:408a210000000000 +series __name__=a,host=h2,job=x ; 2:c08bf50000000000 3:c07dea0000000000 +series __name__=b,host=h2,job=y,zone=z2 ; +series __name__=b,host=h2,job=x ; 3:4049600000000000 +series __name__=b,host=h2,job=x,zone=z2 ; 1:c089410000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 1:4063e00000000000 +series __name__=b,host=h1,job=y ; 2:c0801b0000000000 3:c086a20000000000 4:4074960000000000 +result host=h1,job=y ; 4:407fac0000000000 +result host=h2,job=x ; 2:7ff8000000000001 3:c0808b0000000000 +result host=h2,job=y ; 4:7ff8000000000001 +end +case binary <= false ignoring host one - - 1 +grid 100000 10000 2 +series __name__=a,host=h2,job=x ; 1:40780a0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 0:7ff0000000000000 1:4062d80000000000 +series __name__=a,host=h2,job=y ; 1:408bb70000000000 +series __name__=b,host=h2,job=y ; 0:c08d110000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 1:c037e00000000000 +series __name__=b,host=h2,job=x ; 1:7e37e43c8800759c +series __name__=b,host=h1,job=x,zone=z2 ; 0:4086520000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:c088180000000000 +result __name__=a,job=x ; 1:40780a0000000000 +end +case binary % false ignoring job,__name__ right host - NaN +grid 100000 10000 5 +series __name__=a,host=h1,job=x,zone=z1 ; 1:7ff0000000000000 2:c03c800000000000 4:408d1e0000000000 +series __name__=a,host=h1,job=y ; +series __name__=a,host=h2,job=x ; 0:4046e00000000000 1:c081960000000000 2:40812b0000000000 3:c08f1c0000000000 4:4079d40000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 3:4089100000000000 +series __name__=b,host=h1,job=x ; 1:c085590000000000 2:4089750000000000 3:4021800000000000 +result host=h1,job=x ; 1:7ff8000000000001 2:7ff8000000000001 3:7ff8000000000001 +result host=h2,job=x,zone=z1 ; 3:7ff8000000000001 +end +case binary - false on zone right job -2.5 0 +grid 100000 10000 5 +series __name__=a,host=h2,job=y,zone=z1 ; 1:407bf60000000000 2:408eff0000000000 3:7ff8000000000001 4:fff0000000000000 +series __name__=a,host=h1,job=x ; 4:40782a0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; +series __name__=b,host=h2,job=y,zone=z1 ; 0:c0706a0000000000 1:4088500000000000 +series __name__=b,host=h1,job=x ; 3:c04cb00000000000 +series __name__=b,host=h2,job=x ; 4:7ff8000000000001 +result host=h1 ; 3:404cb00000000000 +result host=h2,job=x ; 4:7ff8000000000001 +result host=h2,job=y,zone=z1 ; 1:c074aa0000000000 +result host=h2,zone=z1 ; 0:40706a0000000000 +result job=y,zone=z1 ; 2:408f130000000000 3:7ff8000000000001 4:fff0000000000000 +end +case binary <= true ignoring host left - 0 1 +grid 100000 10000 1 +series __name__=a,host=h2,job=x,zone=z1 ; 0:c083b60000000000 +series __name__=a,host=h1,job=x ; 0:c08b840000000000 +series __name__=a,host=h2,job=y,zone=z1 ; +series __name__=b,host=h2,job=x,zone=z2 ; 0:c08df20000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 0:c051780000000000 +series __name__=b,host=h1,job=x ; 0:c087c40000000000 +result host=h1,job=x ; 0:3ff0000000000000 +result host=h2,job=x,zone=z1 ; 0:3ff0000000000000 +result job=x,zone=z2 ; 0:0 +result job=y,zone=z1 ; 0:0 +end +case binary >= false on - one - 1 1 +grid 100000 10000 6 +series __name__=a,host=h1,job=x ; 5:fff0000000000000 +series __name__=a,host=h1,job=y ; 0:7ff8000000000001 1:4087460000000000 +series __name__=b,host=h1,job=y ; 0:7ff0000000000000 1:405de80000000000 2:c087a40000000000 3:40740e0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 4:c0857b0000000000 5:7e37e43c8800759c +series __name__=b,host=h1,job=x ; 5:c077da0000000000 +error found duplicate series for the match group {} on the right hand-side of the operation: [{__name__="b", host="h1", job="x", zone="z1"}, {__name__="b", host="h1", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary ^ false ignoring host,zone one - 0 0 +grid 100000 10000 10 +series __name__=a,host=h2,job=y,zone=z1 ; 7:c070fc0000000000 +series __name__=a,host=h1,job=x ; 8:c0894b0000000000 +series __name__=a,host=h1,job=y ; 0:c07e2c0000000000 1:7ff8000000000001 2:c081460000000000 3:4057880000000000 4:c06c540000000000 5:40774e0000000000 6:c0722c0000000000 +series __name__=a,host=h2,job=y ; 9:c0805f0000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 0:405d800000000000 1:c087570000000000 3:40860d0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 7:408bca0000000000 8:4047e00000000000 +series __name__=b,host=h1,job=x ; 4:4044200000000000 +series __name__=b,host=h2,job=y ; 7:c05d500000000000 8:c05c600000000000 +series __name__=b,host=h1,job=y ; 3:7ff8000000000001 +error multiple matches for labels: many-to-one matching must be explicit (group_left/group_right) +end +case binary >= false ignoring - left host,zone 0 0 +grid 100000 10000 3 +series __name__=a,host=h2,job=x ; 1:c069cc0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 1:4040a00000000000 2:40845b0000000000 +series __name__=a,host=h2,job=y ; 2:c079b20000000000 +series __name__=a,host=h1,job=x ; 0:7e37e43c8800759c 1:408a830000000000 2:fff0000000000000 +series __name__=b,host=h2,job=x ; 1:0 +series __name__=b,host=h1,job=x,zone=z1 ; 0:c075960000000000 +result __name__=a,host=h1,job=x ; 0:7e37e43c8800759c 1:408a830000000000 +result __name__=a,host=h1,job=x,zone=z1 ; 1:4040a00000000000 2:40845b0000000000 +result host=h1,job=x,zone=z1 ; 0:0 +end +case binary > false ignoring zone left job,zone -2.5 - +grid 100000 10000 5 +series __name__=a,host=h2,job=y ; 4:c0855a0000000000 +series __name__=b,host=h2,job=y ; 3:c072a40000000000 4:408cc30000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 4:c05e380000000000 +series __name__=b,host=h2,job=x ; +result host=h2,job=x,zone=z1 ; 4:c004000000000000 +result host=h2,job=y ; 3:c004000000000000 +end +case binary != false ignoring job,zone one - - 0 +grid 100000 10000 2 +series __name__=a,host=h2,job=y ; 0:c0875b0000000000 +series __name__=a,host=h1,job=x ; 1:4071320000000000 +series __name__=a,host=h1,job=y ; 0:c078ce0000000000 1:c0833c0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 0:408aac0000000000 +series __name__=b,host=h2,job=y ; 0:fff0000000000000 +series __name__=b,host=h1,job=y ; 1:7ff0000000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 1:c08cba0000000000 +error multiple matches for labels: many-to-one matching must be explicit (group_left/group_right) +end +case binary atan2 false ignoring host right host 1 - +grid 100000 10000 7 +series __name__=a,host=h2,job=y,zone=z1 ; 2:407e940000000000 3:4068180000000000 4:4066500000000000 5:408dfe0000000000 +series __name__=a,host=h2,job=x ; 2:4069ec0000000000 3:408b2a0000000000 4:fff0000000000000 +series __name__=a,host=h1,job=y ; 0:c081bf0000000000 +series __name__=a,host=h1,job=x ; 4:408c210000000000 5:c06b880000000000 +series __name__=a,host=h2,job=y ; 6:405bd00000000000 +series __name__=b,host=h2,job=x,zone=z2 ; 6:c079040000000000 +series __name__=b,host=h1,job=x ; 0:c074a60000000000 2:408c110000000000 4:4083b40000000000 +series __name__=b,host=h1,job=y ; 4:c083ab0000000000 5:c08bf20000000000 6:4080580000000000 +error found duplicate series for the match group {job="x"} on the left hand-side of the operation: [{__name__="a", host="h1", job="x"}, {__name__="a", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary atan2 false none - one - -2.5 Inf +grid 100000 10000 12 +series __name__=a,host=h1,job=x ; +series __name__=a,host=h2,job=y ; 4:4089320000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 3:c0857a0000000000 4:7ff8000000000001 5:c086a20000000000 6:4076e20000000000 7:408b9a0000000000 8:c016800000000000 9:c08b740000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 6:40844b0000000000 7:0 8:407ba40000000000 9:4054300000000000 10:c070e60000000000 11:7ff8000000000001 +series __name__=a,host=h2,job=x ; 7:40849f0000000000 9:c086060000000000 10:c068f40000000000 +series __name__=b,host=h1,job=x ; 10:c08f270000000000 11:fff0000000000000 +series __name__=b,host=h2,job=y ; 3:408e310000000000 4:406ef80000000000 5:403ec00000000000 6:c06ab40000000000 7:c08d660000000000 9:407f2a0000000000 10:40763e0000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 9:c050480000000000 10:c074880000000000 +result host=h1,job=x ; 10:c0091cd880c9f449 11:c00921fb54442d18 +result host=h1,job=y,zone=z1 ; 3:8000000000000000 4:7ff8000000000001 5:8000000000000000 6:0 7:0 8:8000000000000000 9:8000000000000000 +result host=h1,job=y,zone=z2 ; 9:c008d366fcdc2a03 10:c00912656416c41a +result host=h2,job=x ; 7:0 9:8000000000000000 10:8000000000000000 +result host=h2,job=x,zone=z1 ; 6:0 7:0 8:0 9:0 10:8000000000000000 11:7ff8000000000001 +result host=h2,job=y ; 3:bf6532b29b492203 4:3ff45cd8f7d1314f 5:bfb4c46fe50bf1cf 6:c0090a03ff6e0fcd 7:c0091c8a0fa57e87 9:bf74894b2b15c02f 10:bf7cc60f8f0a99b8 +end +case binary <= true on host,zone one - NaN - +grid 100000 10000 1 +series __name__=a,host=h2,job=x ; +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=b,host=h2,job=x,zone=z2 ; +end +case binary != true on job,zone left - NaN NaN +grid 100000 10000 4 +series __name__=a,host=h1,job=y ; +series __name__=a,host=h1,job=x ; 0:c058580000000000 1:7ff8000000000001 +series __name__=a,host=h2,job=x,zone=z1 ; 2:c0805f0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 2:c0834e0000000000 +series __name__=b,host=h2,job=x ; 2:4070e40000000000 +series __name__=b,host=h1,job=y ; 3:4082320000000000 +series __name__=b,host=h2,job=y ; 0:407a2e0000000000 +result host=h1,job=x ; 0:3ff0000000000000 1:3ff0000000000000 +result host=h1,job=x,zone=z1 ; 2:3ff0000000000000 +result host=h2,job=x,zone=z1 ; 2:3ff0000000000000 +result job=x ; 2:3ff0000000000000 +result job=y ; 0:3ff0000000000000 3:3ff0000000000000 +end +case binary * false ignoring host,zone right job,zone - 1 +grid 100000 10000 1 +series __name__=a,host=h2,job=x ; 0:4070d80000000000 +series __name__=b,host=h2,job=y ; +end +case binary % false on - left host - -2.5 +grid 100000 10000 8 +series __name__=a,host=h1,job=y,zone=z1 ; 6:7e37e43c8800759c +series __name__=b,host=h2,job=y,zone=z1 ; 7:c055b80000000000 +series __name__=b,host=h1,job=x ; 1:7ff8000000000001 2:408ab40000000000 3:7ff8000000000001 4:406c200000000000 5:4084b40000000000 +result job=y,zone=z1 ; 6:0 +end +case binary atan2 false on job right host,zone Inf Inf +grid 100000 10000 10 +series __name__=a,host=h1,job=y ; 9:c081b70000000000 +series __name__=a,host=h1,job=x ; 9:40808e0000000000 +series __name__=b,host=h2,job=x ; 5:408a1e0000000000 6:c08b540000000000 7:4043100000000000 9:c078260000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 2:c06ba00000000000 3:408ca40000000000 4:7ff8000000000001 5:c087b00000000000 7:c08dcd0000000000 8:4063780000000000 9:7e37e43c8800759c +result host=h1,job=x ; 9:40019b8cd194018d +result host=h1,job=y ; 9:8237ba1d4a6e81ed +result job=x ; 5:3ff921fb54442d18 6:3ff921fb54442d18 7:3ff921fb54442d18 +result job=y ; 2:3ff921fb54442d18 3:3ff921fb54442d18 4:7ff8000000000001 5:3ff921fb54442d18 7:3ff921fb54442d18 8:3ff921fb54442d18 +end +case binary == true on job,zone one - - 1 +grid 100000 10000 6 +series __name__=a,host=h2,job=x,zone=z1 ; 2:4075d80000000000 3:c070c60000000000 4:408df30000000000 +series __name__=a,host=h2,job=y ; 2:c0818a0000000000 4:405b080000000000 +series __name__=a,host=h1,job=x ; 4:c081cc0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 5:406e9c0000000000 +series __name__=b,host=h1,job=x ; 4:c074720000000000 +series __name__=b,host=h2,job=y ; 0:c041c00000000000 1:408d2a0000000000 2:c063440000000000 4:4066a00000000000 5:c089ee0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:40799c0000000000 1:407fbe0000000000 2:c064cc0000000000 3:4078aa0000000000 4:c07a480000000000 +series __name__=b,host=h1,job=y ; 2:4043000000000000 3:0 4:c034400000000000 +error found duplicate series for the match group {job="y"} on the right hand-side of the operation: [{__name__="b", host="h1", job="y"}, {__name__="b", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary <= false none - one - 1 1 +grid 100000 10000 6 +series __name__=a,host=h2,job=x ; 4:7ff8000000000001 5:c07fea0000000000 +series __name__=a,host=h1,job=x,zone=z1 ; +series __name__=a,host=h2,job=y ; 4:7ff0000000000000 5:c084ef0000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 0:4082a20000000000 1:4085e90000000000 2:408f0e0000000000 3:7ff8000000000001 4:4087080000000000 5:4083310000000000 +series __name__=b,host=h2,job=x ; 5:4072c60000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:4077a60000000000 1:c061ec0000000000 3:4062d40000000000 +result __name__=a,host=h2,job=x ; 5:c07fea0000000000 +result __name__=a,host=h2,job=y ; 5:c084ef0000000000 +end +case binary > false on host,__name__ right job NaN NaN +grid 100000 10000 6 +series __name__=a,host=h2,job=y,zone=z1 ; 4:405b400000000000 +series __name__=a,host=h2,job=y ; 2:fff0000000000000 +series __name__=a,host=h1,job=y ; 4:c073e80000000000 +series __name__=b,host=h2,job=y ; 5:c064580000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:40801c0000000000 1:4075d20000000000 2:408c880000000000 3:c078300000000000 4:c08d1b0000000000 5:40740a0000000000 +series __name__=b,host=h2,job=x ; 2:4071ac0000000000 +series __name__=b,host=h1,job=y ; 2:4077500000000000 3:407cba0000000000 +end +case binary + false on host,zone one - Inf Inf +grid 100000 10000 12 +series __name__=a,host=h2,job=y ; +series __name__=a,host=h2,job=x ; 8:c087a80000000000 10:408be20000000000 11:7e37e43c8800759c +series __name__=a,host=h2,job=y,zone=z1 ; 10:407dc80000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 11:c07c9e0000000000 +series __name__=b,host=h1,job=x ; 7:407c2a0000000000 8:fff0000000000000 9:403a600000000000 11:4051080000000000 +series __name__=b,host=h2,job=x ; 5:c0832c0000000000 6:407ede0000000000 +result host=h1 ; 7:7ff0000000000000 8:fff8000000000000 9:7ff0000000000000 11:7ff0000000000000 +result host=h2 ; 5:7ff0000000000000 6:7ff0000000000000 8:7ff0000000000000 10:7ff0000000000000 11:7ff0000000000000 +result host=h2,zone=z1 ; 10:7ff0000000000000 11:7ff0000000000000 +end +case binary == true on host right zone 1 Inf +grid 100000 10000 4 +series __name__=a,host=h1,job=x ; 1:c06e880000000000 +series __name__=a,host=h2,job=y ; +series __name__=b,host=h1,job=y,zone=z1 ; 0:c07c560000000000 1:407a740000000000 2:c08bbf0000000000 +series __name__=b,host=h1,job=x ; 3:4087c90000000000 +series __name__=b,host=h2,job=y ; 0:408c870000000000 1:c0831c0000000000 2:c07b880000000000 +result host=h1,job=x ; 3:0 +result host=h1,job=y ; 0:0 1:0 2:0 +result host=h2,job=y ; 0:0 1:0 2:0 +end +case binary / false ignoring host,job,zone one - 1 - +grid 100000 10000 5 +series __name__=a,host=h2,job=y ; 1:c08d630000000000 2:c07ad80000000000 +series __name__=a,host=h1,job=y ; 0:4087b00000000000 1:4089270000000000 2:4083e40000000000 3:c058d80000000000 4:408c400000000000 +series __name__=a,host=h1,job=x ; 0:c088860000000000 2:4069580000000000 3:c086c90000000000 4:404b600000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 1:7ff0000000000000 3:407f600000000000 +error multiple matches for labels: many-to-one matching must be explicit (group_left/group_right) +end +case binary <= true ignoring host right job - 1 +grid 100000 10000 7 +series __name__=a,host=h1,job=x ; 4:c080f90000000000 +series __name__=a,host=h2,job=y ; 4:c08e420000000000 5:407ae20000000000 6:7ff8000000000001 +series __name__=a,host=h1,job=y ; 2:c08bf20000000000 +series __name__=b,host=h1,job=x ; 4:4051c00000000000 +result host=h1,job=x ; 4:3ff0000000000000 +end +case binary - false on zone left job NaN - +grid 100000 10000 3 +series __name__=a,host=h2,job=x ; 1:0 +series __name__=b,host=h2,job=x,zone=z1 ; 2:405fc00000000000 +series __name__=b,host=h1,job=x ; 2:405cd80000000000 +series __name__=b,host=h2,job=x ; 0:408d890000000000 2:c08f390000000000 +error found duplicate series for the match group {} on the right hand-side of the operation: [{__name__="b", host="h1", job="x"}, {__name__="b", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary % false on host right job Inf Inf +grid 100000 10000 12 +series __name__=a,host=h1,job=x ; 9:40802e0000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 4:408e450000000000 5:4057600000000000 6:c0704a0000000000 7:4083470000000000 10:4088ad0000000000 11:4086ac0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 9:408d750000000000 10:40866a0000000000 +result host=h1,job=x ; 9:40802e0000000000 +result host=h2,job=x ; 4:408e450000000000 5:4057600000000000 6:c0704a0000000000 7:4083470000000000 11:4086ac0000000000 +result host=h2,job=x,zone=z1 ; 10:4052180000000000 +result host=h2,zone=z1 ; 9:7ff8000000000001 +end +case binary >= false ignoring - left - 0 - +grid 100000 10000 1 +series __name__=a,host=h2,job=y ; 0:408d180000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 0:c06da40000000000 +series __name__=a,host=h1,job=y ; 0:408e670000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:c089ef0000000000 +series __name__=b,host=h1,job=x ; 0:407d520000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 0:c08f300000000000 +series __name__=b,host=h2,job=y ; 0:c07d6a0000000000 +result __name__=a,host=h2,job=y ; 0:408d180000000000 +result host=h2,job=y,zone=z1 ; 0:0 +end +case binary - false none - one - Inf - +grid 100000 10000 4 +series __name__=a,host=h1,job=x ; 3:7ff8000000000001 +series __name__=a,host=h1,job=y,zone=z1 ; 0:407a760000000000 1:c070240000000000 2:4041d00000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 2:c087850000000000 3:0 +series __name__=b,host=h1,job=x ; 2:4084790000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:c07cce0000000000 2:c043b00000000000 +result host=h1,job=x ; 2:7ff0000000000000 +result host=h1,job=x,zone=z1 ; 0:7ff0000000000000 2:7ff0000000000000 +result host=h1,job=y,zone=z1 ; 2:4088a20000000000 3:7ff0000000000000 +end +case binary atan2 false none - one - 1 1 +grid 100000 10000 11 +series __name__=a,host=h1,job=y,zone=z1 ; 2:c079aa0000000000 3:c0839f0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; +series __name__=a,host=h2,job=y ; 3:408a080000000000 4:4067600000000000 5:c088d10000000000 6:0 +series __name__=a,host=h1,job=x ; 8:c087ef0000000000 9:4075060000000000 +series __name__=a,host=h1,job=y ; 10:4082810000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 9:c08e960000000000 +result host=h1,job=x ; 8:bff91ca235567358 9:3ff915ce0e38cd2d +result host=h1,job=y ; 10:3ff91b107626535d +result host=h1,job=y,zone=z1 ; 2:bff91801b9770412 3:bff91b754a896035 9:40091fe3a889265a +result host=h2,job=y ; 3:3ff91d1088f92cb4 4:3ff90c14063a4079 5:bff91cd2e9bdcafb 6:0 +end +case binary > false on host,zone right - Inf - +grid 100000 10000 9 +series __name__=a,host=h2,job=y,zone=z1 ; 6:c08bff0000000000 7:c08d170000000000 8:4067500000000000 +series __name__=a,host=h2,job=y ; 2:7ff8000000000001 4:40821e0000000000 +series __name__=b,host=h2,job=y ; 7:c08a5d0000000000 +series __name__=b,host=h1,job=y ; 1:408bd70000000000 2:4056380000000000 3:fff0000000000000 +series __name__=b,host=h2,job=y,zone=z2 ; 7:4088e20000000000 8:4080ad0000000000 +end +case binary % false on job left - -2.5 -2.5 +grid 100000 10000 8 +series __name__=a,host=h2,job=x ; 5:7e37e43c8800759c +series __name__=a,host=h2,job=x,zone=z1 ; 5:40798a0000000000 +series __name__=a,host=h1,job=y ; 6:c055a80000000000 +series __name__=b,host=h1,job=y ; +series __name__=b,host=h2,job=y,zone=z1 ; 7:40745c0000000000 +series __name__=b,host=h2,job=x ; 1:406cd00000000000 3:fff0000000000000 +result host=h1,job=y ; 6:bffa000000000000 +result host=h2,job=x ; 5:0 +result host=h2,job=x,zone=z1 ; 5:3ff2000000000000 +result job=x ; 1:c004000000000000 3:c004000000000000 +result job=y ; 7:c004000000000000 +end +case binary / false on host,job,zone left - - 1 +grid 100000 10000 10 +series __name__=a,host=h2,job=x,zone=z1 ; 5:c085820000000000 6:c07dc00000000000 7:c03c600000000000 8:4053300000000000 9:406c680000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 7:4088470000000000 +series __name__=a,host=h1,job=x ; 9:c089870000000000 +series __name__=a,host=h1,job=y ; 5:c072e40000000000 6:c08d2b0000000000 +series __name__=a,host=h2,job=y ; 7:40807a0000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 7:404ce00000000000 8:fff0000000000000 +series __name__=b,host=h1,job=y ; 6:7e37e43c8800759c 7:c08a430000000000 +result host=h1,job=x ; 9:c089870000000000 +result host=h1,job=x,zone=z1 ; 7:4088470000000000 +result host=h1,job=y ; 5:c072e40000000000 6:82438898c35f9b0f +result host=h2,job=x,zone=z1 ; 5:c085820000000000 6:c07dc00000000000 7:bfdf7225adfdc897 8:8000000000000000 9:406c680000000000 +result host=h2,job=y ; 7:40807a0000000000 +end +case binary % false ignoring job right - NaN NaN +grid 100000 10000 9 +series __name__=a,host=h1,job=y,zone=z1 ; 5:c08c320000000000 6:c04ff00000000000 7:408cce0000000000 8:c086b20000000000 +series __name__=a,host=h1,job=x ; +series __name__=b,host=h1,job=x,zone=z1 ; 2:c086cb0000000000 3:4081070000000000 +series __name__=b,host=h1,job=x ; 4:4081e90000000000 5:7e37e43c8800759c 6:c040800000000000 +result host=h1,job=x ; 4:7ff8000000000001 5:7ff8000000000001 6:7ff8000000000001 +result host=h1,job=x,zone=z1 ; 2:7ff8000000000001 3:7ff8000000000001 +result host=h1,zone=z1 ; 5:7ff8000000000001 6:7ff8000000000001 7:7ff8000000000001 8:7ff8000000000001 +end +case binary < false none - one - Inf Inf +grid 100000 10000 3 +series __name__=a,host=h2,job=y ; 2:4081600000000000 +series __name__=b,host=h2,job=y,zone=z2 ; 0:c072f40000000000 1:c08e900000000000 +result __name__=a,host=h2,job=y ; 2:4081600000000000 +end +case binary % false none - one - - NaN +grid 100000 10000 5 +series __name__=a,host=h2,job=x,zone=z1 ; 4:408c220000000000 +series __name__=a,host=h1,job=x ; 3:fff0000000000000 +series __name__=b,host=h2,job=y ; 0:c08d5b0000000000 1:4083e50000000000 2:0 3:c070540000000000 4:4083960000000000 +result host=h1,job=x ; 3:7ff8000000000001 +result host=h2,job=x,zone=z1 ; 4:7ff8000000000001 +end +case binary <= false ignoring host,zone one - 1 0 +grid 100000 10000 6 +series __name__=a,host=h1,job=y,zone=z1 ; 3:c06d2c0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 3:408e380000000000 4:c087c20000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 4:c069440000000000 5:c0807f0000000000 +series __name__=a,host=h2,job=x ; 3:7e37e43c8800759c +series __name__=b,host=h1,job=y ; 2:4080f00000000000 +series __name__=b,host=h1,job=x ; 3:4050080000000000 4:4086500000000000 +error multiple matches for labels: many-to-one matching must be explicit (group_left/group_right) +end +case binary ^ false ignoring - right job - NaN +grid 100000 10000 8 +series __name__=a,host=h2,job=x ; 4:4074440000000000 +series __name__=a,host=h2,job=y ; 6:c08dae0000000000 +series __name__=a,host=h1,job=x ; 2:c07c740000000000 3:c075120000000000 4:7ff8000000000001 5:4068440000000000 7:4088ac0000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 1:4072040000000000 2:406e2c0000000000 3:408d9b0000000000 4:c081100000000000 5:c052800000000000 +series __name__=a,host=h1,job=y,zone=z1 ; 4:4080f70000000000 5:c058380000000000 +series __name__=b,host=h2,job=y ; 5:4084e80000000000 6:7ff8000000000001 7:40874b0000000000 +series __name__=b,host=h2,job=x,zone=z2 ; 0:4072760000000000 3:40809b0000000000 5:7ff8000000000001 +series __name__=b,host=h2,job=x ; 4:c064a00000000000 5:fff0000000000000 +result host=h2,job=x ; 4:0 5:7ff8000000000001 +result host=h2,job=x,zone=z2 ; 0:7ff8000000000001 3:7ff8000000000001 5:7ff8000000000001 +result host=h2,job=y ; 5:7ff8000000000001 6:7ff8000000000001 7:7ff8000000000001 +end +case binary - false ignoring host,zone left host,job,zone - 1 +grid 100000 10000 10 +series __name__=a,host=h1,job=x ; 3:40824a0000000000 4:4082910000000000 5:4084ce0000000000 +series __name__=a,host=h2,job=x ; 8:c0805d0000000000 9:c078fa0000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 6:c080680000000000 7:c07c500000000000 +series __name__=b,host=h1,job=y ; 5:4065500000000000 6:c080380000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 7:408d780000000000 8:4089a40000000000 +series __name__=b,host=h1,job=x ; 7:4080e70000000000 8:4071bc0000000000 +error found duplicate series for the match group {job="x"} on the right hand-side of the operation: [{__name__="b", host="h1", job="x"}, {__name__="b", host="h2", job="x", zone="z1"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary + false none - one - 1 Inf +grid 100000 10000 8 +series __name__=a,host=h2,job=y ; 1:7e37e43c8800759c 2:c08c510000000000 3:4073d60000000000 4:407c880000000000 5:c082c20000000000 6:c075240000000000 7:4069cc0000000000 +series __name__=a,host=h1,job=y ; 1:40719e0000000000 2:7ff0000000000000 3:4078620000000000 +series __name__=b,host=h1,job=x ; 4:fff0000000000000 5:c075bc0000000000 +series __name__=b,host=h1,job=y ; 4:c066e40000000000 +series __name__=b,host=h2,job=y ; 3:4089e70000000000 +result host=h1,job=x ; 4:fff0000000000000 5:c075ac0000000000 +result host=h1,job=y ; 1:7ff0000000000000 2:7ff0000000000000 3:7ff0000000000000 4:c066c40000000000 +result host=h2,job=y ; 1:7ff0000000000000 2:7ff0000000000000 3:4091e90000000000 4:7ff0000000000000 5:7ff0000000000000 6:7ff0000000000000 7:7ff0000000000000 +end +case binary != true on host one - 0 -2.5 +grid 100000 10000 2 +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=b,host=h2,job=x,zone=z2 ; 1:4080e00000000000 +result host=h2 ; 1:3ff0000000000000 +end +case binary < true ignoring job one - -2.5 0 +grid 100000 10000 3 +series __name__=a,host=h1,job=y,zone=z1 ; 0:c072d20000000000 1:c08cc80000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 0:408ea70000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 0:7ff8000000000001 +error found duplicate series for the match group {host="h1", zone="z1"} on the right hand-side of the operation: [{__name__="b", host="h1", job="x", zone="z1"}, {__name__="b", host="h1", job="y", zone="z1"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary ^ false ignoring job,zone left job 1 1 +grid 100000 10000 9 +series __name__=a,host=h2,job=y ; 5:c07bce0000000000 7:4079f00000000000 8:c08a8f0000000000 +series __name__=a,host=h1,job=x ; 7:408c0c0000000000 +series __name__=a,host=h2,job=x ; 2:4072000000000000 3:c08e720000000000 4:c085670000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 3:4080750000000000 4:4083940000000000 6:c081ff0000000000 7:4077aa0000000000 +series __name__=b,host=h1,job=x ; 3:0 4:4080090000000000 5:4020000000000000 6:406bfc0000000000 +result host=h1 ; 7:408c0c0000000000 +result host=h1,job=x ; 3:3ff0000000000000 4:3ff0000000000000 5:3ff0000000000000 6:3ff0000000000000 +result host=h2 ; 2:4072000000000000 5:c07bce0000000000 8:c08a8f0000000000 +result host=h2,job=y ; 3:7ff8000000000001 4:7ff8000000000001 6:3ff0000000000000 7:7ff0000000000000 +end +case binary / false ignoring host right host,job -2.5 -2.5 +grid 100000 10000 8 +series __name__=a,host=h1,job=x ; 3:4083950000000000 4:407e500000000000 +series __name__=a,host=h1,job=y ; 2:7ff8000000000001 3:c086880000000000 5:4075040000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 5:7ff8000000000001 6:c07f680000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 2:4073860000000000 +series __name__=b,host=h1,job=x ; 7:40830f0000000000 +series __name__=b,host=h1,job=y ; 2:c022000000000000 3:c06f480000000000 4:407a0c0000000000 5:4065a40000000000 +result host=h1,job=x ; 3:c06f54cccccccccd 4:c068400000000000 +result host=h1,job=y ; 2:7ff8000000000001 3:40070c880e525983 5:3fff13686ee70c04 +result host=h2,job=y,zone=z1 ; 5:7ff8000000000001 6:4069200000000000 +result job=x ; 7:bf70ca52cc1b7e81 +result job=y ; 4:bf789232ad8885ea +result job=y,zone=z1 ; 2:bf8063fb7e1ad6ec +end +case binary % false on host,zone right - -2.5 -2.5 +grid 100000 10000 12 +series __name__=a,host=h2,job=y ; 7:4075e00000000000 +series __name__=a,host=h1,job=y ; 7:c0750e0000000000 8:c07d080000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 2:407ae80000000000 3:c04a800000000000 4:c052f80000000000 5:c087f50000000000 6:4060b00000000000 7:c089420000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 3:c0818d0000000000 4:c051780000000000 +series __name__=b,host=h1,job=y ; 9:4089cf0000000000 10:c075480000000000 +series __name__=b,host=h2,job=y ; 11:c08bf40000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 10:fff0000000000000 11:c07d380000000000 +result host=h1 ; 7:bffe000000000000 8:c000000000000000 +result host=h1,job=x,zone=z1 ; 3:c004000000000000 4:c004000000000000 +result host=h1,job=y ; 9:c004000000000000 10:c004000000000000 +result host=h1,job=y,zone=z1 ; 2:c004000000000000 3:c004000000000000 4:c004000000000000 5:c004000000000000 6:c004000000000000 7:c004000000000000 +result host=h2 ; 7:0 +result host=h2,job=x,zone=z1 ; 10:c004000000000000 11:c004000000000000 +result host=h2,job=y ; 11:c004000000000000 +end +case binary == false ignoring job left - NaN NaN +grid 100000 10000 5 +series __name__=a,host=h2,job=y,zone=z1 ; 0:0 1:4088a70000000000 2:4067840000000000 +series __name__=a,host=h1,job=y ; 4:4073140000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 3:c0852b0000000000 +series __name__=a,host=h2,job=x ; 0:4087550000000000 1:7ff8000000000001 2:404ab00000000000 3:c0817a0000000000 4:c04b600000000000 +series __name__=b,host=h1,job=y ; +series __name__=b,host=h2,job=y ; 4:7ff0000000000000 +series __name__=b,host=h2,job=x ; +end +case binary % false none - one - Inf NaN +grid 100000 10000 7 +series __name__=a,host=h1,job=y ; 4:7e37e43c8800759c 5:c05a000000000000 +series __name__=a,host=h2,job=x,zone=z1 ; +series __name__=a,host=h1,job=y,zone=z1 ; 1:405b280000000000 2:c08d3f0000000000 3:408b180000000000 4:4080400000000000 5:4064500000000000 6:4056780000000000 +series __name__=a,host=h2,job=x ; 5:405d080000000000 +series __name__=b,host=h1,job=x ; 2:408f180000000000 3:c029800000000000 4:c068f40000000000 5:c072760000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 1:4087490000000000 2:c082120000000000 3:4067280000000000 4:fff0000000000000 5:c089fe0000000000 6:c05e780000000000 +series __name__=b,host=h1,job=y ; 1:4082600000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:4073c00000000000 +result host=h1,job=x ; 2:7ff8000000000001 3:7ff8000000000001 4:7ff8000000000001 5:7ff8000000000001 +result host=h1,job=x,zone=z1 ; 1:7ff8000000000001 2:7ff8000000000001 3:7ff8000000000001 4:7ff8000000000001 5:7ff8000000000001 6:7ff8000000000001 +result host=h1,job=y ; 1:7ff8000000000001 4:7ff8000000000001 5:7ff8000000000001 +result host=h1,job=y,zone=z1 ; 1:7ff8000000000001 2:7ff8000000000001 3:7ff8000000000001 4:7ff8000000000001 5:7ff8000000000001 6:7ff8000000000001 +result host=h2,job=x ; 5:7ff8000000000001 +result host=h2,job=x,zone=z1 ; 0:7ff8000000000001 +end +case binary % false ignoring job right zone 0 0 +grid 100000 10000 3 +series __name__=a,host=h2,job=y ; 1:4080fc0000000000 +series __name__=a,host=h2,job=x ; 0:c077d60000000000 1:0 2:c08ee80000000000 +series __name__=b,host=h2,job=y ; 0:4078cc0000000000 1:c0786e0000000000 2:4061580000000000 +series __name__=b,host=h1,job=x ; +error found duplicate series for the match group {host="h2"} on the left hand-side of the operation: [{__name__="a", host="h2", job="x"}, {__name__="a", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary % false ignoring host,zone right host - 0 +grid 100000 10000 4 +series __name__=a,host=h1,job=x ; 2:7ff0000000000000 3:4064b40000000000 +series __name__=a,host=h1,job=y ; 0:fff0000000000000 +series __name__=a,host=h2,job=x ; 3:c07f8c0000000000 +series __name__=b,host=h1,job=y ; 1:c08d440000000000 +series __name__=b,host=h1,job=x,zone=z2 ; 0:c052400000000000 1:c079b40000000000 +series __name__=b,host=h2,job=x ; 1:0 2:c072620000000000 +error found duplicate series for the match group {job="x"} on the left hand-side of the operation: [{__name__="a", host="h1", job="x"}, {__name__="a", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary - false ignoring host,job,zone right job,zone 0 -2.5 +grid 100000 10000 1 +series __name__=a,host=h1,job=y ; 0:4089720000000000 +series __name__=a,host=h2,job=x ; 0:c077ce0000000000 +series __name__=a,host=h1,job=x ; +series __name__=b,host=h1,job=y ; 0:7ff8000000000001 +series __name__=b,host=h2,job=x ; 0:405a480000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:c073be0000000000 +series __name__=b,host=h1,job=x ; 0:4081c70000000000 +error found duplicate series for the match group {} on the left hand-side of the operation: [{__name__="a", host="h1", job="y"}, {__name__="a", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary != false ignoring host,zone,__name__ one - - Inf +grid 100000 10000 5 +series __name__=a,host=h1,job=y,zone=z1 ; 1:4086f10000000000 2:4077b20000000000 4:7ff8000000000001 +series __name__=a,host=h2,job=y ; 4:408aac0000000000 +series __name__=b,host=h2,job=y ; 2:408e000000000000 3:403ec00000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 2:c0699c0000000000 3:7ff8000000000001 +error found duplicate series for the match group {job="y"} on the right hand-side of the operation: [{__name__="b", host="h1", job="y", zone="z1"}, {__name__="b", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary * false ignoring zone left host,zone Inf 1 +grid 100000 10000 5 +series __name__=a,host=h2,job=x,zone=z1 ; 1:7e37e43c8800759c 2:c087e10000000000 3:c073540000000000 +series __name__=a,host=h2,job=x ; 0:c054b00000000000 1:c080310000000000 2:402a000000000000 3:408aca0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; +series __name__=a,host=h2,job=y ; 4:c08de70000000000 +series __name__=b,host=h2,job=x,zone=z2 ; 3:4083020000000000 +series __name__=b,host=h2,job=y ; 1:fff0000000000000 2:406a740000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 0:7ff8000000000001 1:408e280000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 0:0 2:7ff0000000000000 3:40779e0000000000 4:408a270000000000 +error found duplicate series for the match group {host="h2", job="y"} on the right hand-side of the operation: [{__name__="b", host="h2", job="y", zone="z1"}, {__name__="b", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary <= true ignoring host,job right host,job,zone Inf Inf +grid 100000 10000 7 +series __name__=a,host=h2,job=y,zone=z1 ; 5:407fb20000000000 +series __name__=b,host=h2,job=y,zone=z1 ; +result host=h2,job=y,zone=z1 ; 5:3ff0000000000000 +end +case binary == false ignoring host,job right job,zone NaN 1 +grid 100000 10000 10 +series __name__=a,host=h1,job=x,zone=z1 ; 1:c07bbc0000000000 2:7ff8000000000001 3:c083fa0000000000 +series __name__=a,host=h1,job=y ; 7:c0603c0000000000 +series __name__=a,host=h2,job=y,zone=z1 ; 2:c08c610000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 2:c03d000000000000 3:405fe80000000000 4:4077820000000000 5:408a060000000000 6:4089090000000000 7:7ff0000000000000 9:405e500000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 1:c067d40000000000 2:4020c00000000000 3:c037600000000000 4:c083910000000000 5:c08b360000000000 +series __name__=b,host=h1,job=x,zone=z1 ; 1:c0876c0000000000 4:7ff8000000000001 5:407afa0000000000 6:c087160000000000 +error found duplicate series for the match group {zone="z1"} on the left hand-side of the operation: [{__name__="a", host="h1", job="x", zone="z1"}, {__name__="a", host="h2", job="y", zone="z1"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary atan2 false on host,__name__ one - Inf - +grid 100000 10000 2 +series __name__=a,host=h1,job=y,zone=z1 ; +series __name__=a,host=h1,job=x,zone=z1 ; +series __name__=a,host=h2,job=x ; 0:c077ac0000000000 +series __name__=a,host=h1,job=x ; 1:408a780000000000 +series __name__=b,host=h2,job=x ; 1:4081d90000000000 +series __name__=b,host=h2,job=y ; 1:405e400000000000 +series __name__=b,host=h1,job=x ; 1:c08b8b0000000000 +error found duplicate series for the match group {__name__="b", host="h2"} on the right hand-side of the operation: [{__name__="b", host="h2", job="x"}, {__name__="b", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary - false ignoring host right host,zone - NaN +grid 100000 10000 3 +series __name__=a,host=h2,job=y ; 0:c070160000000000 +series __name__=a,host=h1,job=y ; 1:4045a00000000000 +series __name__=a,host=h1,job=x ; 2:0 +series __name__=a,host=h2,job=x ; 2:c078b00000000000 +series __name__=b,host=h1,job=y ; 1:408c3a0000000000 +series __name__=b,host=h1,job=x ; 0:7e37e43c8800759c +error found duplicate series for the match group {job="x"} on the left hand-side of the operation: [{__name__="a", host="h1", job="x"}, {__name__="a", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary <= true ignoring - right host,zone NaN 1 +grid 100000 10000 2 +series __name__=a,host=h1,job=y ; 0:7ff0000000000000 +series __name__=b,host=h2,job=y ; 0:c085090000000000 +result host=h1,job=y ; 0:0 +result host=h2,job=y ; 0:0 +end +case binary > true on - right - Inf NaN +grid 100000 10000 12 +series __name__=a,host=h1,job=x ; 0:c070e80000000000 +series __name__=a,host=h1,job=y ; 8:7ff8000000000001 9:408bb70000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 6:c082ef0000000000 7:407a6c0000000000 +series __name__=a,host=h2,job=x ; 6:c082ec0000000000 7:c063480000000000 +series __name__=b,host=h1,job=x ; +error found duplicate series for the match group {} on the left hand-side of the operation: [{__name__="a", host="h1", job="x", zone="z1"}, {__name__="a", host="h2", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary >= true ignoring job,zone one - -2.5 1 +grid 100000 10000 3 +series __name__=a,host=h2,job=y,zone=z1 ; 0:c08b540000000000 1:c05f100000000000 2:7ff0000000000000 +series __name__=a,host=h1,job=x ; 2:407fe80000000000 +series __name__=a,host=h1,job=x,zone=z1 ; 1:406ba40000000000 2:c07a1a0000000000 +series __name__=a,host=h1,job=y ; 1:c06e900000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 1:408ebc0000000000 2:407d680000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 2:c078580000000000 +error multiple matches for labels: many-to-one matching must be explicit (group_left/group_right) +end +case binary / false on host right zone - NaN +grid 100000 10000 8 +series __name__=a,host=h2,job=y ; 2:408bbe0000000000 3:4089960000000000 4:c070580000000000 5:c0705e0000000000 +series __name__=a,host=h2,job=x ; 7:7ff8000000000001 +series __name__=a,host=h2,job=x,zone=z1 ; 2:4087830000000000 3:7ff8000000000001 5:c085c90000000000 +series __name__=a,host=h1,job=x ; 5:4082470000000000 6:7e37e43c8800759c +series __name__=a,host=h2,job=y,zone=z1 ; +series __name__=b,host=h1,job=x ; +series __name__=b,host=h1,job=y ; 0:c083ed0000000000 1:7ff0000000000000 +error found duplicate series for the match group {host="h2"} on the left hand-side of the operation: [{__name__="a", host="h2", job="x", zone="z1"}, {__name__="a", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary >= true ignoring zone left host 1 - +grid 100000 10000 5 +series __name__=a,host=h1,job=y,zone=z1 ; 4:40864d0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 1:4079360000000000 2:4050580000000000 3:c0750a0000000000 +series __name__=b,host=h1,job=y ; 2:c077480000000000 3:40684c0000000000 +series __name__=b,host=h1,job=x,zone=z1 ; +error found duplicate series for the match group {host="h1", job="y"} on the right hand-side of the operation: [{__name__="b", host="h1", job="y", zone="z1"}, {__name__="b", host="h1", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary < true ignoring host one - -2.5 -2.5 +grid 100000 10000 5 +series __name__=a,host=h2,job=y,zone=z1 ; 2:c078dc0000000000 3:407b280000000000 4:c0888c0000000000 +series __name__=b,host=h2,job=y ; 2:4088770000000000 3:c087ea0000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 1:7ff0000000000000 +result job=y ; 2:3ff0000000000000 3:0 +result job=y,zone=z1 ; 1:3ff0000000000000 2:3ff0000000000000 3:0 4:3ff0000000000000 +end +case binary >= true none - one - NaN - +grid 100000 10000 12 +series __name__=a,host=h2,job=y ; 10:c08f3e0000000000 11:c08a890000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 9:c082c70000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 10:c082130000000000 11:40824e0000000000 +series __name__=b,host=h1,job=y ; 2:406f200000000000 4:c08ce30000000000 5:4079520000000000 6:c085e50000000000 7:c07a180000000000 8:c08f3c0000000000 9:7ff8000000000001 10:c067cc0000000000 +series __name__=b,host=h2,job=x,zone=z2 ; 1:4048b00000000000 2:4085430000000000 3:c082f60000000000 +result host=h1,job=y ; 2:0 4:0 5:0 6:0 7:0 8:0 9:0 10:0 +result host=h2,job=x,zone=z1 ; 10:0 11:0 +result host=h2,job=x,zone=z2 ; 1:0 2:0 3:0 +end +case binary >= false ignoring job one - - Inf +grid 100000 10000 2 +series __name__=a,host=h1,job=y ; 1:0 +series __name__=b,host=h1,job=y,zone=z1 ; 0:c05e080000000000 1:fff0000000000000 +series __name__=b,host=h1,job=x ; 1:408e280000000000 +series __name__=b,host=h1,job=y,zone=z2 ; 0:4042c00000000000 +end +case binary * false none - one - NaN - +grid 100000 10000 12 +series __name__=a,host=h2,job=y ; 2:7ff0000000000000 +series __name__=a,host=h1,job=x ; 5:4055f00000000000 6:407eba0000000000 7:c080390000000000 9:c087cc0000000000 10:c08baf0000000000 +series __name__=b,host=h2,job=y ; 11:4085e30000000000 +series __name__=b,host=h2,job=y,zone=z1 ; 10:fff0000000000000 11:40722e0000000000 +series __name__=b,host=h1,job=y,zone=z1 ; 6:407bf40000000000 7:4080390000000000 +result host=h1,job=y,zone=z1 ; 6:7ff8000000000001 7:7ff8000000000001 +result host=h2,job=y ; 11:7ff8000000000001 +result host=h2,job=y,zone=z1 ; 10:7ff8000000000001 11:7ff8000000000001 +end +case binary ^ false on job right - NaN NaN +grid 100000 10000 3 +series __name__=a,host=h1,job=x,zone=z1 ; 1:406de40000000000 2:c07c5a0000000000 +series __name__=a,host=h1,job=x ; 2:c06ad40000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 0:c08c650000000000 +series __name__=b,host=h2,job=x,zone=z1 ; 2:c06f500000000000 +series __name__=b,host=h2,job=x,zone=z2 ; 2:c06f740000000000 +error found duplicate series for the match group {job="x"} on the left hand-side of the operation: [{__name__="a", host="h1", job="x", zone="z1"}, {__name__="a", host="h1", job="x"}];many-to-many matching not allowed: matching labels must be unique on one side +end +case binary % false on - right host,zone - NaN +grid 100000 10000 12 +series __name__=a,host=h2,job=y ; 5:408df90000000000 6:c074560000000000 7:c0832f0000000000 8:c076780000000000 10:c08c2d0000000000 +series __name__=a,host=h2,job=x,zone=z1 ; 10:4085020000000000 11:4075280000000000 +series __name__=b,host=h2,job=y ; 11:c070e80000000000 +error found duplicate series for the match group {} on the left hand-side of the operation: [{__name__="a", host="h2", job="x", zone="z1"}, {__name__="a", host="h2", job="y"}];many-to-many matching not allowed: matching labels must be unique on one side +end diff --git a/src/promql/src/vector_match/tests.rs b/src/promql/src/vector_match/tests.rs index 31a5f9bcc2c..3fac9bfb07e 100644 --- a/src/promql/src/vector_match/tests.rs +++ b/src/promql/src/vector_match/tests.rs @@ -23,7 +23,8 @@ use rand::rngs::StdRng; use rand::{Rng, SeedableRng}; use super::{ - BinaryMatching, BinaryOp, Cardinality, MatchingLabels, SetOp, binary_vectors, set_vectors, + BinaryMatching, BinaryOp, Cardinality, FillValues, MatchingLabels, SetOp, binary_vectors, + set_vectors, }; use crate::grid_series::GridSeriesBuilder; use crate::grid_series::reference::{ @@ -481,6 +482,7 @@ fn binary_vectors_match_prometheus_reference() { return_bool, labels, cardinality, + fill: FillValues::default(), }; let fields = lhs_fields.min(rhs_fields); let points = grid.timestamps().len(); @@ -555,6 +557,7 @@ fn rejects_operands_on_other_grids_and_unpaired_or_fields() { return_bool: false, labels: MatchingLabels::Ignoring(Vec::new()), cardinality: Cardinality::OneToOne, + fill: FillValues::default(), }; assert!(binary_vectors(&matching, &lhs.schema, &lhs.series, &schema(1, &other), &[]).is_err()); assert!(matches!( @@ -614,6 +617,7 @@ fn reports_the_earliest_failing_point() { return_bool: false, labels: MatchingLabels::On(vec![Arc::from("job")]), cardinality: Cardinality::ManyToOne(Vec::new()), + fill: FillValues::default(), }; let error = binary_vectors(&matching, &schema, &lhs, &schema, &rhs) .unwrap_err() @@ -655,6 +659,26 @@ fn canonical_bits(value: f64) -> u64 { /// `prometheus_cases.txt`. #[test] fn vector_operations_match_prometheus() { + let (matched, failed) = check_cases(include_str!("prometheus_cases.txt")); + assert!( + matched > 100 && failed > 20, + "{matched} matched, {failed} failed" + ); +} + +/// Binary operations with fill modifiers, evaluated by the Prometheus v3.15.0 engine; see the +/// header of `fill_cases.txt`. +#[test] +fn fill_modifiers_match_prometheus() { + let (matched, failed) = check_cases(include_str!("fill_cases.txt")); + assert!( + matched > 100 && failed > 20, + "{matched} matched, {failed} failed" + ); +} + +/// Checks each case of a fixture and returns how many matched results and how many failed. +fn check_cases(text: &str) -> (usize, usize) { let parse_labels = |labels: &str| -> Labels { labels .split(',') @@ -672,7 +696,6 @@ fn vector_operations_match_prometheus() { .collect() }; let (mut matched, mut failed) = (0, 0); - let text = include_str!("prometheus_cases.txt"); for case in text.split("end\n").filter(|case| case.contains("case ")) { let lines: Vec<&str> = case.lines().filter(|line| !line.starts_with('#')).collect(); let spec: Vec<&str> = lines[0].split_whitespace().skip(1).collect(); @@ -729,6 +752,10 @@ fn vector_operations_match_prometheus() { other => panic!("unexpected line {other}"), } } + let fill = |value: Option<&&str>| match value { + None | Some(&"-") => None, + Some(value) => Some(value.parse::().unwrap()), + }; let labels = |kind: &str, list: &str| match kind { "on" => MatchingLabels::On(names(list)), _ => MatchingLabels::Ignoring(names(list)), @@ -760,6 +787,10 @@ fn vector_operations_match_prometheus() { "right" => Cardinality::OneToMany(names(spec[6])), _ => Cardinality::OneToOne, }, + fill: FillValues { + lhs: fill(spec.get(7)), + rhs: fill(spec.get(8)), + }, }; binary_vectors(&matching, &schema, &lhs, &schema, &rhs) } @@ -806,10 +837,7 @@ fn vector_operations_match_prometheus() { (actual, expected) => panic!("{case}\ngot {actual:?}, expected error {expected:?}"), } } - assert!( - matched > 100 && failed > 20, - "{matched} matched, {failed} failed" - ); + (matched, failed) } /// Results that share a label set once `__type__` is dropped fail as a grouping violation within @@ -858,6 +886,7 @@ fn colliding_results_fail_by_where_they_collide() { return_bool: false, labels, cardinality: Cardinality::ManyToOne(Vec::new()), + fill: FillValues::default(), }; let error = binary_vectors(&matching, &schema, &lhs, &schema, rhs) .unwrap_err() @@ -1002,6 +1031,7 @@ fn histogram_operators_match_prometheus() { "right" => Cardinality::OneToMany(Vec::new()), _ => Cardinality::OneToOne, }, + fill: FillValues::default(), }; binary_vectors(&matching, &schema, &lhs, &schema, &rhs) } @@ -1127,12 +1157,66 @@ fn colliding_reset_hints_skip_the_pair() { return_bool: false, labels: MatchingLabels::On(vec![Arc::from("job")]), cardinality: Cardinality::OneToOne, + fill: FillValues::default(), }; let result = binary_vectors(&matching, &schema, &lhs, &schema, &rhs).unwrap(); assert_eq!(result.len(), 1, "{op:?}"); } } +/// A pair whose operation fails is not a match, so `fill_left` still fills for the right-hand +/// sample of that pair; the fixtures hold floats only. +#[test] +fn a_failed_pair_leaves_its_sample_to_the_fill() { + let grid = Arc::new(EvalGrid::try_new(GridSpec::try_new(0, 10_000, 1).unwrap()).unwrap()); + let schema = Arc::new(SeriesSchema { + fields: vec![FieldSpec { + name: Arc::from("value"), + }] + .into(), + eval_grid: Some(grid), + }); + let labels = |pairs: &[(&str, &str)]| -> Labels { + pairs + .iter() + .map(|(name, value)| (name.to_string(), value.to_string())) + .collect() + }; + let histogram = "0/0/0/4014000000000000/4014000000000000/0/0_1/4014000000000000///"; + let lhs = [mixed_series( + &schema, + &labels(&[("__name__", "a"), ("job", "x")]), + &BTreeMap::new(), + &BTreeMap::from([(0, histogram.to_string())]), + ) + .unwrap()]; + let rhs = [mixed_series( + &schema, + &labels(&[("__name__", "b"), ("job", "x")]), + &BTreeMap::from([(0, 2.0f64.to_bits())]), + &BTreeMap::new(), + ) + .unwrap()]; + // A histogram plus a float is skipped, so `b` is unmatched: 10 + 2 under the match labels. + let matching = BinaryMatching { + op: BinaryOp::Add, + return_bool: false, + labels: MatchingLabels::On(vec![Arc::from("job")]), + cardinality: Cardinality::OneToOne, + fill: FillValues { + lhs: Some(10.0), + rhs: None, + }, + }; + let result = binary_vectors(&matching, &schema, &lhs, &schema, &rhs).unwrap(); + assert_eq!(result.len(), 1); + assert_eq!(labels_of(&result[0].metric), labels(&[("job", "x")])); + assert!(matches!( + result[0].fields.as_slice()[0].sample(0), + SampleRef::Float(value) if value == 12.0 + )); +} + /// A binary pairing walks two operands of many single-position runs and still reports every /// position exactly once. /// @@ -1170,6 +1254,7 @@ fn a_pairing_reads_many_single_position_runs_once() { return_bool: false, labels: MatchingLabels::On(vec![Arc::from("job")]), cardinality: Cardinality::OneToOne, + fill: FillValues::default(), }; let result = binary_vectors( &matching, @@ -1218,6 +1303,7 @@ fn a_binary_pairing_of_sparse_operands_keeps_the_shared_positions() { return_bool: false, labels: MatchingLabels::Ignoring(Vec::new()), cardinality: Cardinality::OneToOne, + fill: FillValues::default(), }; let result = binary_vectors( &matching, @@ -1249,6 +1335,7 @@ fn a_binary_pairing_of_sparse_operands_keeps_the_shared_positions() { return_bool: false, labels: MatchingLabels::Ignoring(Vec::new()), cardinality: Cardinality::OneToOne, + fill: FillValues::default(), }; let result = binary_vectors( &filtered, @@ -1278,6 +1365,7 @@ fn a_binary_pairing_of_sparse_operands_keeps_the_shared_positions() { return_bool: true, labels: MatchingLabels::Ignoring(Vec::new()), cardinality: Cardinality::OneToOne, + fill: FillValues::default(), }; let result = binary_vectors( &booled,