use super::candidates::ScanWinner;
use super::*;
use crate::execution::common::progress::COARSE_WORK_BATCH_SIZE;
use crate::execution::matching::ResolvedAfterMatchSkip;
use crate::execution::matching::path::{
PathStep, SelectedStepSources, SelectedSteps, is_compact_path_node,
};
use crate::execution::matching::row_loop::lane_scan::LaneSelectedRuns;
use crate::execution::storage::accumulator::{
CompactMatchPreparation, ExpandedMatchPreparation, PreparedMatchEmission,
SelectedPathFill,
};
use datafusion::execution::memory_pool::MemoryReservation;
pub(crate) struct SelectedOutputBuffer {
steps: Vec<PathStep>,
memory: MemoryReservation,
staged_output: PendingOutput,
}
#[cfg(test)]
thread_local! {
static PATH_ALLOCATIONS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
}
#[cfg(test)]
impl PatternMatcher {
pub(crate) fn selected_path_allocations_for_test() -> usize {
PATH_ALLOCATIONS.get()
}
}
enum SelectedOutputPhase {
Fill(SelectedPathFill),
Encode(SelectedEncoding),
}
struct SelectedEncoding {
input: SelectedEncodingInput,
prepared: Option<PreparedMatchEmission>,
cursor: NextMatchCursor,
next_match_number: u64,
}
enum SelectedEncodingInput {
Path(ExpandedMatchPreparation),
Compact {
start: AbsoluteRow,
progress: CompactMatchPreparation,
},
}
impl SelectedEncodingInput {
fn start(&self) -> AbsoluteRow {
match self {
Self::Path(progress) => progress.path.semantic_start(),
Self::Compact { start, .. } => *start,
}
}
}
pub(super) fn checked_match_number_successor(match_number: u64) -> Result<u64> {
let next_match_number = match_number.checked_add(1).ok_or_else(|| {
DataFusionError::ResourcesExhausted(
"MATCH_RECOGNIZE match number exceeds u64".to_string(),
)
})?;
crate::execution::matching::row_loop::direct_predicate::checked_match_number(
match_number,
)?;
Ok(next_match_number)
}
pub(crate) struct SelectedOutputTransaction {
phase: SelectedOutputPhase,
scope: SelectedOutputScope,
}
struct SelectedOutputScope {
buffer: SelectedOutputBuffer,
partition: std::ops::Range<usize>,
global_offset: usize,
}
impl SelectedOutputTransaction {
#[cfg(test)]
pub(crate) fn is_filling(&self) -> bool {
matches!(self.phase, SelectedOutputPhase::Fill(_))
}
#[cfg(test)]
pub(crate) fn has_staged_batches(&self) -> bool {
!self.scope.buffer.staged_output.is_empty()
}
pub(crate) fn retained_input_row(&self, lookbehind: usize) -> Result<usize> {
let start = match &self.phase {
SelectedOutputPhase::Fill(fill) => fill.start,
SelectedOutputPhase::Encode(encoding) => encoding.input.start(),
};
let start = absolute_row_to_usize(start, "selected output retention floor")?;
Ok(start
.saturating_sub(lookbehind)
.max(self.scope.partition.start))
}
}
impl MatchAwareCandidates<'_, '_> {
fn take_yield_if_due(&mut self) -> bool {
self.scan_ctx
.scan_state
.governor
.take_yield_if_due(self.yield_policy)
}
pub(super) fn emit_selected_output(
&mut self,
winner: ScanWinner,
) -> Result<Option<NextMatchCursor>> {
let (candidate, lane) = match winner {
ScanWinner::Lane(candidate) => (candidate, true),
ScanWinner::Nfa(candidate) => (candidate, false),
};
let state_id = candidate.best_match.state_id;
if self
.variant()
.automaton()
.nfa()
.get_state(state_id)
.is_none()
{
return internal_err!(
"MATCH_RECOGNIZE selected NFA state {state_id} exceeds compiled NFA length {}",
self.variant().automaton().nfa().state_count()
);
}
let bm = candidate.best_match;
let steps = if lane {
let lane = self.scan_ctx.lane_scan.as_ref().ok_or_else(|| {
datafusion::common::internal_datafusion_err!("selected Lane disappeared")
})?;
if lane.incumbent() != Some(candidate) {
return internal_err!("MATCH_RECOGNIZE selected Lane incumbent changed");
}
if !self.matcher.program.config().compact_paths_disabled
&& self.out.supports_compact_selected()
&& lane
.incumbent_view()
.expect("checked incumbent")
.history
.len()
<= LaneSelectedRuns::MAX_ATOMIC_RUNS
&& lane
.selected_runs()?
.can_skip_atomically(self.matcher.program.after_match_skip())?
{
return self.prepare_compact_selected_output(
bm.match_start_row,
candidate.end_row,
);
}
let (_, steps) = lane.incumbent_path().ok_or_else(|| {
DataFusionError::Internal(
"MATCH_RECOGNIZE selected lane has no incumbent cursor".into(),
)
})?;
SelectedSteps::lane(steps)?
} else if is_compact_path_node(bm.path_end) {
SelectedSteps::compact(
self.variant().path_representation(),
bm.match_start_row,
candidate.end_row,
)?
} else {
SelectedSteps::arena(&self.scan_ctx.thread_store.node_arena, bm.path_end)?
};
self.prepare_selected_output(SelectedPathFill::new(
steps,
bm.match_start_row,
candidate.end_row,
bm.row,
))
}
fn prepare_selected_output(
&mut self,
mut fill: SelectedPathFill,
) -> Result<Option<NextMatchCursor>> {
if self.scan_ctx.selected_output.is_some() {
return internal_err!(
"MATCH_RECOGNIZE cannot replace a selected output transaction"
);
}
if !self.matcher.program.config().compact_paths_disabled
&& self.out.supports_compact_selected()
&& self.scan_ctx.candidate_history.is_none()
&& let Some(position) = fill
.steps
.empty_position(&self.scan_ctx.thread_store.node_arena)?
{
let next_match_number = checked_match_number_successor(
self.scan_ctx.partition.next_match_number,
)?;
let cursor = self
.matcher
.program
.after_match_skip()
.plan_selected_cursor(position, position, true, None)?;
let at = absolute_row_to_usize(position, "empty winner")?;
let partition =
self.scan_ctx.partition.absolute_partition_start..self.read_end_row;
let matcher = &*self.matcher;
if let Some(prepared) = self.out.try_prepare_empty_in_batch(
self.scan_ctx.partition.next_match_number,
at,
partition,
&mut |units| {
self.scan_ctx
.scan_state
.governor
.record_completed(units, || matcher.is_aborted())
},
)? {
let mut staged = self.pending_output.new_empty();
self.out
.prepare_match_publication(&staged, self.pending_output)?;
self.scan_ctx.discard_candidate_scan();
self.candidate_cleanup_finalized = true;
self.out.publish_prepared_match(
prepared,
&mut staged,
self.pending_output,
);
self.scan_ctx.partition.next_match_number = next_match_number;
self.metrics.output_compact_matches.add(1);
self.metrics.output_materializations.add(1);
return Ok(Some(cursor));
}
}
let mut scope = self.take_output_scope();
#[cfg(test)]
let previous_bytes = scope.buffer.memory.size();
fill.steps.reserve(
std::mem::take(&mut scope.buffer.steps),
&mut scope.buffer.memory,
)?;
#[cfg(test)]
if scope.buffer.memory.size() > previous_bytes {
PATH_ALLOCATIONS.set(PATH_ALLOCATIONS.get() + 1);
}
self.drive_selected_fill(scope, fill)
}
fn take_output_scope(&mut self) -> SelectedOutputScope {
let buffer = self
.matcher
.services
.selected_output_buffer
.take()
.unwrap_or_else(|| SelectedOutputBuffer {
steps: Vec::new(),
memory: self.scan_ctx.lane_state_memory.new_empty(),
staged_output: self.pending_output.new_empty(),
});
SelectedOutputScope {
buffer,
partition: self.scan_ctx.partition.absolute_partition_start
..self.read_end_row,
global_offset: self.scan_ctx.partition.global_row_offset,
}
}
fn prepare_compact_selected_output(
&mut self,
start: AbsoluteRow,
end: AbsoluteRow,
) -> Result<Option<NextMatchCursor>> {
if self.scan_ctx.selected_output.is_some() {
return internal_err!("MATCH_RECOGNIZE cannot replace selected output");
}
let next_match_number =
checked_match_number_successor(self.scan_ctx.partition.next_match_number)?;
let skip = self.matcher.program.after_match_skip();
let target = if matches!(
skip,
ResolvedAfterMatchSkip::ToFirst { .. }
| ResolvedAfterMatchSkip::ToLast { .. }
) {
let resources = self.scan_ctx.resources_mut();
let lane = resources
.lane_scan
.as_ref()
.expect("checked compact winner");
let runs = lane.selected_runs()?;
let (target, skip_work) = runs.skip_target_row(skip)?;
resources
.scan_state
.governor
.record_completed(skip_work, || self.matcher.is_aborted())?;
target
} else {
None
};
let cursor = skip.plan_selected_cursor(start, end, false, target)?;
if self.scan_ctx.candidate_history.is_none()
&& start.as_u64() >= self.scan_ctx.partition.global_row_offset as u64
&& self.out.can_append_direct_winner()
{
let match_id = self.scan_ctx.partition.next_match_number;
let partition =
self.scan_ctx.partition.absolute_partition_start..self.read_end_row;
let global_offset = self.scan_ctx.partition.global_row_offset;
let resources = self.scan_ctx.resources_mut();
let lane = resources
.lane_scan
.as_ref()
.expect("checked compact winner");
let runs = lane.selected_runs()?;
if self.matcher.is_aborted() {
return internal_err!("MATCH_RECOGNIZE execution cancelled");
}
let mut forwarded = 0;
let matcher = &*self.matcher;
if self.out.try_publish_direct_winner(
match_id,
&runs,
partition,
global_offset,
self.setup.input_buffer,
&mut resources.scan_state.governor,
|| matcher.is_aborted(),
|id, output_type| {
let cell = matcher.bound_state_cells().get(id)?;
let winner = lane.incumbent_view().expect("checked selected Lane");
let value = cell.winning_value(winner.registers, output_type);
forwarded += usize::from(value.is_some());
value
},
)? {
self.scan_ctx.discard_candidate_scan();
self.candidate_cleanup_finalized = true;
self.scan_ctx.partition.next_match_number = next_match_number;
self.metrics.output_compact_matches.add(1);
if forwarded != 0 {
self.metrics.output_winning_register_values.add(forwarded);
}
return Ok(Some(cursor));
}
}
let mut scope = self.take_output_scope();
let match_id = self.scan_ctx.partition.next_match_number;
let resources = self.scan_ctx.resources_mut();
let runs = resources
.lane_scan
.as_ref()
.expect("checked compact winner")
.selected_runs()?;
let progress = self.out.begin_compact_match(
match_id,
&runs,
&MatchEmissionContext {
partition: scope.partition.clone(),
global_offset: scope.global_offset,
batches: self.setup.input_buffer,
pending_output: &mut scope.buffer.staged_output,
history: self.setup.history_buffer,
},
&mut |units| {
resources
.scan_state
.governor
.record_completed(units, || self.matcher.is_aborted())
},
)?;
let encoding = SelectedEncoding {
input: SelectedEncodingInput::Compact { start, progress },
prepared: None,
cursor,
next_match_number,
};
self.drive_selected_encoding(scope, encoding)
}
pub(super) fn resume_selected_output(
&mut self,
transaction: SelectedOutputTransaction,
) -> Result<Option<NextMatchCursor>> {
let SelectedOutputTransaction { phase, scope } = transaction;
match phase {
SelectedOutputPhase::Fill(fill) => self.drive_selected_fill(scope, fill),
SelectedOutputPhase::Encode(encoding) => {
self.drive_selected_encoding(scope, encoding)
}
}
}
fn suspend_selected_output(
&mut self,
scope: SelectedOutputScope,
phase: SelectedOutputPhase,
) -> Result<Option<NextMatchCursor>> {
self.scan_ctx.selected_output = Some(SelectedOutputTransaction { phase, scope });
self.scan_ctx.cursor = NextMatchCursor {
row_idx: self.row_idx,
};
Ok(None)
}
fn drive_selected_fill(
&mut self,
mut scope: SelectedOutputScope,
mut fill: SelectedPathFill,
) -> Result<Option<NextMatchCursor>> {
if self.matcher.is_aborted() {
return internal_err!("MATCH_RECOGNIZE execution cancelled");
}
loop {
let resources = self.scan_ctx.resources_mut();
let emission = MatchEmissionContext {
partition: scope.partition.clone(),
global_offset: scope.global_offset,
batches: self.setup.input_buffer,
pending_output: &mut scope.buffer.staged_output,
history: self.setup.history_buffer,
};
let variant = self
.setup
.variant
.resolve(self.matcher.program.base_variant());
let skip = self.matcher.program.after_match_skip();
let chunk_size = self.out.output_batch_size().max(COARSE_WORK_BATCH_SIZE);
if let Some(validator) = fill.advance(
self.out,
variant.automaton(),
skip,
&emission,
|steps| {
let lane = if steps.uses_lane() {
Some(
resources
.lane_scan
.as_ref()
.and_then(|lane| lane.incumbent_path())
.ok_or_else(|| {
datafusion::common::internal_datafusion_err!(
"selected Lane lost its incumbent cursor"
)
})?
.0,
)
} else {
None
};
Ok((
SelectedStepSources {
arena: &resources.thread_store.node_arena,
shape: Some(variant.path_representation()),
lane,
},
chunk_size,
))
},
&mut |units| {
resources
.scan_state
.governor
.record_completed(units, || self.matcher.is_aborted())
},
)? {
let (path, target) = fill.finish(validator)?;
self.metrics.output_materializations.add(1);
let cursor = path.next_cursor(skip, path.semantic_start(), target)?;
let match_id = self.scan_ctx.partition.next_match_number;
let next_match_number = checked_match_number_successor(match_id)?;
let progress =
ExpandedMatchPreparation::begin(self.out, match_id, path, &emission)?;
let encoding = SelectedEncoding {
input: SelectedEncodingInput::Path(progress),
prepared: None,
cursor,
next_match_number,
};
if self.take_yield_if_due() {
return self.suspend_selected_output(
scope,
SelectedOutputPhase::Encode(encoding),
);
}
return self.drive_selected_encoding(scope, encoding);
}
if self.take_yield_if_due() {
return self
.suspend_selected_output(scope, SelectedOutputPhase::Fill(fill));
}
}
}
#[inline(always)]
fn drive_selected_encoding(
&mut self,
mut scope: SelectedOutputScope,
mut encoding: SelectedEncoding,
) -> Result<Option<NextMatchCursor>> {
if self.matcher.is_aborted() {
return internal_err!("MATCH_RECOGNIZE execution cancelled");
}
while encoding.prepared.is_none() {
let emission = MatchEmissionContext {
partition: scope.partition.clone(),
global_offset: scope.global_offset,
batches: self.setup.input_buffer,
pending_output: &mut scope.buffer.staged_output,
history: self.setup.history_buffer,
};
let matcher = &*self.matcher;
encoding.prepared = match &mut encoding.input {
SelectedEncodingInput::Path(progress) => {
let governor = &mut self.scan_ctx.scan_state.governor;
progress.advance(self.out, emission, &mut |units| {
governor.record_completed(units, || matcher.is_aborted())
})?
}
SelectedEncodingInput::Compact { progress, .. } => {
let resources = self.scan_ctx.resources_mut();
let lane = resources.lane_scan.as_ref().ok_or_else(|| {
datafusion::common::internal_datafusion_err!(
"selected Lane disappeared"
)
})?;
let runs = lane.selected_runs()?;
let governor = &mut resources.scan_state.governor;
let mut forwarded = 0;
let prepared = progress.advance_with_registers(
self.out,
&runs,
emission,
governor,
self.yield_policy,
|| matcher.is_aborted(),
&mut |id, output_type| {
let cell = matcher.bound_state_cells().get(id)?;
let winner =
lane.incumbent_view().expect("checked selected Lane");
let value = cell.winning_value(winner.registers, output_type);
forwarded += usize::from(value.is_some());
value
},
)?;
if forwarded != 0 {
self.metrics.output_winning_register_values.add(forwarded);
}
if prepared.is_none() {
return self.suspend_selected_output(
scope,
SelectedOutputPhase::Encode(encoding),
);
}
prepared
}
};
if self.take_yield_if_due() {
return self.suspend_selected_output(
scope,
SelectedOutputPhase::Encode(encoding),
);
}
}
self.out.prepare_match_publication(
&scope.buffer.staged_output,
self.pending_output,
)?;
if self.scan_ctx.candidate_history.is_some() {
self.scan_ctx
.scan_state
.governor
.record_completed(1, || self.matcher.is_aborted())?;
}
self.scan_ctx.discard_candidate_scan();
self.candidate_cleanup_finalized = true;
let prepared = encoding.prepared.take().expect("encoding is complete");
self.out.publish_prepared_match(
prepared,
&mut scope.buffer.staged_output,
self.pending_output,
);
self.scan_ctx.partition.next_match_number = encoding.next_match_number;
let cursor = encoding.cursor;
match encoding.input {
SelectedEncodingInput::Path(progress) => {
scope.buffer.steps = progress.path.into_steps();
scope.buffer.steps.clear();
}
SelectedEncodingInput::Compact { .. } => {
self.metrics.output_compact_matches.add(1)
}
}
debug_assert!(scope.buffer.staged_output.is_empty());
if scope.buffer.steps.capacity() <= self.setup.input_buffer.num_rows() {
self.matcher.services.selected_output_buffer = Some(scope.buffer);
}
Ok(Some(cursor))
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::config::{MatchRecognizeConfig, YieldPolicy};
use crate::core::vm::RegisterLayout;
use crate::core::{
MatchMetadataColumn, NormalizedPattern, Pattern, RepetitionQuantifier,
RowsPerMatch, Symbol, SymbolId,
};
use crate::execution::deferred::{
DeferredAggregateOperation, DeferredEvaluatorFactory,
DeferredMetadataColumnOwner, DeferredPredicateProgram, DeferredSchemaColumnPlan,
HistorySource,
};
use crate::execution::matching::{
CollectionTestDriver, test_output_program,
test_symbol_programs_with_vm_for_automaton,
};
use datafusion::arrow::array::{ArrayRef, BooleanArray, Int64Array};
use datafusion::arrow::datatypes::{DataType, Schema};
use datafusion::arrow::record_batch::RecordBatch;
use datafusion::common::{ScalarValue, config::ConfigOptions};
use datafusion::logical_expr::{Volatility, create_udf};
use datafusion::physical_expr::ScalarFunctionExpr;
use datafusion::physical_expr::aggregate::{AggregateExprBuilder, LoweredAggregate};
use datafusion::physical_expr::expressions::{Column, Literal};
#[test]
fn empty_winner_retires_losing_deferred_history_before_publication() -> Result<()> {
const ROWS: usize = 137;
for cancel in [false, true] {
let batch = RecordBatch::try_from_iter([
("id", Arc::new(Int64Array::from(vec![1; ROWS])) as ArrayRef),
(
"__mr_symbol_b",
Arc::new(BooleanArray::from(vec![false; ROWS])) as ArrayRef,
),
])?;
let pattern = NormalizedPattern::Ast(Pattern::Repetition(
Box::new(Pattern::Concat(vec![
Pattern::Repetition(
Box::new(Pattern::Symbol(Symbol::Named("A".into()))),
RepetitionQuantifier::OneOrMore,
),
Pattern::Symbol(Symbol::Named("B".into())),
])),
RepetitionQuantifier::AtMostOne,
));
let compiled = Arc::new(crate::nfa::CompiledAutomaton::compile(
&pattern,
&["A".into(), "B".into()],
)?);
let a = SymbolId::try_new(1, compiled.num_symbols()).unwrap();
let programs = test_symbol_programs_with_vm_for_automaton(
&compiled,
&[],
&[a],
vec![vec![], vec![]],
RegisterLayout::empty_compact(0),
);
let history_schema = Arc::new(Schema::new(vec![
Arc::clone(&batch.schema().fields()[0]),
MatchMetadataColumn::PathId.arrow_field(),
]));
let identity = Arc::new(ScalarFunctionExpr::new(
"history_input",
Arc::new(create_udf(
"history_input",
vec![DataType::Int64],
DataType::Int64,
Volatility::Volatile,
Arc::new(|args| Ok(args[0].clone())),
)),
vec![Arc::new(Column::new("id", 0))],
Arc::clone(&history_schema.fields()[0]),
Arc::new(ConfigOptions::new()),
));
let aggregate = Arc::new(
AggregateExprBuilder::new(
datafusion::functions_aggregate::sum::sum_udaf(),
vec![identity],
)
.schema(Arc::clone(&history_schema))
.alias("s")
.build()?,
);
let result_schema = Arc::new(Schema::new(vec![aggregate.field()]));
let factory = DeferredEvaluatorFactory::try_new(
DeferredSchemaColumnPlan::try_new_history(
history_schema,
vec![
HistorySource::Input(0),
HistorySource::Encoded(DeferredMetadataColumnOwner::Metadata(
MatchMetadataColumn::PathId,
)),
],
)?,
vec![DeferredAggregateOperation::new(LoweredAggregate {
aggregate,
filter: None,
order_bys: vec![],
})],
DeferredPredicateProgram {
expressions: vec![
None,
Some(Arc::new(Literal::new(ScalarValue::Boolean(Some(true))))),
None,
],
schema: result_schema,
extra_columns: vec![],
},
&[None, Some("A".into()), Some("B".into())],
)?;
let output = test_output_program(
&batch,
&compiled,
MatchMetadataColumn::public_output().to_vec(),
RowsPerMatch::OneRow,
);
let mut config = MatchRecognizeConfig::default();
config.diagnostics.disable_pattern_optimizer = true;
config.limits.cancellation_poll_interval = 1;
let mut driver = CollectionTestDriver::try_new(
batch,
pattern,
compiled,
&config,
ROWS,
output,
|input| {
input.symbols.symbol_programs = programs;
input.deferred_evaluator_factory = Some(Arc::new(factory));
input.set_rows_per_match(RowsPerMatch::OneRow);
},
)?;
assert!(driver.accumulator.supports_compact_selected());
let mut prepared = false;
for _ in 0..ROWS * 256 {
assert_eq!(
driver.step(YieldPolicy::from_test_budget(1), None)?,
ComputeStep::Yield
);
let scan = driver.scratch.as_ref().unwrap();
if scan.selected_output.as_ref().is_some_and(|tx| {
matches!(
&tx.phase,
SelectedOutputPhase::Encode(encoding)
if encoding.prepared.is_some()
)
}) {
assert_eq!(
scan.candidate_history.as_ref().unwrap().gathered_rows(),
ROWS as u64
);
assert_eq!(scan.partition.next_match_number, 1);
assert_eq!(driver.accumulator.take_matches_total(), 0);
assert!(driver.pending_output.is_empty());
prepared = true;
break;
}
}
assert!(
prepared,
"empty incumbent must suspend after preparing output"
);
let mut scan = direct::regressions::candidates(&mut driver);
let progress_before = scan
.scan_ctx
.scan_state
.governor
.progress_epoch_for_observation();
let transaction = scan.scan_ctx.selected_output.take().unwrap();
if cancel {
scan.scan_ctx
.scan_state
.governor
.set_execution_deadline_for_test(
std::time::Instant::now()
.checked_sub(std::time::Duration::from_millis(1))
.unwrap_or_else(std::time::Instant::now),
);
}
let result = scan.resume_selected_output(transaction);
if cancel {
let err = result.unwrap_err();
assert!(err.to_string().contains("deadline exceeded"), "{err}");
assert_eq!(
scan.scan_ctx
.scan_state
.governor
.progress_epoch_for_observation(),
progress_before + 1,
"cancellation must trigger at the publication checkpoint"
);
assert!(!scan.candidate_cleanup_finalized);
assert!(scan.scan_ctx.candidate_history.is_some());
assert_eq!(scan.scan_ctx.partition.next_match_number, 1);
assert_eq!(scan.out.take_matches_total(), 0);
assert!(scan.pending_output.is_empty());
scan.scan_ctx.discard_candidate_scan();
} else {
assert_eq!(result?.unwrap().row_idx, 1);
assert!(
scan.scan_ctx
.scan_state
.governor
.progress_epoch_for_observation()
> progress_before
);
assert!(scan.candidate_cleanup_finalized);
assert!(scan.scan_ctx.candidate_history.is_none());
assert_eq!(scan.scan_ctx.partition.next_match_number, 2);
driver.flush_output(ROWS, true, None)?;
let output = driver.concat_output();
assert_eq!(output.num_rows(), 1);
assert_eq!(
ScalarValue::try_from_array(output.column(0), 0)?,
ScalarValue::Int64(Some(1))
);
assert_eq!(
ScalarValue::try_from_array(
output
.column_by_name(MatchMetadataColumn::MatchNumber.as_ref())
.unwrap(),
0
)?,
ScalarValue::Int64(Some(1))
);
assert!(
output
.column_by_name(MatchMetadataColumn::Classifier.as_ref())
.unwrap()
.is_null(0)
);
}
assert!(driver.scratch.as_ref().unwrap().candidate_history.is_none());
}
Ok(())
}
}