MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / SQLRequestRowBatch

Method SQLRequestRowBatch

src/sdk/sql_request_row.cc:402–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400}
401
402SQLRequestRowBatch::SQLRequestRowBatch(std::shared_ptr<hybridse::sdk::Schema> schema,
403 std::shared_ptr<ColumnIndicesSet> indices):
404 common_selector_(nullptr), non_common_selector_(nullptr) {
405 if (schema == nullptr) {
406 LOG(WARNING) << "Null input schema";
407 return;
408 }
409 common_column_indices_ = indices->common_column_indices_;
410
411 std::vector<size_t> common_indices_vec;
412 std::vector<size_t> non_common_indices_vec;
413 for (int i = 0; i < schema->GetColumnCnt(); ++i) {
414 auto col_ref = request_schema_.Add();
415 col_ref->set_name(schema->GetColumnName(i));
416 col_ref->set_is_not_null(schema->IsColumnNotNull(i));
417 col_ref->set_type(ProtoTypeFromDataType(schema->GetColumnType(i)));
418 if (common_column_indices_.find(i) != common_column_indices_.end()) {
419 common_indices_vec.push_back(i);
420 } else {
421 non_common_indices_vec.push_back(i);
422 }
423 }
424
425 if (!common_column_indices_.empty()) {
426 common_selector_ = std::unique_ptr<::hybridse::codec::RowSelector>(
427 new ::hybridse::codec::RowSelector(&request_schema_, common_indices_vec));
428 non_common_selector_ = std::unique_ptr<::hybridse::codec::RowSelector>(
429 new ::hybridse::codec::RowSelector(&request_schema_, non_common_indices_vec));
430 }
431}
432
433bool SQLRequestRowBatch::AddRow(std::shared_ptr<SQLRequestRow> row) {
434 if (row == nullptr || !row->OK()) {

Callers 1

doBatchRowRequestMethod · 0.80

Calls 2

ProtoTypeFromDataTypeFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected