quasardb 3.14.2.dev3__cp312-cp312-win32.whl → 3.14.2.dev5__cp312-cp312-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of quasardb might be problematic. Click here for more details.

Files changed (105) hide show
  1. quasardb/INSTALL.vcxproj +5 -4
  2. quasardb/__init__.py +21 -7
  3. quasardb/cmake_install.cmake +6 -0
  4. quasardb/date/ALL_BUILD.vcxproj +9 -8
  5. quasardb/date/CMakeFiles/Export/df49adab93b9e0c10c64f72458b31971/dateTargets.cmake +2 -2
  6. quasardb/date/CMakeFiles/generate.stamp.depend +4 -4
  7. quasardb/date/INSTALL.vcxproj +5 -4
  8. quasardb/date/cmake_install.cmake +6 -0
  9. quasardb/date/dateTargets.cmake +2 -2
  10. quasardb/extensions/writer.py +59 -61
  11. quasardb/firehose.py +24 -22
  12. quasardb/numpy/__init__.py +181 -120
  13. quasardb/pandas/__init__.py +145 -95
  14. quasardb/pool.py +13 -2
  15. quasardb/pybind11/ALL_BUILD.vcxproj +9 -8
  16. quasardb/pybind11/CMakeFiles/generate.stamp.depend +14 -14
  17. quasardb/pybind11/INSTALL.vcxproj +5 -4
  18. quasardb/pybind11/cmake_install.cmake +6 -0
  19. quasardb/qdb_api.dll +0 -0
  20. quasardb/quasardb.cp312-win32.pyd +0 -0
  21. quasardb/range-v3/ALL_BUILD.vcxproj +9 -8
  22. quasardb/range-v3/CMakeFiles/Export/d94ef200eca10a819b5858b33e808f5b/range-v3-targets.cmake +2 -2
  23. quasardb/range-v3/CMakeFiles/generate.stamp.depend +11 -11
  24. quasardb/range-v3/INSTALL.vcxproj +5 -4
  25. quasardb/range-v3/cmake_install.cmake +6 -0
  26. quasardb/range-v3/range-v3-config.cmake +2 -2
  27. quasardb/range-v3/range.v3.headers.vcxproj +9 -8
  28. quasardb/stats.py +92 -80
  29. quasardb/table_cache.py +5 -1
  30. {quasardb-3.14.2.dev3.dist-info → quasardb-3.14.2.dev5.dist-info}/METADATA +13 -8
  31. quasardb-3.14.2.dev5.dist-info/RECORD +54 -0
  32. {quasardb-3.14.2.dev3.dist-info → quasardb-3.14.2.dev5.dist-info}/WHEEL +1 -1
  33. quasardb/CMakeLists.txt +0 -517
  34. quasardb/batch_column.hpp +0 -80
  35. quasardb/batch_inserter.hpp +0 -248
  36. quasardb/blob.hpp +0 -150
  37. quasardb/cluster.cpp +0 -102
  38. quasardb/cluster.hpp +0 -593
  39. quasardb/concepts.hpp +0 -322
  40. quasardb/continuous.cpp +0 -199
  41. quasardb/continuous.hpp +0 -109
  42. quasardb/convert/array.hpp +0 -299
  43. quasardb/convert/point.hpp +0 -330
  44. quasardb/convert/range.hpp +0 -282
  45. quasardb/convert/unicode.hpp +0 -598
  46. quasardb/convert/util.hpp +0 -22
  47. quasardb/convert/value.hpp +0 -782
  48. quasardb/convert.hpp +0 -38
  49. quasardb/detail/invoke.hpp +0 -0
  50. quasardb/detail/qdb_resource.hpp +0 -129
  51. quasardb/detail/retry.cpp +0 -30
  52. quasardb/detail/retry.hpp +0 -147
  53. quasardb/detail/sleep.hpp +0 -53
  54. quasardb/detail/ts_column.hpp +0 -224
  55. quasardb/detail/writer.cpp +0 -440
  56. quasardb/detail/writer.hpp +0 -550
  57. quasardb/direct_blob.hpp +0 -108
  58. quasardb/direct_handle.hpp +0 -83
  59. quasardb/direct_integer.hpp +0 -94
  60. quasardb/dispatch.hpp +0 -157
  61. quasardb/double.hpp +0 -87
  62. quasardb/entry.hpp +0 -273
  63. quasardb/error.hpp +0 -393
  64. quasardb/handle.cpp +0 -29
  65. quasardb/handle.hpp +0 -98
  66. quasardb/integer.hpp +0 -88
  67. quasardb/logger.cpp +0 -106
  68. quasardb/logger.hpp +0 -228
  69. quasardb/masked_array.hpp +0 -658
  70. quasardb/metrics.cpp +0 -103
  71. quasardb/metrics.hpp +0 -112
  72. quasardb/module.cpp +0 -92
  73. quasardb/module.hpp +0 -24
  74. quasardb/node.hpp +0 -132
  75. quasardb/numpy.cpp +0 -6
  76. quasardb/numpy.hpp +0 -489
  77. quasardb/object_tracker.hpp +0 -282
  78. quasardb/options.hpp +0 -273
  79. quasardb/perf.hpp +0 -336
  80. quasardb/properties.cpp +0 -41
  81. quasardb/properties.hpp +0 -85
  82. quasardb/pytypes.hpp +0 -221
  83. quasardb/query.cpp +0 -420
  84. quasardb/query.hpp +0 -92
  85. quasardb/reader.cpp +0 -282
  86. quasardb/reader.hpp +0 -256
  87. quasardb/remove_cvref.hpp +0 -31
  88. quasardb/string.hpp +0 -160
  89. quasardb/table.cpp +0 -257
  90. quasardb/table.hpp +0 -366
  91. quasardb/tag.hpp +0 -77
  92. quasardb/timestamp.hpp +0 -97
  93. quasardb/traits.hpp +0 -642
  94. quasardb/ts_iterator.hpp +0 -193
  95. quasardb/utils/blob_deque.hpp +0 -96
  96. quasardb/utils/ostream.hpp +0 -17
  97. quasardb/utils/permutation.hpp +0 -50
  98. quasardb/utils/stable_sort.hpp +0 -25
  99. quasardb/utils/unzip_view.hpp +0 -89
  100. quasardb/utils.cpp +0 -28
  101. quasardb/utils.hpp +0 -174
  102. quasardb/writer.hpp +0 -354
  103. quasardb-3.14.2.dev3.dist-info/RECORD +0 -124
  104. {quasardb-3.14.2.dev3.dist-info → quasardb-3.14.2.dev5.dist-info}/LICENSE.md +0 -0
  105. {quasardb-3.14.2.dev3.dist-info → quasardb-3.14.2.dev5.dist-info}/top_level.txt +0 -0
quasardb/reader.cpp DELETED
@@ -1,282 +0,0 @@
1
- #include "reader.hpp"
2
- #include "error.hpp"
3
- #include "table.hpp"
4
- #include "traits.hpp"
5
- #include "convert/array.hpp"
6
- #include "convert/value.hpp"
7
- #include "detail/qdb_resource.hpp"
8
- #include <range/v3/view/counted.hpp>
9
-
10
- namespace qdb
11
- {
12
-
13
- namespace detail
14
- {
15
-
16
- /* static */ py::dict reader_data::convert(qdb_bulk_reader_table_data_t const & data)
17
- {
18
- py::dict ret{};
19
-
20
- // typedef struct
21
- // {
22
- // qdb_size_t row_count;
23
- // qdb_size_t column_count;
24
- // const qdb_timespec_t * timestamps;
25
- // const qdb_exp_batch_push_column_t * columns;
26
- // } qdb_exp_batch_push_table_data_t;
27
-
28
- // Convert the timestamp index, which should never contain null values
29
- // and thus is *not* a masked array.
30
- auto timestamps = ranges::views::counted(data.timestamps, data.row_count);
31
- auto columns = ranges::views::counted(data.columns, data.column_count);
32
-
33
- py::array idx = convert::array<qdb_timespec_t, traits::datetime64_ns_dtype>(timestamps);
34
- qdb::masked_array idx_ = qdb::masked_array::masked_none(idx);
35
-
36
- ret[py::str("$timestamp")] = idx;
37
-
38
- for (qdb_exp_batch_push_column_t const & column : columns)
39
- {
40
- // typedef struct // NOLINT(modernize-use-using)
41
- // {
42
- // char const * name;
43
- // qdb_ts_column_type_t data_type;
44
- // union
45
- // {
46
- // const qdb_timespec_t * timestamps;
47
- // const qdb_string_t * strings;
48
- // const qdb_blob_t * blobs;
49
- // const qdb_int_t * ints;
50
- // const double * doubles;
51
- // } data;
52
- // } qdb_exp_batch_push_column_t;
53
-
54
- py::str column_name{column.name};
55
-
56
- qdb::masked_array xs;
57
- switch (column.data_type)
58
- {
59
- case qdb_ts_column_int64:
60
- xs = convert::masked_array<qdb_int_t, traits::int64_dtype>(
61
- ranges::views::counted(column.data.ints, data.row_count));
62
- break;
63
- case qdb_ts_column_double:
64
- xs = convert::masked_array<double, traits::float64_dtype>(
65
- ranges::views::counted(column.data.doubles, data.row_count));
66
- break;
67
- case qdb_ts_column_string:
68
- xs = convert::masked_array<qdb_string_t, traits::unicode_dtype>(
69
- ranges::views::counted(column.data.strings, data.row_count));
70
- break;
71
- case qdb_ts_column_blob:
72
- xs = convert::masked_array<qdb_blob_t, traits::pyobject_dtype>(
73
- ranges::views::counted(column.data.blobs, data.row_count));
74
- break;
75
- case qdb_ts_column_timestamp:
76
- xs = convert::masked_array<qdb_timespec_t, traits::datetime64_ns_dtype>(
77
- ranges::views::counted(column.data.timestamps, data.row_count));
78
- break;
79
-
80
- case qdb_ts_column_symbol:
81
- // This should not happen, as "symbol" is just an internal representation, and symbols
82
- // are exposed to the user as strings. If this actually happens, it indicates either
83
- // a bug in the bulk reader *or* a memory corruption.
84
- throw qdb::not_implemented_exception(
85
- "Internal error: invalid data type: symbol column type returned from bulk reader");
86
-
87
- case qdb_ts_column_uninitialized:
88
- throw qdb::not_implemented_exception(
89
- "Internal error: invalid data type: unintialized column "
90
- "type returned from bulk reader");
91
- };
92
-
93
- ret[std::move(column_name)] = std::move(xs.cast(py::return_value_policy::move));
94
- }
95
-
96
- return ret;
97
- }
98
-
99
- reader_iterator & reader_iterator::operator++()
100
- {
101
- if (ptr_ == nullptr)
102
- {
103
- // This means this is either the first invocation, or we have
104
- // previously exhausted all tables in the current "fetch" and
105
- // should fetch next.
106
- qdb_error_t err = qdb_bulk_reader_get_data(reader_, &ptr_, batch_size_);
107
-
108
- if (err == qdb_e_iterator_end) [[unlikely]]
109
- {
110
- // We have reached the end -- reset all our internal state, and make us look
111
- // like the "end" iterator.
112
- handle_ = nullptr;
113
- reader_ = nullptr;
114
- batch_size_ = 0;
115
- table_count_ = 0;
116
- ptr_ = nullptr;
117
- n_ = 0;
118
- }
119
- else
120
- {
121
- qdb::qdb_throw_if_error(*handle_, err);
122
-
123
- // I like assertions
124
- assert(handle_ != nullptr);
125
- assert(reader_ != nullptr);
126
- assert(table_count_ != 0);
127
- assert(ptr_ != nullptr);
128
-
129
- n_ = 0;
130
- }
131
- }
132
- else
133
- {
134
- assert(ptr_ != nullptr);
135
-
136
- if (++n_ == table_count_)
137
- {
138
- // We have exhausted our tables. What we will do is just "reset" our internal state
139
- // to how it would be after the initial constructor, and recurse into this function,
140
- // which should then just follow the regular flow above
141
- qdb_release(*handle_, ptr_);
142
-
143
- ptr_ = nullptr;
144
- n_ = 0;
145
-
146
- return this->operator++();
147
- }
148
-
149
- // At this point, we *must* have a valid state
150
- assert(ptr_ != nullptr);
151
- assert(n_ < table_count_);
152
-
153
- } // if (ptr_ == nullptr)
154
- return *this;
155
- };
156
-
157
- }; // namespace detail
158
-
159
- qdb::reader const & reader::enter()
160
- {
161
- // Very small scope, because we don't need any of the allocated memory after this function is
162
- // finished, so we will also release memory early.
163
- qdb::object_tracker::scoped_repository object_tracker{};
164
- qdb::object_tracker::scoped_capture capture{object_tracker};
165
-
166
- std::vector<qdb_bulk_reader_table_t> tables{};
167
- tables.reserve(table_names_.size());
168
-
169
- //
170
- // Convert columns if applicable
171
- //
172
- char const ** columns{nullptr};
173
-
174
- // If column names were provided, set them. Otherwise, it defaults to "all columns".
175
- if (column_names_.empty() == false)
176
- {
177
-
178
- // Note that this particular converter copies the string and it's tracked
179
- // using the object tracker.
180
- //
181
- // Pre-allocate the data for the columns, make sure that the memory is tracked,
182
- // so we don't have to worry about memory loss.
183
- columns = object_tracker::alloc<char const *>(column_names_.size() * sizeof(char const *));
184
-
185
- for (std::size_t i = 0; i < column_names_.size(); ++i)
186
- {
187
- // Because the scope of `column_names_` outlives this function / scope, we don't have
188
- // to copy the string, but can just directly use the .c_str() and things will work out.
189
- columns[i] = column_names_.at(i).c_str();
190
- }
191
- }
192
-
193
- qdb_ts_range_t * ranges{nullptr};
194
-
195
- if (ranges_.empty() == false)
196
- {
197
- // Pre-allocate the data for the columns, make sure that the memory is tracked,
198
- // so we don't have to worry about memory loss.
199
- ranges = object_tracker::alloc<qdb_ts_range_t>(ranges_.size() * sizeof(qdb_ts_range_t));
200
-
201
- for (std::size_t i = 0; i < ranges_.size(); ++i)
202
- {
203
- // This convert::value does not allocate anything on the heap
204
- ranges[i] = convert::value<py::tuple, qdb_ts_range_t>(ranges_.at(i));
205
- }
206
- }
207
-
208
- // We either have columns and have the actual array set, *or* we do not have any customized
209
- // columns at all.
210
- // Same applies for ranges
211
- assert((columns == nullptr) == (column_names_.empty() == true));
212
- assert((ranges == nullptr) == (ranges_.empty() == true));
213
-
214
- for (std::string const & table_name : table_names_)
215
- {
216
- tables.emplace_back(qdb_bulk_reader_table_t{
217
- // because the scope of `table_name` outlives this function, we can just directly
218
- // use .c_str() without any copies.
219
- table_name.c_str(), //
220
- columns, //
221
- column_names_.size(), //
222
- ranges, //
223
- ranges_.size() //
224
- });
225
- }
226
-
227
- qdb::qdb_throw_if_error(
228
- *handle_, qdb_bulk_reader_fetch(*handle_, tables.data(), tables.size(), &reader_));
229
-
230
- return *this;
231
- }
232
-
233
- void reader::close()
234
- {
235
- // Even though that from the API it looks like value, qdb_reader_handle_t is actually a pointer
236
- // itself that needs to be released. This static assert checks for that.
237
- static_assert(std::is_pointer<decltype(reader_)>());
238
-
239
- if (reader_ != nullptr)
240
- {
241
- logger_.debug("closing reader");
242
- qdb_release(*handle_, reader_);
243
- reader_ = nullptr;
244
- }
245
-
246
- assert(reader_ == nullptr);
247
- }
248
-
249
- void register_reader(py::module_ & m)
250
- {
251
- namespace py = pybind11;
252
-
253
- auto reader_c = py::class_<qdb::reader>{m, "Reader"};
254
-
255
- // basic interface
256
- reader_c
257
- .def(py::init< //
258
- qdb::handle_ptr, //
259
- std::vector<std::string> const &, //
260
- std::vector<std::string> const &, //
261
- std::size_t, //
262
- std::vector<py::tuple> const &>(), //
263
- py::arg("conn"), //
264
- py::arg("table_names"), //
265
- py::kw_only(), //
266
- py::arg("column_names") = std::vector<std::string>{}, //
267
- py::arg("batch_size") = std::size_t{0}, //
268
- py::arg("ranges") = std::vector<py::tuple>{} //
269
- ) //
270
- //
271
- .def("get_batch_size", &qdb::reader::get_batch_size) //
272
- //
273
- .def("__enter__", &qdb::reader::enter) //
274
- .def("__exit__", &qdb::reader::exit) //
275
- .def( //
276
- "__iter__", [](qdb::reader & r) { return py::make_iterator(r.begin(), r.end()); }, //
277
- py::keep_alive<0, 1>());
278
-
279
- //
280
- }
281
-
282
- } // namespace qdb
quasardb/reader.hpp DELETED
@@ -1,256 +0,0 @@
1
- /*
2
- *
3
- * Official Python API
4
- *
5
- * Copyright (c) 2009-2021, quasardb SAS. All rights reserved.
6
- * All rights reserved.
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions are met:
10
- *
11
- * * Redistributions of source code must retain the above copyright
12
- * notice, this list of conditions and the following disclaimer.
13
- * * Redistributions in binary form must reproduce the above copyright
14
- * notice, this list of conditions and the following disclaimer in the
15
- * documentation and/or other materials provided with the distribution.
16
- * * Neither the name of quasardb nor the names of its contributors may
17
- * be used to endorse or promote products derived from this software
18
- * without specific prior written permission.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY QUASARDB AND CONTRIBUTORS ``AS IS'' AND ANY
21
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
24
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
- */
31
- #pragma once
32
-
33
- #include "handle.hpp"
34
- #include "logger.hpp"
35
- #include "object_tracker.hpp"
36
- #include <qdb/ts.h>
37
- #include <unordered_map>
38
- #include <vector>
39
-
40
- namespace py = pybind11;
41
-
42
- namespace qdb
43
- {
44
-
45
- namespace detail
46
- {
47
-
48
- using int64_column = std::vector<qdb_int_t>;
49
- using double_column = std::vector<double>;
50
- using timestamp_column = std::vector<qdb_timespec_t>;
51
- using blob_column = std::vector<qdb_blob_t>;
52
- using string_column = std::vector<qdb_string_t>;
53
-
54
- class reader_data
55
- {
56
- public:
57
- /**
58
- * Utility function which converts table data into a vanilla dict. Currently this works well, as
59
- * there isn't any additional data/state we need to keep track of --
60
- */
61
- static py::dict convert(qdb_bulk_reader_table_data_t const & data);
62
- };
63
-
64
- class reader_iterator
65
- {
66
- public:
67
- // Default constructor, which represents the "end" of the range
68
- reader_iterator() noexcept
69
- : handle_{nullptr}
70
- , reader_{nullptr}
71
- , batch_size_{0}
72
- , table_count_{0}
73
- , ptr_{nullptr}
74
- , n_{0}
75
- {}
76
-
77
- // Actual initialization
78
- reader_iterator(
79
- handle_ptr handle, qdb_reader_handle_t reader, std::size_t batch_size, std::size_t table_count)
80
- : handle_{handle}
81
- , reader_{reader}
82
- , batch_size_{batch_size}
83
- , table_count_{table_count}
84
-
85
- , ptr_{nullptr}
86
- , n_{0}
87
- {
88
- // Always immediately try to fetch the first batch.
89
- this->operator++();
90
- }
91
-
92
- bool operator!=(reader_iterator const & rhs) const noexcept
93
- {
94
- return !(*this == rhs);
95
- }
96
-
97
- bool operator==(reader_iterator const & rhs) const noexcept
98
- {
99
- // This is just a sanity check: if our handle_ is null, it means basically
100
- // the entire object has to be null, and this will basically represent the
101
- // ".end()" iterator.
102
-
103
- if (handle_ == nullptr)
104
- {
105
- assert(reader_ == nullptr);
106
- assert(ptr_ == nullptr);
107
- }
108
- else
109
- {
110
- assert(reader_ != nullptr);
111
- assert(ptr_ != nullptr);
112
- }
113
-
114
- // Optimization: we *only* compare the pointers, we don't actually compare
115
- // the data itself. This saves a bazillion comparisons, and for the purpose
116
- // of iterators, we really only care whether the current iterator is at the
117
- // end.
118
- return (handle_ == rhs.handle_ //
119
- && reader_ == rhs.reader_ //
120
- && batch_size_ == rhs.batch_size_ //
121
- && table_count_ == rhs.table_count_ //
122
- && ptr_ == rhs.ptr_ && n_ == rhs.n_);
123
- }
124
-
125
- reader_iterator & operator++();
126
-
127
- py::dict operator*()
128
- {
129
- assert(ptr_ != nullptr);
130
- assert(n_ < table_count_);
131
-
132
- return reader_data::convert(ptr_[n_]);
133
- }
134
-
135
- private:
136
- qdb::handle_ptr handle_;
137
- qdb_reader_handle_t reader_;
138
-
139
- /**
140
- * The amount of rows to fetch in one operation. This can span multiple tables.
141
- */
142
- std::size_t batch_size_;
143
-
144
- /**
145
- * `table_count_` enables us to manage how much far we can iterate `ptr_`.
146
- */
147
- std::size_t table_count_;
148
- qdb_bulk_reader_table_data_t * ptr_;
149
- std::size_t n_;
150
- };
151
-
152
- }; // namespace detail
153
-
154
- class reader
155
- {
156
- public:
157
- using iterator = detail::reader_iterator;
158
-
159
- public:
160
- /**
161
- * Tables must always be a list of actual table objects. This ensures the lifetime
162
- * of any metadata inside the tables (such as its name) will always exceed that
163
- * of the reader, which simplifies things a lot.
164
- */
165
- reader( //
166
- qdb::handle_ptr handle, //
167
- std::vector<std::string> const & table_names, //
168
- std::vector<std::string> const & column_names, //
169
- std::size_t batch_size, //
170
- std::vector<py::tuple> const & ranges) //
171
- : logger_("quasardb.reader")
172
- , handle_{handle}
173
- , reader_{nullptr}
174
- , table_names_{table_names}
175
- , column_names_{column_names}
176
- , batch_size_{batch_size}
177
- , ranges_{ranges}
178
- {}
179
-
180
- // prevent copy because of the table object, use a unique_ptr of the batch in cluster
181
- // to return the object.
182
- //
183
- // we prevent these copies because that is almost never what you want, and it gives us
184
- // more freedom in storing a lot of data inside this object.
185
- reader(const reader &) = delete;
186
- reader(reader &&) = delete;
187
-
188
- ~reader()
189
- {
190
- close();
191
- }
192
-
193
- /**
194
- * Convenience function for accessing the configured batch size. Returns 0 when everything should
195
- * be read in a single batch.
196
- */
197
- constexpr inline std::size_t get_batch_size() const noexcept
198
- {
199
- return batch_size_;
200
- }
201
-
202
- /**
203
- * Opens the actual reader; this will initiatate a call to quasardb and initialize the local
204
- * reader handle. If table strings are provided instead of qdb::table objects, will automatically
205
- * look those up.
206
- *
207
- * May throw exception upon error.
208
- *
209
- * :NOTE(leon): We just return a reference to ourselves, but maybe we want the outer object to wrap
210
- * a subclass and return that as well. Not 100% sure if that's the best way to go. This
211
- * works right now and is the same approach that we take with e.g. qdb::cluster
212
- */
213
- reader const & enter();
214
-
215
- void exit(pybind11::object type, pybind11::object value, pybind11::object traceback)
216
- {
217
- return close();
218
- }
219
-
220
- /**
221
- * Clean up and close. Does not require all data to be actually read.
222
- */
223
- void close();
224
-
225
- iterator begin() const
226
- {
227
- if (reader_ == nullptr) [[unlikely]]
228
- {
229
- throw qdb::uninitialized_exception{
230
- "Reader not yet opened: please encapsulate calls to the reader in a `with` block, or "
231
- "explicitly `open` and `close` the resource"};
232
- }
233
- return iterator{handle_, reader_, batch_size_, table_names_.size()};
234
- }
235
-
236
- iterator end() const noexcept
237
- {
238
- return iterator{};
239
- }
240
-
241
- private:
242
- qdb::logger logger_;
243
- qdb::handle_ptr handle_;
244
- qdb_reader_handle_t reader_;
245
-
246
- std::vector<std::string> table_names_;
247
- std::vector<std::string> column_names_;
248
- std::size_t batch_size_;
249
- std::vector<py::tuple> ranges_;
250
- };
251
-
252
- using reader_ptr = std::unique_ptr<reader>;
253
-
254
- void register_reader(py::module_ & m);
255
-
256
- } // namespace qdb
quasardb/remove_cvref.hpp DELETED
@@ -1,31 +0,0 @@
1
- #pragma once
2
-
3
- #include <type_traits>
4
-
5
- namespace qdb
6
- {
7
-
8
- // TODO(C++20): Use std::remove_cvref after upgrading GCC to version 9+ (ARM builds use GCC 8.3).
9
- // #if (__cplusplus > 201703L) && defined(_LIBCPP_STD_VER) && (_LIBCPP_STD_VER > 17)
10
- // #define QDB_HAS_REMOVE_CVREF
11
- // #endif
12
-
13
- #ifdef QDB_HAS_REMOVE_CVREF
14
-
15
- using std::remove_cvref;
16
- using std::remove_cvref_t;
17
-
18
- #else
19
-
20
- template <class T>
21
- struct remove_cvref
22
- {
23
- typedef std::remove_cv_t<std::remove_reference_t<T>> type;
24
- };
25
-
26
- template <class T>
27
- using remove_cvref_t = typename remove_cvref<T>::type;
28
-
29
- #endif
30
-
31
- } // namespace qdb