@@ -1273,8 +1273,9 @@ std::unordered_map<uint32_t, SafeBCFHdr> TileDBVCFDataset::fetch_vcf_headers(
1273
1273
do {
1274
1274
// Always reset buffer to avoid issue with core library and REST not using
1275
1275
// original buffer sizes
1276
- query.set_buffer (" header" , offsets, data);
1277
- query.set_buffer (" sample" , sample_data);
1276
+ query.set_data_buffer (" header" , data);
1277
+ query.set_offsets_buffer (" header" , offsets);
1278
+ query.set_data_buffer (" sample" , sample_data);
1278
1279
1279
1280
status = query.submit ();
1280
1281
@@ -1749,11 +1750,13 @@ void TileDBVCFDataset::write_vcf_headers_v4(
1749
1750
1750
1751
query.set_layout (TILEDB_UNORDERED);
1751
1752
auto offsets_and_data = ungroup_var_buffer (headers);
1752
- query.set_buffer (" header" , offsets_and_data);
1753
+ query.set_data_buffer (" header" , offsets_and_data.second );
1754
+ query.set_offsets_buffer (" header" , offsets_and_data.first );
1753
1755
1754
1756
auto sample_offsets_and_data = ungroup_var_buffer (samples);
1755
1757
1756
- query.set_buffer (" sample" , sample_offsets_and_data);
1758
+ query.set_data_buffer (" sample" , sample_offsets_and_data.second );
1759
+ query.set_offsets_buffer (" sample" , sample_offsets_and_data.first );
1757
1760
auto st = query.submit ();
1758
1761
if (st != Query::Status::COMPLETE)
1759
1762
throw std::runtime_error (
@@ -1773,19 +1776,22 @@ void TileDBVCFDataset::write_vcf_headers_v2(
1773
1776
1774
1777
// Build data vector and subarray
1775
1778
std::vector<std::string> headers;
1776
- std::vector<uint32_t > subarray = {
1779
+ Subarray subarray = Subarray (array.schema ().context (), array);
1780
+ std::pair<uint32_t , uint32_t > bounds = {
1777
1781
std::numeric_limits<uint32_t >::max (),
1778
1782
std::numeric_limits<uint32_t >::min ()};
1779
1783
for (const auto & pair : vcf_headers) {
1780
- subarray[ 0 ] = std::min (subarray[ 0 ] , pair.first );
1781
- subarray[ 1 ] = std::max (subarray[ 1 ] , pair.first );
1784
+ bounds. first = std::min (bounds. first , pair.first );
1785
+ bounds. second = std::max (bounds. second , pair.first );
1782
1786
headers.push_back (pair.second );
1783
1787
}
1788
+ subarray.add_range (0 , bounds.first , bounds.second );
1784
1789
1785
1790
auto offsets_and_data = ungroup_var_buffer (headers);
1786
1791
query.set_layout (TILEDB_ROW_MAJOR)
1787
1792
.set_subarray (subarray)
1788
- .set_buffer (" header" , offsets_and_data);
1793
+ .set_data_buffer (" header" , offsets_and_data.second )
1794
+ .set_offsets_buffer (" header" , offsets_and_data.first );
1789
1795
auto st = query.submit ();
1790
1796
if (st != Query::Status::COMPLETE)
1791
1797
throw std::runtime_error (
@@ -2138,7 +2144,10 @@ std::vector<std::string> TileDBVCFDataset::get_all_samples_from_vcf_headers()
2138
2144
auto non_empty_domain = vcf_header_array_->non_empty_domain_var (0 );
2139
2145
if (non_empty_domain.first .empty () && non_empty_domain.second .empty ())
2140
2146
return {};
2141
- query.add_range (0 , non_empty_domain.first , non_empty_domain.second );
2147
+ Subarray subarray =
2148
+ Subarray (vcf_header_array_->schema ().context (), *vcf_header_array_);
2149
+ subarray.add_range (0 , non_empty_domain.first , non_empty_domain.second );
2150
+ query.set_subarray (subarray);
2142
2151
query.set_layout (TILEDB_ROW_MAJOR);
2143
2152
2144
2153
uint64_t sample_offset_element = 0 ;
@@ -2168,7 +2177,8 @@ std::vector<std::string> TileDBVCFDataset::get_all_samples_from_vcf_headers()
2168
2177
do {
2169
2178
// Always reset buffer to avoid issue with core library and REST not using
2170
2179
// original buffer sizes
2171
- query.set_buffer (" sample" , sample_offsets, sample_data);
2180
+ query.set_data_buffer (" sample" , sample_data);
2181
+ query.set_offsets_buffer (" sample" , sample_offsets);
2172
2182
2173
2183
status = query.submit ();
2174
2184
0 commit comments