use crate::core::{MatchRecognizeOutputSpec, RowsPerMatch, SymbolId};
use crate::execution::matching::ExecutableOutputPlan;
use crate::nfa::CompiledAutomaton;
use datafusion::arrow::datatypes::Schema;
use datafusion_common::Result;
use std::sync::Arc;
#[derive(Clone)]
pub(crate) struct RowOutputHarness {
pub(crate) spec: MatchRecognizeOutputSpec,
pub(crate) classifier_bitset_symbol_ids: Arc<[SymbolId]>,
pub(crate) rows_per_match: RowsPerMatch,
}
impl RowOutputHarness {
pub(crate) fn new(
spec: MatchRecognizeOutputSpec,
classifier_bitset_symbol_ids: Arc<[SymbolId]>,
rows_per_match: RowsPerMatch,
) -> Self {
Self {
spec,
classifier_bitset_symbol_ids,
rows_per_match,
}
}
pub(crate) fn try_build(
self,
input_schema: &Schema,
automaton: &CompiledAutomaton,
) -> Result<Arc<ExecutableOutputPlan>> {
ExecutableOutputPlan::try_rows(
input_schema,
self.spec,
self.classifier_bitset_symbol_ids,
self.rows_per_match,
automaton,
)
}
}