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

Method Move

cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_result_set.cc:64–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64size_t FlightSqlResultSet::Move(size_t rows, size_t bind_offset, size_t bind_type,
65 uint16_t* row_status_array) {
66 // Consider it might be the first call to Move() and current_chunk is not
67 // populated yet
68 assert(rows > 0);
69 if (current_chunk_.data == nullptr) {
70 if (!chunk_buffer_.GetNext(&current_chunk_)) {
71 return 0;
72 }
73
74 if (transformer_) {
75 current_chunk_.data = transformer_->Transform(current_chunk_.data);
76 }
77
78 for (size_t column_num = 0; column_num < columns_.size(); ++column_num) {
79 columns_[column_num].ResetAccessor(current_chunk_.data->column(column_num));
80 }
81 }
82
83 // Reset GetData value offsets.
84 if (static_cast<size_t>(num_binding_) != get_data_offsets_.size() && reset_get_data_) {
85 std::fill(get_data_offsets_.begin(), get_data_offsets_.end(), 0);
86 }
87
88 size_t fetched_rows = 0;
89 while (fetched_rows < rows) {
90 size_t batch_rows = current_chunk_.data->num_rows();
91 size_t rows_to_fetch = std::min(static_cast<size_t>(rows - fetched_rows),
92 static_cast<size_t>(batch_rows - current_row_));
93
94 if (rows_to_fetch == 0) {
95 if (!chunk_buffer_.GetNext(&current_chunk_)) {
96 break;
97 }
98
99 if (transformer_) {
100 current_chunk_.data = transformer_->Transform(current_chunk_.data);
101 }
102
103 for (size_t column_num = 0; column_num < columns_.size(); ++column_num) {
104 columns_[column_num].ResetAccessor(current_chunk_.data->column(column_num));
105 }
106 current_row_ = 0;
107 continue;
108 }
109
110 for (auto& column : columns_) {
111 // There can be unbound columns.
112 if (!column.is_bound) continue;
113
114 auto* accessor = column.GetAccessorForBinding();
115 ColumnBinding shifted_binding = column.binding;
116 uint16_t* shifted_row_status_array =
117 row_status_array ? &row_status_array[fetched_rows] : nullptr;
118
119 if (shifted_row_status_array) {
120 std::fill(shifted_row_status_array, &shifted_row_status_array[rows_to_fetch],
121 RowStatus_SUCCESS);

Callers 6

TestBindColumnFunction · 0.45
TestGetDataFunction · 0.45
TestBindColumnBigIntFunction · 0.45
TestGetTablesV2Function · 0.45
TestGetColumnsV3Function · 0.45
FetchMethod · 0.45

Calls 12

DriverExceptionClass · 0.85
ResetAccessorMethod · 0.80
GetAccessorForBindingMethod · 0.80
GetCellLengthMethod · 0.80
GetColumnarDataMethod · 0.80
GetNextMethod · 0.45
TransformMethod · 0.45
sizeMethod · 0.45
columnMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
num_rowsMethod · 0.45

Tested by 5

TestBindColumnFunction · 0.36
TestGetDataFunction · 0.36
TestBindColumnBigIntFunction · 0.36
TestGetTablesV2Function · 0.36
TestGetColumnsV3Function · 0.36