MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / export_index_iterative

Method export_index_iterative

src/compute/src/render.rs:761–853  ·  view source on GitHub ↗
(
        &self,
        outer: Scope<'outer, mz_repr::Timestamp>,
        compute_state: &mut ComputeState,
        tokens: &BTreeMap<GlobalId, Rc<dyn std::any::Any>>,
        dependency_ids: BTreeSe

Source from the content-addressed store, hash-verified

759 T: RenderTimestamp,
760{
761 pub(crate) fn export_index_iterative<'outer>(
762 &self,
763 outer: Scope<'outer, mz_repr::Timestamp>,
764 compute_state: &mut ComputeState,
765 tokens: &BTreeMap<GlobalId, Rc<dyn std::any::Any>>,
766 dependency_ids: BTreeSet<GlobalId>,
767 idx_id: GlobalId,
768 idx: &IndexDesc,
769 output_probe: &MzProbeHandle<mz_repr::Timestamp>,
770 ) {
771 // put together tokens that belong to the export
772 let mut needed_tokens = Vec::new();
773 for dep_id in dependency_ids {
774 if let Some(token) = tokens.get(&dep_id) {
775 needed_tokens.push(Rc::clone(token));
776 }
777 }
778 let bundle = self.lookup_id(Id::Global(idx_id)).unwrap_or_else(|| {
779 panic!(
780 "Arrangement alarmingly absent! id: {:?}",
781 Id::Global(idx_id)
782 )
783 });
784
785 match bundle.arrangement(&idx.key) {
786 Some(ArrangementFlavor::Local(oks, errs)) => {
787 // TODO: The following as_collection/leave/arrange sequence could be optimized.
788 // * Combine as_collection and leave into a single function.
789 // * Use columnar to extract columns from the batches to implement leave.
790 let mut oks = oks
791 .as_collection(|k, v| (k.to_row(), v.to_row()))
792 .leave(outer)
793 .mz_arrange::<
794 ColumnationChunker<_>,
795 RowRowBatcher<_, _>,
796 RowRowBuilder<_, _>,
797 _,
798 >(
799 "Arrange export iterative",
800 );
801
802 let mut errs = errs
803 .as_collection(|k, v| (k.clone(), v.clone()))
804 .leave(outer)
805 .mz_arrange::<ColumnationChunker<_>, ErrBatcher<_, _>, ErrBuilder<_, _>, _>(
806 "Arrange export iterative err",
807 );
808
809 // Ensure that the frontier does not advance past the expiration time, if set.
810 // Otherwise, we might write down incorrect data.
811 if let Some(&expiration) = self.dataflow_expiration.as_option() {
812 oks.stream = oks.stream.expire_stream_at(
813 &format!("{}_export_index_iterative_oks", self.debug_name),
814 expiration,
815 );
816 errs.stream = errs.stream.expire_stream_at(
817 &format!("{}_export_index_iterative_err", self.debug_name),
818 expiration,

Callers 1

build_compute_dataflowFunction · 0.80

Calls 14

cloneFunction · 0.85
lookup_idMethod · 0.80
arrangementMethod · 0.80
as_collectionMethod · 0.80
expire_stream_atMethod · 0.80
probe_notify_withMethod · 0.80
log_dataflow_errorsMethod · 0.80
with_dropMethod · 0.80
unwrapMethod · 0.80
getMethod · 0.45
pushMethod · 0.45
to_rowMethod · 0.45

Tested by

no test coverage detected