Comparing rule evaluators#
parcel_runtime::differential compares the CEL interpreter and DataFusion on the same data and callers. This is the comparison used by parcel check.
differential#
pub async fn differential(
c: &Compilation,
batch: &RecordBatch,
callers: &[Caller],
) -> parcel_runtime::plan::Result<DiffReport>;
c supplies compiled rules, batch supplies the rows to test, and callers supplies each context. The batch is conformed to the contract’s row schema. Schema conversion and execution failures return RuntimeError; differing evaluation results are recorded in the returned report.
For existing artifacts, batch, and caller values:
let report = parcel_runtime::differential::differential(
&artifacts, &batch, &[caller],
).await?;
assert!(report.passed(), "{:?}", report.mismatches);
DiffReport#
Field |
Type |
Meaning |
|---|---|---|
|
|
Rows tested. |
|
|
Caller profiles tested. |
|
|
Individual comparisons performed. |
|
|
Comparisons where both evaluators rejected the input, such as division by zero. |
|
|
Comparisons whose results differ. |
impl DiffReport {
pub fn passed(&self) -> bool;
}
Returns true when mismatches is empty. It can be true when both_errored is nonzero: matching errors count as agreement.
Mismatch#
Field |
Type |
Meaning |
|---|---|---|
|
|
Rule or calculated-field identifier. |
|
|
Caller label for this comparison. |
|
|
Zero-based row index in the tested batch. |
|
|
CEL interpreter result as text. |
|
|
DataFusion result as text. |