MCPcopy Create free account
hub / github.com/apache/paimon-rust / build

Method build

crates/paimon/src/table/source.rs:623–676  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

621 }
622
623 pub fn build(self) -> crate::Result<DataSplit> {
624 if self.snapshot_id == -1 {
625 return Err(crate::Error::UnexpectedError {
626 message: "DataSplit requires snapshot_id != -1".to_string(),
627 source: None,
628 });
629 }
630 let partition = self
631 .partition
632 .ok_or_else(|| crate::Error::UnexpectedError {
633 message: "DataSplit requires partition".to_string(),
634 source: None,
635 })?;
636 let bucket_path = self
637 .bucket_path
638 .ok_or_else(|| crate::Error::UnexpectedError {
639 message: "DataSplit requires bucket_path".to_string(),
640 source: None,
641 })?;
642 let data_files = self
643 .data_files
644 .ok_or_else(|| crate::Error::UnexpectedError {
645 message: "DataSplit requires data_files".to_string(),
646 source: None,
647 })?;
648 if self.bucket == -1 {
649 return Err(crate::Error::UnexpectedError {
650 message: "DataSplit requires bucket != -1".to_string(),
651 source: None,
652 });
653 }
654 if let Some(ref data_deletion_files) = self.data_deletion_files {
655 if data_deletion_files.len() != data_files.len() {
656 return Err(crate::Error::UnexpectedError {
657 message: format!(
658 "DataSplit deletion files length {} must match data_files length {}",
659 data_deletion_files.len(),
660 data_files.len()
661 ),
662 source: None,
663 });
664 }
665 }
666 Ok(DataSplit {
667 snapshot_id: self.snapshot_id,
668 partition,
669 bucket: self.bucket,
670 bucket_path,
671 total_buckets: self.total_buckets,
672 data_files,
673 data_deletion_files: self.data_deletion_files,
674 row_ranges: self.row_ranges,
675 })
676 }
677}
678
679impl Default for DataSplitBuilder {

Callers 15

prepare_commitMethod · 0.45
test_file_ioFunction · 0.45
test_append_schemaFunction · 0.45
test_rejects_pk_tableFunction · 0.45
test_file_ioFunction · 0.45
test_file_ioFunction · 0.45
test_schemaFunction · 0.45
test_snapshotFunction · 0.45

Calls 1

lenMethod · 0.45

Tested by 15

test_file_ioFunction · 0.36
test_append_schemaFunction · 0.36
test_rejects_pk_tableFunction · 0.36
test_file_ioFunction · 0.36
test_file_ioFunction · 0.36
test_schemaFunction · 0.36
test_snapshotFunction · 0.36
test_file_ioFunction · 0.36