MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / read_array

Method read_array

test/src/unit-cppapi-query-condition-enumerations.cc:901–1068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899}
900
901std::vector<ResultEnmrQCCell> CPPQueryConditionEnumerationFx::read_array(
902 EnmrQCCreator creator) {
903 Array array(ctx_, uri_, TILEDB_READ);
904 Query query(ctx_, array);
905
906 if (type_ == TILEDB_DENSE) {
907 Subarray subarray(ctx_, array);
908 subarray.add_range<uint32_t>(0, 1, num_rows_);
909 query.set_subarray(subarray);
910 } else {
911 query.set_layout(TILEDB_GLOBAL_ORDER);
912 }
913
914 std::vector<uint32_t> row_ids(num_rows_);
915 std::vector<char> sample_names(num_rows_ * 2 * strlen("AAAA00000000"));
916 std::vector<uint64_t> sample_name_offsets(num_rows_);
917 std::vector<uint8_t> cell_types(num_rows_);
918 std::vector<uint8_t> cycle_phases(num_rows_);
919 std::vector<uint8_t> cycle_phases_validity(num_rows_);
920 std::vector<uint8_t> wavelengths(num_rows_);
921 std::vector<float> luminosities(num_rows_);
922
923 auto qc = creator(ctx_);
924 if (serialize_) {
925 qc = serialize_deserialize_qc(qc);
926 }
927
928 query.set_condition(qc)
929 .set_data_buffer("row_id", row_ids)
930 .set_data_buffer("sample_name", sample_names)
931 .set_offsets_buffer("sample_name", sample_name_offsets)
932 .set_data_buffer("cell_type", cell_types)
933 .set_data_buffer("cycle_phase", cycle_phases)
934 .set_validity_buffer("cycle_phase", cycle_phases_validity)
935 .set_data_buffer("wavelength", wavelengths)
936 .set_data_buffer("luminosity", luminosities);
937
938 REQUIRE(query.submit() == Query::Status::COMPLETE);
939
940 auto table = query.result_buffer_elements();
941
942 row_ids.resize(table["row_id"].second);
943 sample_name_offsets.resize(table["sample_name"].first);
944 cell_types.resize(table["cell_type"].second);
945 cycle_phases.resize(table["cycle_phase"].second);
946 cycle_phases_validity.resize(table["cycle_phase"].second);
947 wavelengths.resize(table["wavelength"].second);
948 luminosities.resize(table["luminosity"].second);
949
950 // Create our result cell instances
951 //
952 // Remember here that the default constructed instances are in the
953 // test-uninitialized state.
954 //
955 // The second thing to remember, is that this for loop is has two slightly
956 // different behaviors between dense and sparse queries. For spares, we can
957 // iterate over 0, 1, or up to num_rows_ matches. For dense, it always
958 // iterates of num_rows_ entries because non-matches are returned as fill

Callers

nothing calls this directly

Calls 13

set_conditionMethod · 0.80
copy_fillMethod · 0.80
set_subarrayMethod · 0.45
set_layoutMethod · 0.45
set_data_bufferMethod · 0.45
set_validity_bufferMethod · 0.45
set_offsets_bufferMethod · 0.45
submitMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected