MCPcopy Create free account
hub / github.com/apache/arrow / UpdateRhs

Method UpdateRhs

cpp/src/arrow/acero/asof_join_node.cc:948–977  ·  view source on GitHub ↗

Advances the RHS as far as possible to be up to date for the current LHS timestamp, and checks if all RHS are up to date with LHS. The reason they have to be performed together is that they both depend on the emptiness of the RHS, which can be changed by Push() executing in another thread.

Source from the content-addressed store, hash-verified

946 // together is that they both depend on the emptiness of the RHS, which can be changed
947 // by Push() executing in another thread.
948 Result<RhsUpdateState> UpdateRhs() {
949 auto& lhs = *state_.at(0);
950 auto lhs_latest_time = lhs.GetLatestTime();
951 RhsUpdateState update_state{/*any_advanced=*/false, /*all_up_to_date_with_lhs=*/true};
952 for (size_t i = 1; i < state_.size(); ++i) {
953 auto& rhs = *state_[i];
954
955 // Obtain RHS emptiness once for subsequent AdvanceAndMemoize() and CurrentEmpty().
956 bool rhs_empty = rhs.Empty();
957 // Obtain RHS current time here because AdvanceAndMemoize() can change the
958 // emptiness.
959 OnType rhs_current_time = rhs_empty ? OnType{} : rhs.GetLatestTime();
960
961 ARROW_ASSIGN_OR_RAISE(bool advanced,
962 rhs.AdvanceAndMemoize(lhs_latest_time, rhs_empty));
963 update_state.any_advanced |= advanced;
964
965 if (update_state.all_up_to_date_with_lhs && !rhs.Finished()) {
966 // If RHS is finished, then we know it's up to date
967 if (rhs.CurrentEmpty(rhs_empty)) {
968 // RHS isn't finished, but is empty --> not up to date
969 update_state.all_up_to_date_with_lhs = false;
970 } else if (lhs_latest_time > rhs_current_time) {
971 // RHS isn't up to date (and not finished)
972 update_state.all_up_to_date_with_lhs = false;
973 }
974 }
975 }
976 return update_state;
977 }
978
979 Result<std::shared_ptr<RecordBatch>> ProcessInner() {
980 DCHECK(!state_.empty());

Callers

nothing calls this directly

Calls 5

CurrentEmptyMethod · 0.80
GetLatestTimeMethod · 0.45
sizeMethod · 0.45
EmptyMethod · 0.45
FinishedMethod · 0.45

Tested by

no test coverage detected