quasardb 3.14.2.dev0__cp310-cp310-win_amd64.whl → 3.14.2.dev4__cp310-cp310-win_amd64.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 (96) hide show
  1. quasardb/INSTALL.vcxproj +9 -4
  2. quasardb/__init__.py +33 -4
  3. quasardb/cmake_install.cmake +6 -0
  4. quasardb/date/ALL_BUILD.vcxproj +9 -8
  5. quasardb/date/CMakeFiles/Export/df49adab93b9e0c10c64f72458b31971/dateTargets.cmake +13 -13
  6. quasardb/date/CMakeFiles/generate.stamp.depend +4 -4
  7. quasardb/date/INSTALL.vcxproj +9 -4
  8. quasardb/date/cmake_install.cmake +6 -0
  9. quasardb/date/dateConfigVersion.cmake +0 -5
  10. quasardb/date/dateTargets.cmake +4 -8
  11. quasardb/numpy/__init__.py +58 -10
  12. quasardb/pandas/__init__.py +58 -102
  13. quasardb/pybind11/ALL_BUILD.vcxproj +9 -8
  14. quasardb/pybind11/CMakeFiles/generate.stamp.depend +14 -14
  15. quasardb/pybind11/INSTALL.vcxproj +9 -4
  16. quasardb/pybind11/cmake_install.cmake +6 -0
  17. quasardb/qdb_api.dll +0 -0
  18. quasardb/quasardb.cp310-win_amd64.pyd +0 -0
  19. quasardb/range-v3/ALL_BUILD.vcxproj +9 -8
  20. quasardb/range-v3/CMakeFiles/Export/d94ef200eca10a819b5858b33e808f5b/range-v3-targets.cmake +13 -13
  21. quasardb/range-v3/CMakeFiles/generate.stamp.depend +11 -11
  22. quasardb/range-v3/INSTALL.vcxproj +9 -4
  23. quasardb/range-v3/cmake_install.cmake +42 -0
  24. quasardb/range-v3/range-v3-config-version.cmake +0 -5
  25. quasardb/range-v3/range-v3-config.cmake +4 -8
  26. quasardb/range-v3/range.v3.headers.vcxproj +9 -8
  27. {quasardb-3.14.2.dev0.dist-info → quasardb-3.14.2.dev4.dist-info}/METADATA +15 -10
  28. quasardb-3.14.2.dev4.dist-info/RECORD +54 -0
  29. {quasardb-3.14.2.dev0.dist-info → quasardb-3.14.2.dev4.dist-info}/WHEEL +1 -1
  30. quasardb/CMakeLists.txt +0 -500
  31. quasardb/batch_column.hpp +0 -80
  32. quasardb/batch_inserter.hpp +0 -248
  33. quasardb/blob.hpp +0 -150
  34. quasardb/cluster.cpp +0 -89
  35. quasardb/cluster.hpp +0 -551
  36. quasardb/concepts.hpp +0 -278
  37. quasardb/continuous.cpp +0 -149
  38. quasardb/continuous.hpp +0 -106
  39. quasardb/convert/array.hpp +0 -282
  40. quasardb/convert/point.hpp +0 -330
  41. quasardb/convert/range.hpp +0 -282
  42. quasardb/convert/unicode.hpp +0 -598
  43. quasardb/convert/util.hpp +0 -22
  44. quasardb/convert/value.hpp +0 -711
  45. quasardb/convert.hpp +0 -38
  46. quasardb/detail/qdb_resource.hpp +0 -129
  47. quasardb/detail/ts_column.hpp +0 -224
  48. quasardb/direct_blob.hpp +0 -108
  49. quasardb/direct_handle.hpp +0 -83
  50. quasardb/direct_integer.hpp +0 -94
  51. quasardb/dispatch.hpp +0 -157
  52. quasardb/double.hpp +0 -87
  53. quasardb/entry.hpp +0 -273
  54. quasardb/error.hpp +0 -318
  55. quasardb/handle.cpp +0 -29
  56. quasardb/handle.hpp +0 -98
  57. quasardb/integer.hpp +0 -88
  58. quasardb/logger.cpp +0 -106
  59. quasardb/logger.hpp +0 -228
  60. quasardb/masked_array.hpp +0 -651
  61. quasardb/metrics.cpp +0 -103
  62. quasardb/metrics.hpp +0 -112
  63. quasardb/module.cpp +0 -76
  64. quasardb/module.hpp +0 -24
  65. quasardb/node.hpp +0 -123
  66. quasardb/numpy.cpp +0 -6
  67. quasardb/numpy.hpp +0 -489
  68. quasardb/object_tracker.hpp +0 -283
  69. quasardb/options.hpp +0 -244
  70. quasardb/perf.hpp +0 -336
  71. quasardb/pytypes.hpp +0 -221
  72. quasardb/query.cpp +0 -420
  73. quasardb/query.hpp +0 -92
  74. quasardb/reader/ts_row.hpp +0 -281
  75. quasardb/reader/ts_value.hpp +0 -245
  76. quasardb/remove_cvref.hpp +0 -31
  77. quasardb/string.hpp +0 -160
  78. quasardb/table.cpp +0 -289
  79. quasardb/table.hpp +0 -325
  80. quasardb/table_reader.hpp +0 -220
  81. quasardb/tag.hpp +0 -77
  82. quasardb/timestamp.hpp +0 -97
  83. quasardb/traits.hpp +0 -619
  84. quasardb/ts_iterator.hpp +0 -193
  85. quasardb/utils/blob_deque.hpp +0 -96
  86. quasardb/utils/ostream.hpp +0 -17
  87. quasardb/utils/permutation.hpp +0 -50
  88. quasardb/utils/stable_sort.hpp +0 -25
  89. quasardb/utils/unzip_view.hpp +0 -89
  90. quasardb/utils.cpp +0 -28
  91. quasardb/utils.hpp +0 -174
  92. quasardb/writer.cpp +0 -534
  93. quasardb/writer.hpp +0 -396
  94. quasardb-3.14.2.dev0.dist-info/RECORD +0 -118
  95. {quasardb-3.14.2.dev0.dist-info → quasardb-3.14.2.dev4.dist-info}/LICENSE.md +0 -0
  96. {quasardb-3.14.2.dev0.dist-info → quasardb-3.14.2.dev4.dist-info}/top_level.txt +0 -0
quasardb/timestamp.hpp DELETED
@@ -1,97 +0,0 @@
1
- /*
2
- *
3
- * Official Python API
4
- *
5
- * Copyright (c) 2009-2024, 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 "entry.hpp"
34
- #include "pytypes.hpp"
35
- #include <qdb/timestamp.h>
36
- #include "convert/value.hpp"
37
- #include <chrono>
38
-
39
- namespace qdb
40
- {
41
-
42
- class timestamp_entry : public expirable_entry
43
- {
44
- using clock_t = std::chrono::system_clock;
45
-
46
- public:
47
- timestamp_entry(handle_ptr h, std::string a) noexcept
48
- : expirable_entry{h, a}
49
- {}
50
-
51
- public:
52
- qdb::pydatetime get()
53
- {
54
- qdb_timespec_t result;
55
- qdb::qdb_throw_if_error(*_handle, qdb_timestamp_get(*_handle, _alias.c_str(), &result));
56
- return qdb::convert::value<qdb_timespec_t, qdb::pydatetime>(result);
57
- }
58
-
59
- void put(qdb::pydatetime val)
60
- {
61
- qdb_timespec_t val_ = qdb::convert::value<qdb::pydatetime, qdb_timespec_t>(val);
62
- qdb::qdb_throw_if_error(
63
- *_handle, qdb_timestamp_put(*_handle, _alias.c_str(), &val_, qdb_time_t{0}));
64
- }
65
-
66
- void update(qdb::pydatetime val)
67
- {
68
- qdb_timespec_t val_ = qdb::convert::value<qdb::pydatetime, qdb_timespec_t>(val);
69
- qdb::qdb_throw_if_error(
70
- *_handle, qdb_timestamp_update(*_handle, _alias.c_str(), &val_, qdb_time_t{0}));
71
- }
72
-
73
- qdb::pydatetime add(qdb::pydatetime val)
74
- {
75
- qdb_timespec_t val_ = qdb::convert::value<qdb::pydatetime, qdb_timespec_t>(val);
76
- qdb_timespec_t result;
77
- qdb::qdb_throw_if_error(*_handle, qdb_timestamp_add(*_handle, _alias.c_str(), &val_, &result));
78
-
79
- return qdb::convert::value<qdb_timespec_t, qdb::pydatetime>(result);
80
- }
81
- };
82
-
83
- template <typename Module>
84
- static inline void register_timestamp(Module & m)
85
- {
86
- namespace py = pybind11;
87
-
88
- py::class_<qdb::timestamp_entry, qdb::expirable_entry>(m, "Timestamp") //
89
- .def(py::init<qdb::handle_ptr, std::string>()) //
90
- .def("get", &qdb::timestamp_entry::get) //
91
- .def("put", &qdb::timestamp_entry::put, py::arg("timestamp")) //
92
- .def("update", &qdb::timestamp_entry::update, py::arg("timestamp")) //
93
- .def("add", &qdb::timestamp_entry::add, py::arg("addend")) //
94
- ; //
95
- }
96
-
97
- } // namespace qdb
quasardb/traits.hpp DELETED
@@ -1,619 +0,0 @@
1
-
2
- #pragma once
3
-
4
- #include <qdb/client.h>
5
- #include <qdb/ts.h>
6
- #include <pybind11/numpy.h>
7
- #include <cassert>
8
- #include <cmath>
9
-
10
- namespace qdb::traits
11
- {
12
-
13
- namespace py = pybind11;
14
-
15
- ////////////////////////////////////////////////////////////////////////////////
16
- //
17
- // BASE CLASSES
18
- //
19
- // The classes below define the "base classes" for all traits defined below.
20
- // Typically only necessary to modify these if you want to add a completely new
21
- // trait type, or change some defaults.
22
- //
23
- ///////////////////
24
-
25
- template <qdb_ts_column_type_t ColumnType>
26
- struct qdb_column;
27
-
28
- template <qdb_ts_column_type_t ColumnType>
29
- struct qdb_column_base
30
- {
31
- static constexpr qdb_ts_column_type_t column_type = ColumnType;
32
- };
33
-
34
- template <typename ValueType>
35
- struct qdb_value;
36
-
37
- template <typename ValueType>
38
- struct qdb_value_base
39
- {
40
- using value_type = ValueType;
41
-
42
- static constexpr bool is_qdb_primitive = false;
43
- static constexpr bool is_qdb_point = false;
44
- };
45
-
46
- ////////////////////////////////////////////////////////////////////////////////
47
- //
48
- // TRAIT DECLARATION MACROS
49
- //
50
- // Convenience macros that make it more concise to declare a new trait, and
51
- // avoid any errors.
52
- //
53
- ///////////////////
54
-
55
- #define VALUE_TRAIT_DECL(VT) \
56
- template <> \
57
- struct qdb_value<VT> : public qdb_value_base<VT>
58
-
59
- #define COLUMN_TRAIT_DECL(CT, VT) \
60
- template <> \
61
- struct qdb_column<CT> : public qdb_column_base<CT> \
62
- { \
63
- using value_type = VT; \
64
- };
65
-
66
- #define DTYPE_TRAIT_DECL(DT) \
67
- template <> \
68
- struct npy_dtype<DT> : public npy_dtype_base<DT>
69
-
70
- #define DTYPE_TRAIT_HEADER(DT, VALUE_TYPE) \
71
- using value_type = VALUE_TYPE; \
72
- \
73
- static inline bool is_dtype(py::dtype dt) noexcept \
74
- { \
75
- return DT::is_dtype(dt); \
76
- }
77
-
78
- #define DTYPE_DELEGATE_HEADER(DT1, VALUE_TYPE, DT2) \
79
- DTYPE_TRAIT_HEADER(DT1, VALUE_TYPE); \
80
- using delegate_type = DT2;
81
-
82
- ////////////////////////////////////////////////////////////////////////////////
83
- //
84
- // COLUMN TRAITS
85
- //
86
- ///////////////////
87
-
88
- COLUMN_TRAIT_DECL(qdb_ts_column_int64, qdb_int_t);
89
- COLUMN_TRAIT_DECL(qdb_ts_column_double, double);
90
- COLUMN_TRAIT_DECL(qdb_ts_column_timestamp, qdb_timespec_t);
91
- COLUMN_TRAIT_DECL(qdb_ts_column_blob, qdb_blob_t);
92
- COLUMN_TRAIT_DECL(qdb_ts_column_string, qdb_string_t);
93
- COLUMN_TRAIT_DECL(qdb_ts_column_symbol, qdb_string_t);
94
-
95
- #undef COLUMN_TRAIT_DECL
96
-
97
- ////////////////////////////////////////////////////////////////////////////////
98
- //
99
- // VALUE TRAITS
100
- //
101
- ///////////////////
102
-
103
- VALUE_TRAIT_DECL(qdb_int_t)
104
- {
105
- using point_type = qdb_ts_int64_point;
106
-
107
- static constexpr bool is_qdb_primitive = true;
108
-
109
- static constexpr qdb_int_t null_value() noexcept
110
- {
111
- return static_cast<qdb_int_t>(0x8000000000000000ll);
112
- }
113
-
114
- static constexpr bool is_null(qdb_int_t x) noexcept
115
- {
116
- return x == null_value();
117
- }
118
- };
119
-
120
- VALUE_TRAIT_DECL(double)
121
- {
122
- using point_type = qdb_ts_double_point;
123
-
124
- static constexpr bool is_qdb_primitive = true;
125
-
126
- static constexpr double null_value() noexcept
127
- {
128
- return NAN;
129
- }
130
-
131
- static bool is_null(double x) noexcept
132
- {
133
- // std::isnan is not a constexpr on windows
134
- return std::isnan(x);
135
- }
136
- };
137
-
138
- VALUE_TRAIT_DECL(qdb_timespec_t)
139
- {
140
- using point_type = qdb_ts_timestamp_point;
141
-
142
- static constexpr bool is_qdb_primitive = true;
143
-
144
- static constexpr qdb_timespec_t null_value() noexcept
145
- {
146
- return qdb_timespec_t{qdb_min_time, qdb_min_time};
147
- }
148
-
149
- static constexpr bool is_null(qdb_timespec_t x) noexcept
150
- {
151
- return x.tv_sec == qdb_min_time && x.tv_nsec == qdb_min_time;
152
- }
153
-
154
- static constexpr qdb_timespec_t min() noexcept
155
- {
156
- return qdb_timespec_t{0, 0};
157
- }
158
-
159
- static constexpr qdb_timespec_t max() noexcept
160
- {
161
- return qdb_timespec_t{std::numeric_limits<qdb_time_t>::max(), 0};
162
- }
163
- };
164
-
165
- VALUE_TRAIT_DECL(qdb_ts_range_t)
166
- {
167
- static constexpr bool is_qdb_primitive = true;
168
-
169
- static constexpr qdb_ts_range_t null_value() noexcept
170
- {
171
- return qdb_ts_range_t{
172
- qdb_value<qdb_timespec_t>::null_value(), qdb_value<qdb_timespec_t>::null_value()};
173
- }
174
-
175
- static constexpr qdb_ts_range_t forever() noexcept
176
- {
177
- return qdb_ts_range_t{qdb_timespec_t{0, 0},
178
-
179
- // Don't hate the player, hate the game of poorly defined constants
180
- qdb_timespec_t{9223372036, 854775807}};
181
- }
182
-
183
- static constexpr bool is_null(qdb_timespec_t x) noexcept
184
- {
185
- return x.tv_sec == qdb_min_time && x.tv_nsec == qdb_min_time;
186
- }
187
- };
188
-
189
- VALUE_TRAIT_DECL(qdb_string_t)
190
- {
191
- using point_type = qdb_ts_string_point;
192
- static constexpr bool is_qdb_primitive = true;
193
-
194
- static constexpr qdb_string_t null_value() noexcept
195
- {
196
- return qdb_string_t{nullptr, 0};
197
- }
198
-
199
- static constexpr bool is_null(qdb_string_t x) noexcept
200
- {
201
- return x.length == 0;
202
- }
203
- };
204
-
205
- VALUE_TRAIT_DECL(qdb_blob_t)
206
- {
207
- using point_type = qdb_ts_blob_point;
208
- static constexpr bool is_qdb_primitive = true;
209
-
210
- static constexpr qdb_blob_t null_value() noexcept
211
- {
212
- return qdb_blob_t{nullptr, 0};
213
- }
214
-
215
- static constexpr bool is_null(qdb_blob_t x) noexcept
216
- {
217
- return x.content_length == 0;
218
- }
219
- };
220
-
221
- VALUE_TRAIT_DECL(qdb_ts_double_point)
222
- {
223
- using primitive_type = double;
224
- static constexpr bool is_qdb_point = true;
225
- };
226
-
227
- VALUE_TRAIT_DECL(qdb_ts_int64_point)
228
- {
229
- using primitive_type = qdb_int_t;
230
- static constexpr bool is_qdb_point = true;
231
- };
232
-
233
- VALUE_TRAIT_DECL(qdb_ts_timestamp_point)
234
- {
235
- using primitive_type = qdb_timespec_t;
236
- static constexpr bool is_qdb_point = true;
237
- };
238
-
239
- VALUE_TRAIT_DECL(qdb_ts_blob_point)
240
- {
241
- using primitive_type = qdb_blob_t;
242
- static constexpr bool is_qdb_point = true;
243
- };
244
-
245
- VALUE_TRAIT_DECL(qdb_ts_string_point)
246
- {
247
- using primitive_type = qdb_string_t;
248
- static constexpr bool is_qdb_point = true;
249
- };
250
-
251
- #undef VALUE_TRAIT_DECL
252
-
253
- ////////////////////////////////////////////////////////////////////////////////
254
- //
255
- // DTYPE DEFINITIONS
256
- //
257
- // Not strictly a "trait" but rather a constant, but we use these to define traits.
258
- // Effectively we declare our dtypes as template-dispatch tags.
259
- //
260
- // You will want to add new kinds / dtypes here, e.g. if we start supporting unsigned
261
- // integers or whatever.
262
- //
263
- ///////////////////
264
-
265
- /**
266
- * One of the things we want to be able to dispatch on is the "kind", e.g.
267
- * "dispatch based on any integer-type".
268
- *
269
- * Redefine these character codes to enums
270
- */
271
- enum dtype_kind
272
- {
273
- int_kind = 'i',
274
- float_kind = 'f',
275
- datetime_kind = 'M',
276
- object_kind = 'O',
277
- unicode_kind = 'U',
278
- bytestring_kind = 'S'
279
- };
280
-
281
- /**
282
- * Dtype tag dispatch base struct, only has a "kind", but never directly constructed.
283
- */
284
- template <dtype_kind Kind>
285
- struct dtype
286
- {
287
- static constexpr dtype_kind kind = Kind;
288
-
289
- static inline bool is_dtype(py::dtype dt) noexcept
290
- {
291
- return dt.kind() == Kind;
292
- };
293
- };
294
-
295
- /**
296
- * Dtypes with a fixed width, which is most "simple" ones, including py::object.
297
- */
298
- template <dtype_kind Kind, py::ssize_t Size>
299
- struct fixed_width_dtype : public dtype<Kind>
300
- {
301
- static constexpr py::ssize_t size = Size;
302
-
303
- static inline bool is_dtype(py::dtype dt) noexcept
304
- {
305
- return dt.kind() == Kind && dt.itemsize() == Size;
306
- }
307
-
308
- // By definition, fixed width dtypes always have a stride size of 1 (i.e.
309
- // they move forward sizeof(value_type) bytes per item.
310
- static constexpr py::ssize_t stride_size(py::ssize_t /* itemsize */) noexcept
311
- {
312
- return 1;
313
- };
314
- };
315
-
316
- /**
317
- * Variable width dtypes require special parsing. Numpy variable width encoding
318
- * encodes the entire array as a single, continuous block of memory, with items
319
- * of length `CodePointSize`. This length is always the same for a single instance
320
- * of an array, but differs for different instances.
321
- *
322
- * Before encoding the array, Numpy determines the length of the longest item
323
- * in the array, and uses that as the stride size.
324
- *
325
- * There are two variable width dtypes we deal with:
326
- *
327
- * - unicode, that is represented using UTF-32, meaning the size of each
328
- * code point is 4 bytes.
329
- * - bytestrings, that are represented using "just" bytes, but are null
330
- * terminated (!!). Numpy has deprecated it, in favor of just byte[] objects,
331
- * but Pandas sometimes generates this type of data.
332
- *
333
- * Since it is very efficient way to encode blob data, we support it.
334
- *
335
- * StrideType is the type used to represent a single code point.
336
- *
337
- * CodePointSize defines the size (in bytes) of each code point, e.g. for
338
- * UTF-32 / UCS-4 this would be 4, as each character is represented using 4 bytes.
339
- */
340
- template <dtype_kind Kind, typename StrideType, py::ssize_t CodePointSize>
341
- requires(CodePointSize == sizeof(typename StrideType::value_type))
342
- struct variable_width_dtype : public dtype<Kind>
343
- {
344
- using dtype<Kind>::is_dtype;
345
- using stride_type = StrideType;
346
-
347
- static constexpr py::ssize_t code_point_size = CodePointSize;
348
-
349
- /**
350
- * Given the number of bytes of a single item, calculate the number of characters
351
- * (code points) in a single stride.
352
- *
353
- * By definition, n == stride_size(itemsize(n))
354
- */
355
- static constexpr py::ssize_t stride_size(py::ssize_t itemsize) noexcept
356
- {
357
- assert(itemsize % code_point_size == 0);
358
- return itemsize / code_point_size;
359
- };
360
-
361
- /**
362
- * Based on the number of codepoints, calculates the numpy `itemsize()` value
363
- * for this stride type (i.e. the number of bytes in a single item).
364
- *
365
- * By definition, n == itemsize(stride_size(n))
366
- */
367
- static constexpr py::ssize_t itemsize(py::ssize_t codepoints) noexcept
368
- {
369
- return codepoints * code_point_size;
370
- };
371
- };
372
-
373
- // Py_intptr_t is best described as a pointer-that-can-be-cast-to-integer and
374
- // back.
375
- //
376
- // As such, it's a good proxy for the size of a py::object as it is represented
377
- // in a np.ndarray.
378
- static constexpr py::ssize_t pyobject_size = sizeof(Py_intptr_t);
379
-
380
- template <typename ObjectType>
381
- struct object_dtype : public fixed_width_dtype<object_kind, pyobject_size>
382
- {
383
- using fixed_width_dtype<object_kind, pyobject_size>::is_dtype;
384
- using value_type = ObjectType;
385
-
386
- static inline bool is_null(py::object x) noexcept
387
- {
388
- return x.is_none();
389
- };
390
- };
391
-
392
- /**
393
- * We may want to dispatch datetime64 based on the precision (ns, ms, etc), which
394
- * is what we will allow for here.
395
- */
396
- enum datetime64_precision
397
- {
398
- datetime64_ns
399
- };
400
-
401
- template <datetime64_precision Precision>
402
- struct datetime64_dtype : public fixed_width_dtype<datetime_kind, 8>
403
- {
404
- static constexpr datetime64_precision precision = Precision;
405
- };
406
-
407
- struct int64_dtype : public fixed_width_dtype<int_kind, 8>
408
- {
409
- using value_type = std::int64_t;
410
- using qdb_value = qdb_int_t;
411
-
412
- static constexpr std::int64_t null_value() noexcept
413
- {
414
- return static_cast<std::int64_t>(0x8000000000000000ll);
415
- };
416
-
417
- static constexpr inline bool is_null(value_type x) noexcept
418
- {
419
- return x == null_value();
420
- };
421
-
422
- static inline py::dtype dtype() noexcept
423
- {
424
- return py::dtype("int64");
425
- }
426
- };
427
-
428
- struct int32_dtype : public fixed_width_dtype<int_kind, 4>
429
- {
430
- using value_type = std::int32_t;
431
- using delegate_type = int64_dtype;
432
-
433
- static constexpr value_type null_value() noexcept
434
- {
435
- return std::numeric_limits<value_type>::min();
436
- };
437
-
438
- static constexpr inline bool is_null(value_type x) noexcept
439
- {
440
- return x == null_value();
441
- };
442
-
443
- static inline py::dtype dtype() noexcept
444
- {
445
- return py::dtype("int32");
446
- }
447
- };
448
-
449
- struct int16_dtype : public fixed_width_dtype<int_kind, 2>
450
- {
451
- using value_type = std::int16_t;
452
- using delegate_type = int64_dtype;
453
-
454
- static constexpr value_type null_value() noexcept
455
- {
456
- return std::numeric_limits<value_type>::min();
457
- };
458
-
459
- static constexpr inline bool is_null(value_type x) noexcept
460
- {
461
- return x == null_value();
462
- };
463
-
464
- static inline py::dtype dtype() noexcept
465
- {
466
- return py::dtype("int16");
467
- }
468
- };
469
-
470
- struct float64_dtype : public fixed_width_dtype<float_kind, 8>
471
- {
472
- using value_type = double;
473
- using qdb_value = double;
474
-
475
- static constexpr value_type null_value() noexcept
476
- {
477
- return NAN;
478
- };
479
-
480
- static inline bool is_null(value_type x) noexcept
481
- {
482
- return std::isnan(x);
483
- };
484
-
485
- static inline py::dtype dtype() noexcept
486
- {
487
- return py::dtype("float64");
488
- }
489
- };
490
-
491
- struct float32_dtype : public fixed_width_dtype<float_kind, 4>
492
- {
493
- using value_type = float;
494
- using delegate_type = float64_dtype;
495
-
496
- static constexpr value_type null_value() noexcept
497
- {
498
- return NAN;
499
- };
500
-
501
- static inline py::dtype dtype() noexcept
502
- {
503
- return py::dtype("float32");
504
- };
505
-
506
- static inline bool is_null(value_type x) noexcept
507
- {
508
- return std::isnan(x);
509
- };
510
- };
511
-
512
- struct unicode_dtype : public variable_width_dtype<unicode_kind, std::u32string, 4>
513
- {
514
- using value_type = std::u32string::value_type;
515
-
516
- static constexpr value_type null_value() noexcept
517
- {
518
- return '\0';
519
- };
520
- static constexpr inline bool is_null(value_type x) noexcept
521
- {
522
- return x == null_value();
523
- };
524
-
525
- static inline py::dtype dtype() noexcept
526
- {
527
- return py::dtype("U");
528
- }
529
-
530
- static inline py::dtype dtype(py::ssize_t codepoints_per_word) noexcept
531
- {
532
- return py::dtype(std::string{"U"} + std::to_string(codepoints_per_word));
533
- }
534
- };
535
-
536
- struct bytestring_dtype : public variable_width_dtype<bytestring_kind, std::string, 1>
537
- {
538
- using value_type = std::string::value_type;
539
-
540
- static constexpr value_type null_value() noexcept
541
- {
542
- return '\0';
543
- };
544
-
545
- static constexpr inline bool is_null(value_type x) noexcept
546
- {
547
- return x == null_value();
548
- };
549
-
550
- static inline py::dtype dtype() noexcept
551
- {
552
- return py::dtype("S");
553
- }
554
- };
555
-
556
- struct pyobject_dtype : public object_dtype<py::object>
557
- {
558
- using value_type = py::object;
559
-
560
- static inline py::object null_value() noexcept
561
- {
562
- return py::none{};
563
- };
564
-
565
- static inline py::dtype dtype() noexcept
566
- {
567
- return py::dtype("O");
568
- }
569
- };
570
-
571
- struct datetime64_ns_dtype : public datetime64_dtype<datetime64_ns>
572
- {
573
- static_assert(sizeof(int64_t) == sizeof(qdb_time_t));
574
- using value_type = std::int64_t;
575
-
576
- static constexpr std::int64_t null_value() noexcept
577
- {
578
- return static_cast<std::int64_t>(qdb_min_time);
579
- }
580
-
581
- static constexpr inline bool is_null(value_type x) noexcept
582
- {
583
- return x == null_value();
584
- };
585
-
586
- static inline py::dtype dtype() noexcept
587
- {
588
- return py::dtype("datetime64[ns]");
589
- }
590
- };
591
-
592
- // Easy accessors for some commonly requested functions
593
- template <typename T>
594
- inline bool is_null(T x) noexcept
595
- {
596
- return qdb_value<T>::is_null(x);
597
- };
598
-
599
- template <typename T>
600
- inline T null_value() noexcept
601
- {
602
- return qdb_value<T>::null_value();
603
- };
604
-
605
- // Easy accessors for some commonly requested functions
606
- template <typename T>
607
- inline bool is_null(typename T::value_type x) noexcept
608
- {
609
- return T::is_null(x);
610
- };
611
-
612
- // Easy accessors for some commonly requested functions
613
- template <typename T>
614
- inline typename T::value_type null_value() noexcept
615
- {
616
- return T::null_value();
617
- };
618
-
619
- }; // namespace qdb::traits