MCPcopy Create free account
hub / github.com/apache/impala / Prepare

Method Prepare

be/src/exec/paimon/paimon-jni-scan-node.cc:49–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 arrow_record_batch_row_index_(0) {}
48
49Status PaimonJniScanNode::Prepare(RuntimeState* state) {
50 RETURN_IF_ERROR(ScanNode::Prepare(state));
51 DCHECK(scan_range_params_ != NULL)
52 << "Must call SetScanRanges() before calling Prepare()";
53
54 scan_open_timer_ = ADD_TIMER(runtime_profile(), "ScanOpenTime");
55 paimon_api_scan_timer_ = ADD_TIMER(runtime_profile(), "PaimonApiScanTime");
56
57 tuple_desc_ = state->desc_tbl().GetTupleDescriptor(tuple_id_);
58 if (tuple_desc_ == nullptr) {
59 return Status(
60 "Failed to get tuple descriptor, tuple id: " + std::to_string(tuple_id_));
61 }
62 arrow_batch_mem_tracker_.reset(
63 new MemTracker(-1, "Arrow Batch", this->mem_tracker(), false));
64 /// Construct the jni scan param, the param will be used in PaimonJniScanner.
65 paimon_jni_scan_param_.__set_paimon_table_obj(
66 plan_node_.tnode_->paimon_table_scan_node.paimon_table_obj);
67 /// update projection id, will get the top-level field ids of each tuple.
68 std::vector<int32_t> field_ids;
69 RETURN_IF_ERROR(CollectProjectionFieldIds(tuple_desc_, field_ids));
70 paimon_jni_scan_param_.__set_projection(field_ids);
71 LOG(INFO) << table_name_ << " Contains " << field_ids.size() << " field ids."
72 << std::endl;
73 paimon_jni_scan_param_.__set_mem_limit_bytes(
74 arrow_batch_mem_tracker_->GetLowestLimit(MemLimit::HARD));
75 paimon_jni_scan_param_.__set_batch_size(state->batch_size());
76 paimon_jni_scan_param_.__set_fragment_id(state->fragment_instance_id());
77 std::vector<std::string> scan_range_vector;
78 for (const ScanRangeParamsPB& params : *scan_range_params_) {
79 DCHECK(params.scan_range().has_file_metadata());
80 const std::string& split = params.scan_range().file_metadata();
81 scan_range_vector.push_back(split);
82 }
83 paimon_jni_scan_param_.__set_splits(scan_range_vector);
84 /// Check if splits is empty
85 splits_empty_ = scan_range_vector.empty();
86 impala::ThriftSerializer serializer(false);
87 /// serialize the jni scan param to binary.
88 RETURN_IF_ERROR(serializer.SerializeToString<TPaimonJniScanParam>(
89 &paimon_jni_scan_param_, &paimon_jni_scan_param_serialized_));
90 return Status::OK();
91}
92
93Status PaimonJniScanNode::Open(RuntimeState* state) {
94 SCOPED_TIMER(scan_open_timer_);

Callers

nothing calls this directly

Calls 11

OKFunction · 0.85
GetTupleDescriptorMethod · 0.80
GetLowestLimitMethod · 0.80
batch_sizeMethod · 0.80
push_backMethod · 0.80
StatusClass · 0.70
resetMethod · 0.65
mem_trackerMethod · 0.45
sizeMethod · 0.45
scan_rangeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected