quasardb 3.13.6__cp37-cp37m-macosx_10_14_x86_64.whl → 3.13.7__cp37-cp37m-macosx_10_14_x86_64.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.
- quasardb/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
- quasardb/CMakeLists.txt +43 -22
- quasardb/Makefile +1 -4
- quasardb/__init__.py +1 -1
- quasardb/add_boost_test.cmake +43 -0
- quasardb/batch_column.hpp +1 -1
- quasardb/batch_inserter.hpp +1 -1
- quasardb/blob.hpp +1 -1
- quasardb/cluster.hpp +42 -17
- quasardb/cmake_install.cmake +1 -1
- quasardb/concepts.hpp +30 -16
- quasardb/continuous.hpp +1 -1
- quasardb/convert/array.hpp +61 -7
- quasardb/convert/point.hpp +16 -11
- quasardb/convert/range.hpp +19 -25
- quasardb/convert/unicode.hpp +457 -149
- quasardb/convert/value.hpp +87 -18
- quasardb/convert.hpp +1 -1
- quasardb/date/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
- quasardb/date/CMakeFiles/Export/{lib/cmake/date → a52b05f964b070ee926bcad51d3288af}/dateTargets.cmake +42 -34
- quasardb/date/Makefile +1 -4
- quasardb/date/cmake_install.cmake +16 -12
- quasardb/date/dateTargets.cmake +28 -23
- quasardb/detail/qdb_resource.hpp +6 -6
- quasardb/detail/ts_column.hpp +1 -1
- quasardb/direct_blob.hpp +1 -1
- quasardb/direct_handle.hpp +1 -1
- quasardb/direct_integer.hpp +1 -1
- quasardb/{version.cpp → double.hpp} +46 -28
- quasardb/entry.hpp +1 -1
- quasardb/error.hpp +14 -10
- quasardb/handle.hpp +1 -1
- quasardb/integer.hpp +1 -1
- quasardb/libqdb_api.dylib +0 -0
- quasardb/logger.hpp +1 -1
- quasardb/masked_array.hpp +1 -1
- quasardb/module.cpp +73 -0
- quasardb/module.hpp +24 -0
- quasardb/node.hpp +16 -11
- quasardb/numpy/__init__.py +76 -7
- quasardb/numpy.hpp +1 -1
- quasardb/options.hpp +31 -9
- quasardb/pandas/__init__.py +1 -1
- quasardb/perf.hpp +6 -6
- quasardb/pinned_writer.hpp +1 -5
- quasardb/pybind11/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
- quasardb/pybind11/Makefile +1 -4
- quasardb/pybind11/cmake_install.cmake +1 -1
- quasardb/pytypes.hpp +2 -2
- quasardb/quasardb.cpython-37m-darwin.so +0 -0
- quasardb/query.cpp +3 -3
- quasardb/query.hpp +1 -1
- quasardb/range-v3/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
- quasardb/range-v3/CMakeFiles/Export/{lib/cmake/range-v3 → d94ef200eca10a819b5858b33e808f5b}/range-v3-targets.cmake +42 -34
- quasardb/range-v3/CMakeFiles/range.v3.headers.dir/build.make +1 -4
- quasardb/range-v3/Makefile +1 -4
- quasardb/range-v3/cmake_install.cmake +16 -12
- quasardb/range-v3/range-v3-config.cmake +28 -23
- quasardb/reader/ts_row.hpp +1 -1
- quasardb/reader/ts_value.hpp +1 -1
- quasardb/string.hpp +160 -0
- quasardb/table.hpp +1 -1
- quasardb/table_reader.hpp +1 -1
- quasardb/tag.hpp +1 -1
- quasardb/timestamp.hpp +97 -0
- quasardb/utils.hpp +1 -1
- {quasardb-3.13.6.dist-info → quasardb-3.13.7.dist-info}/LICENSE.md +1 -1
- {quasardb-3.13.6.dist-info → quasardb-3.13.7.dist-info}/METADATA +1 -1
- quasardb-3.13.7.dist-info/RECORD +105 -0
- {quasardb-3.13.6.dist-info → quasardb-3.13.7.dist-info}/WHEEL +1 -1
- quasardb/qdb_client.cpp +0 -67
- quasardb/version.hpp +0 -43
- quasardb-3.13.6.dist-info/RECORD +0 -102
- {quasardb-3.13.6.dist-info → quasardb-3.13.7.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# CMAKE generated file: DO NOT EDIT!
|
|
2
|
-
# Generated by "Unix Makefiles" Generator, CMake Version 3.
|
|
2
|
+
# Generated by "Unix Makefiles" Generator, CMake Version 3.24
|
|
3
3
|
|
|
4
4
|
# Relative path conversion top directories.
|
|
5
5
|
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/Users/teamcity/buildAgent/work/283bde3fda0d76e7/thirdparty")
|
quasardb/CMakeLists.txt
CHANGED
|
@@ -3,11 +3,12 @@ project(quasardb)
|
|
|
3
3
|
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
|
4
4
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
|
5
5
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
|
|
6
|
-
set(CMAKE_VERBOSE_MAKEFILE
|
|
6
|
+
set(CMAKE_VERBOSE_MAKEFILE FALSE)
|
|
7
7
|
|
|
8
8
|
include(CheckIPOSupported)
|
|
9
9
|
|
|
10
10
|
option(QDB_LINK_STATIC_LIB "Link qdb_api_static instead of dynamic qdb_api." OFF)
|
|
11
|
+
option(QDB_TESTS_ENABLED "Build quasardb test suite?" OFF)
|
|
11
12
|
|
|
12
13
|
set(PACKAGE_NAME quasardb)
|
|
13
14
|
|
|
@@ -33,11 +34,7 @@ endif()
|
|
|
33
34
|
#
|
|
34
35
|
###
|
|
35
36
|
|
|
36
|
-
|
|
37
37
|
set(QDB_API_NAME qdb_api)
|
|
38
|
-
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
|
39
|
-
set(QDB_API_NAME qdb_apid)
|
|
40
|
-
endif()
|
|
41
38
|
|
|
42
39
|
message(STATUS "[qdb-api-python] Using qdb api name ${QDB_API_NAME}")
|
|
43
40
|
|
|
@@ -151,6 +148,7 @@ if(CLANG OR GNU)
|
|
|
151
148
|
add_compile_options(
|
|
152
149
|
-Wno-register
|
|
153
150
|
-Wall
|
|
151
|
+
-fconcepts-diagnostics-depth=3
|
|
154
152
|
|
|
155
153
|
$<$<CONFIG:Debug>:-Og>
|
|
156
154
|
$<$<CONFIG:Release>:-O3>
|
|
@@ -265,13 +263,15 @@ endif()
|
|
|
265
263
|
###
|
|
266
264
|
|
|
267
265
|
message(STATUS "[qdb-api-python] Including thirdparty libraries with binary directory ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
|
|
268
|
-
add_subdirectory(../thirdparty/ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
|
269
|
-
|
|
270
266
|
include_directories(SYSTEM ../thirdparty/date/include)
|
|
271
267
|
include_directories(SYSTEM ../thirdparty/range-v3/include)
|
|
272
268
|
|
|
269
|
+
add_subdirectory(../thirdparty/ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
|
270
|
+
|
|
273
271
|
include_directories(SYSTEM qdb/include)
|
|
274
272
|
include_directories(${CMAKE_SOURCE_DIR})
|
|
273
|
+
include_directories(../quasardb/)
|
|
274
|
+
|
|
275
275
|
|
|
276
276
|
#
|
|
277
277
|
# step 2: copy the libraries
|
|
@@ -321,43 +321,43 @@ if(NOT QDB_LINK_STATIC_LIB)
|
|
|
321
321
|
endif()
|
|
322
322
|
endif()
|
|
323
323
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
set(QDB_FILES
|
|
325
|
+
batch_inserter.hpp
|
|
326
|
+
blob.hpp
|
|
328
327
|
cluster.hpp
|
|
328
|
+
concepts.hpp
|
|
329
329
|
continuous.cpp
|
|
330
330
|
continuous.hpp
|
|
331
|
+
convert.hpp
|
|
332
|
+
double.hpp
|
|
331
333
|
error.hpp
|
|
332
334
|
entry.hpp
|
|
333
|
-
blob.hpp
|
|
334
335
|
handle.hpp
|
|
336
|
+
logger.hpp
|
|
337
|
+
logger.cpp
|
|
335
338
|
masked_array.hpp
|
|
339
|
+
module.hpp
|
|
340
|
+
module.cpp
|
|
341
|
+
node.hpp
|
|
336
342
|
numpy.hpp
|
|
337
343
|
numpy.cpp
|
|
338
344
|
object_tracker.hpp
|
|
339
345
|
options.hpp
|
|
340
346
|
pinned_writer.cpp
|
|
341
347
|
pinned_writer.hpp
|
|
342
|
-
qdb_client.cpp
|
|
343
348
|
query.hpp
|
|
344
349
|
query.cpp
|
|
350
|
+
string.hpp
|
|
345
351
|
table.cpp
|
|
346
352
|
table.hpp
|
|
347
353
|
table_reader.hpp
|
|
348
|
-
batch_inserter.hpp
|
|
349
|
-
convert.hpp
|
|
350
|
-
traits.hpp
|
|
351
|
-
concepts.hpp
|
|
352
354
|
tag.hpp
|
|
355
|
+
timestamp.hpp
|
|
356
|
+
traits.hpp
|
|
353
357
|
utils.cpp
|
|
354
358
|
utils.hpp
|
|
355
|
-
version.hpp
|
|
356
|
-
version.cpp
|
|
357
|
-
logger.hpp
|
|
358
|
-
logger.cpp
|
|
359
|
-
detail/ts_column.hpp
|
|
360
359
|
detail/qdb_resource.hpp
|
|
360
|
+
detail/ts_column.hpp
|
|
361
361
|
reader/ts_row.hpp
|
|
362
362
|
reader/ts_value.hpp
|
|
363
363
|
utils/blob_deque.hpp
|
|
@@ -366,6 +366,27 @@ pybind11_add_module(
|
|
|
366
366
|
utils/stable_sort.hpp
|
|
367
367
|
)
|
|
368
368
|
|
|
369
|
+
set(QDB_TEST_FILES "")
|
|
370
|
+
|
|
371
|
+
if(QDB_TESTS_ENABLED)
|
|
372
|
+
message(WARNING "\
|
|
373
|
+
------------------------------------------------------------------ \
|
|
374
|
+
[qdb-api-python] Tests enabled -- do not enable for release builds \
|
|
375
|
+
------------------------------------------------------------------ \ ")
|
|
376
|
+
set(QDB_TEST_FILES
|
|
377
|
+
|
|
378
|
+
../tests/conftest.cpp
|
|
379
|
+
../tests/conftest.hpp
|
|
380
|
+
../tests/test_convert.cpp)
|
|
381
|
+
endif()
|
|
382
|
+
|
|
383
|
+
# step 3: build
|
|
384
|
+
pybind11_add_module(
|
|
385
|
+
quasardb
|
|
386
|
+
|
|
387
|
+
${QDB_FILES}
|
|
388
|
+
${QDB_TEST_FILES})
|
|
389
|
+
|
|
369
390
|
target_compile_definitions(quasardb PUBLIC QDB_PY_VERSION="${QDB_PY_VERSION}")
|
|
370
391
|
if(QDB_LINK_STATIC_LIB)
|
|
371
392
|
add_definitions(-DQDB_API_STATIC_LINK=1)
|
quasardb/Makefile
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# CMAKE generated file: DO NOT EDIT!
|
|
2
|
-
# Generated by "Unix Makefiles" Generator, CMake Version 3.
|
|
2
|
+
# Generated by "Unix Makefiles" Generator, CMake Version 3.24
|
|
3
3
|
|
|
4
4
|
# Default target executed when no arguments are given to make.
|
|
5
5
|
default_target: all
|
|
@@ -31,9 +31,6 @@ default_target: all
|
|
|
31
31
|
|
|
32
32
|
.SUFFIXES: .hpux_make_needs_suffix_list
|
|
33
33
|
|
|
34
|
-
# Produce verbose output by default.
|
|
35
|
-
VERBOSE = 1
|
|
36
|
-
|
|
37
34
|
# Command-line flag to silence nested $(MAKE).
|
|
38
35
|
$(VERBOSE)MAKESILENT = -s
|
|
39
36
|
|
quasardb/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pylint: disable=C0103,C0111,C0302,R0903
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2009-
|
|
3
|
+
# Copyright (c) 2009-2023, quasardb SAS. All rights reserved.
|
|
4
4
|
# All rights reserved.
|
|
5
5
|
#
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
function(add_boost_test_executable NAME COMPONENT)
|
|
2
|
+
add_executable(${NAME}
|
|
3
|
+
${ARGN}
|
|
4
|
+
)
|
|
5
|
+
|
|
6
|
+
# set_target_properties(${NAME} PROPERTIES
|
|
7
|
+
# DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
|
|
8
|
+
|
|
9
|
+
target_link_libraries(${NAME}
|
|
10
|
+
boost_unit_test_framework
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
if($<CONFIG:SanitizeValgrind>)
|
|
14
|
+
add_test(
|
|
15
|
+
NAME ${NAME}
|
|
16
|
+
COMMAND
|
|
17
|
+
valgrind>
|
|
18
|
+
$<$<PLATFORM_ID:Darwin>:--dsymutil=yes>
|
|
19
|
+
--gen-suppressions=all
|
|
20
|
+
./${NAME}
|
|
21
|
+
--log_level=test_suite
|
|
22
|
+
--report_level=detailed
|
|
23
|
+
--build_info=yes
|
|
24
|
+
--detect_memory_leaks=0
|
|
25
|
+
)
|
|
26
|
+
else()
|
|
27
|
+
add_test(
|
|
28
|
+
NAME ${NAME}
|
|
29
|
+
COMMAND
|
|
30
|
+
${NAME}
|
|
31
|
+
--log_level=test_suite
|
|
32
|
+
--report_level=detailed
|
|
33
|
+
--build_info=yes
|
|
34
|
+
--detect_memory_leaks=0
|
|
35
|
+
)
|
|
36
|
+
endif()
|
|
37
|
+
|
|
38
|
+
install(TARGETS ${NAME}
|
|
39
|
+
RUNTIME DESTINATION bin COMPONENT ${COMPONENT}
|
|
40
|
+
LIBRARY DESTINATION lib COMPONENT ${COMPONENT}
|
|
41
|
+
ARCHIVE DESTINATION lib COMPONENT ${COMPONENT}
|
|
42
|
+
)
|
|
43
|
+
endfunction()
|
quasardb/batch_column.hpp
CHANGED
quasardb/batch_inserter.hpp
CHANGED
quasardb/blob.hpp
CHANGED
quasardb/cluster.hpp
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
*
|
|
3
3
|
* Official Python API
|
|
4
4
|
*
|
|
5
|
-
* Copyright (c) 2009-
|
|
5
|
+
* Copyright (c) 2009-2023, quasardb SAS. All rights reserved.
|
|
6
6
|
* All rights reserved.
|
|
7
7
|
*
|
|
8
8
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
#include "batch_inserter.hpp"
|
|
34
34
|
#include "blob.hpp"
|
|
35
35
|
#include "continuous.hpp"
|
|
36
|
+
#include "double.hpp"
|
|
36
37
|
#include "error.hpp"
|
|
37
38
|
#include "handle.hpp"
|
|
38
39
|
#include "integer.hpp"
|
|
@@ -42,11 +43,12 @@
|
|
|
42
43
|
#include "perf.hpp"
|
|
43
44
|
#include "pinned_writer.hpp"
|
|
44
45
|
#include "query.hpp"
|
|
46
|
+
#include "string.hpp"
|
|
45
47
|
#include "table.hpp"
|
|
46
48
|
#include "table_reader.hpp"
|
|
47
49
|
#include "tag.hpp"
|
|
50
|
+
#include "timestamp.hpp"
|
|
48
51
|
#include "utils.hpp"
|
|
49
|
-
#include "version.hpp"
|
|
50
52
|
#include <qdb/node.h>
|
|
51
53
|
#include <qdb/prefix.h>
|
|
52
54
|
#include <qdb/suffix.h>
|
|
@@ -62,24 +64,27 @@ class cluster
|
|
|
62
64
|
{
|
|
63
65
|
public:
|
|
64
66
|
cluster(const std::string & uri,
|
|
65
|
-
const std::string & user_name
|
|
66
|
-
const std::string & user_private_key
|
|
67
|
-
const std::string & cluster_public_key
|
|
68
|
-
std::
|
|
69
|
-
|
|
67
|
+
const std::string & user_name = {},
|
|
68
|
+
const std::string & user_private_key = {},
|
|
69
|
+
const std::string & cluster_public_key = {},
|
|
70
|
+
const std::string & user_security_file = {},
|
|
71
|
+
const std::string & cluster_public_key_file = {},
|
|
72
|
+
std::chrono::milliseconds timeout = std::chrono::minutes{1},
|
|
73
|
+
bool do_version_check = false)
|
|
70
74
|
: _uri{uri}
|
|
71
75
|
, _handle{make_handle_ptr()}
|
|
72
76
|
, _json_loads{pybind11::module::import("json").attr("loads")}
|
|
73
77
|
, _logger("quasardb.cluster")
|
|
74
78
|
{
|
|
75
|
-
|
|
76
|
-
// the one used during the build
|
|
77
|
-
if (do_version_check)
|
|
79
|
+
if (do_version_check == true)
|
|
78
80
|
{
|
|
79
|
-
|
|
81
|
+
_logger.warn(
|
|
82
|
+
"do_version_check parameter has been deprecated and a no-op. It will be removed from a "
|
|
83
|
+
"future release");
|
|
80
84
|
}
|
|
81
85
|
|
|
82
|
-
options().apply_credentials(user_name, user_private_key, cluster_public_key
|
|
86
|
+
options().apply_credentials(user_name, user_private_key, cluster_public_key, //
|
|
87
|
+
user_security_file, cluster_public_key_file);
|
|
83
88
|
|
|
84
89
|
options().set_timeout(timeout);
|
|
85
90
|
|
|
@@ -175,11 +180,26 @@ public:
|
|
|
175
180
|
return qdb::blob_entry{_handle, alias};
|
|
176
181
|
}
|
|
177
182
|
|
|
183
|
+
qdb::string_entry string(const std::string & alias)
|
|
184
|
+
{
|
|
185
|
+
return qdb::string_entry{_handle, alias};
|
|
186
|
+
}
|
|
187
|
+
|
|
178
188
|
qdb::integer_entry integer(const std::string & alias)
|
|
179
189
|
{
|
|
180
190
|
return qdb::integer_entry{_handle, alias};
|
|
181
191
|
}
|
|
182
192
|
|
|
193
|
+
qdb::double_entry double_(const std::string & alias)
|
|
194
|
+
{
|
|
195
|
+
return qdb::double_entry{_handle, alias};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
qdb::timestamp_entry timestamp(const std::string & alias)
|
|
199
|
+
{
|
|
200
|
+
return qdb::timestamp_entry{_handle, alias};
|
|
201
|
+
}
|
|
202
|
+
|
|
183
203
|
qdb::table table(const std::string & alias)
|
|
184
204
|
{
|
|
185
205
|
return qdb::table{_handle, alias};
|
|
@@ -360,17 +380,19 @@ static inline void register_cluster(Module & m)
|
|
|
360
380
|
|
|
361
381
|
py::class_<qdb::cluster>(m, "Cluster",
|
|
362
382
|
"Represents a connection to the QuasarDB cluster. ") //
|
|
363
|
-
.def(
|
|
364
|
-
|
|
383
|
+
.def(
|
|
384
|
+
py::init<const std::string &, const std::string &, const std::string &, const std::string &,
|
|
385
|
+
const std::string &, const std::string &, std::chrono::milliseconds, bool>(), //
|
|
365
386
|
py::arg("uri"), //
|
|
366
387
|
py::arg("user_name") = std::string{}, //
|
|
367
388
|
py::arg("user_private_key") = std::string{}, //
|
|
368
389
|
py::arg("cluster_public_key") = std::string{}, //
|
|
390
|
+
py::arg("user_security_file") = std::string{}, //
|
|
391
|
+
py::arg("cluster_public_key_file") = std::string{}, //
|
|
369
392
|
py::arg("timeout") = std::chrono::minutes{1}, //
|
|
370
|
-
py::arg("do_version_check") =
|
|
393
|
+
py::arg("do_version_check") = false) //
|
|
371
394
|
.def("__enter__", &qdb::cluster::enter) //
|
|
372
|
-
.def("__exit__",
|
|
373
|
-
&qdb::cluster::exit) // //
|
|
395
|
+
.def("__exit__", &qdb::cluster::exit) //
|
|
374
396
|
.def("is_open", &qdb::cluster::is_open) //
|
|
375
397
|
.def("uri", &qdb::cluster::uri) //
|
|
376
398
|
.def("node", &qdb::cluster::node) //
|
|
@@ -381,7 +403,10 @@ static inline void register_cluster(Module & m)
|
|
|
381
403
|
.def("node_topology", &qdb::cluster::node_topology) //
|
|
382
404
|
.def("tag", &qdb::cluster::tag) //
|
|
383
405
|
.def("blob", &qdb::cluster::blob) //
|
|
406
|
+
.def("string", &qdb::cluster::string) //
|
|
384
407
|
.def("integer", &qdb::cluster::integer) //
|
|
408
|
+
.def("double", &qdb::cluster::double_) //
|
|
409
|
+
.def("timestamp", &qdb::cluster::timestamp) //
|
|
385
410
|
.def("ts", &qdb::cluster::table) //
|
|
386
411
|
.def("table", &qdb::cluster::table) //
|
|
387
412
|
.def("ts_batch", &qdb::cluster::inserter) //
|
quasardb/cmake_install.cmake
CHANGED
|
@@ -34,7 +34,7 @@ endif()
|
|
|
34
34
|
|
|
35
35
|
# Set default install directory permissions.
|
|
36
36
|
if(NOT DEFINED CMAKE_OBJDUMP)
|
|
37
|
-
set(CMAKE_OBJDUMP "/
|
|
37
|
+
set(CMAKE_OBJDUMP "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump")
|
|
38
38
|
endif()
|
|
39
39
|
|
|
40
40
|
if(NOT CMAKE_INSTALL_LOCAL_ONLY)
|
quasardb/concepts.hpp
CHANGED
|
@@ -19,12 +19,28 @@ concept range_t =
|
|
|
19
19
|
|
|
20
20
|
template <typename R, typename T>
|
|
21
21
|
concept input_range_t =
|
|
22
|
-
// Ensure we are
|
|
22
|
+
// Ensure we are an input range
|
|
23
23
|
ranges::input_range<R>
|
|
24
24
|
|
|
25
25
|
// Ensure the range carries the correct type.
|
|
26
26
|
&& range_t<R, T>;
|
|
27
27
|
|
|
28
|
+
template <typename R, typename T>
|
|
29
|
+
concept forward_range_t =
|
|
30
|
+
// Ensure we are a forward range
|
|
31
|
+
ranges::forward_range<R>
|
|
32
|
+
|
|
33
|
+
// And delegate the rest of the checks
|
|
34
|
+
&& input_range_t<R, T>;
|
|
35
|
+
|
|
36
|
+
template <typename R, typename T>
|
|
37
|
+
concept sized_range_t =
|
|
38
|
+
// Ensure we are a sized range
|
|
39
|
+
ranges::sized_range<R>
|
|
40
|
+
|
|
41
|
+
// And delegate the rest of the checks
|
|
42
|
+
&& range_t<R, T>;
|
|
43
|
+
|
|
28
44
|
namespace py = pybind11;
|
|
29
45
|
|
|
30
46
|
////////////////////////////////////////////////////////////////////////////////
|
|
@@ -98,21 +114,19 @@ static_assert(not qdb_primitive<qdb_ts_string_point>);
|
|
|
98
114
|
template <typename Dtype>
|
|
99
115
|
concept dtype = std::is_base_of_v<traits::dtype<Dtype::kind>, Dtype>
|
|
100
116
|
|
|
101
|
-
|
|
117
|
+
&& std::is_enum_v<decltype(Dtype::kind)>
|
|
102
118
|
|
|
103
119
|
;
|
|
104
120
|
|
|
105
121
|
template <typename Dtype>
|
|
106
|
-
concept fixed_width_dtype =
|
|
107
|
-
dtype<Dtype>
|
|
122
|
+
concept fixed_width_dtype = dtype<Dtype>
|
|
108
123
|
|
|
109
124
|
// Check base class
|
|
110
125
|
&& std::is_base_of_v<traits::fixed_width_dtype<Dtype::kind, Dtype::size>, Dtype>;
|
|
111
126
|
|
|
112
127
|
// Test dtypes against their size
|
|
113
128
|
template <typename Dtype, py::ssize_t Size>
|
|
114
|
-
concept dtype_of_width = fixed_width_dtype<Dtype> && Dtype::size ==
|
|
115
|
-
Size;
|
|
129
|
+
concept dtype_of_width = fixed_width_dtype<Dtype> && Dtype::size == Size;
|
|
116
130
|
|
|
117
131
|
// 64bit dtype
|
|
118
132
|
template <typename Dtype>
|
|
@@ -133,14 +147,14 @@ concept dtype8 = dtype_of_width<Dtype, 1>;
|
|
|
133
147
|
template <typename Dtype>
|
|
134
148
|
concept datetime64_dtype = fixed_width_dtype<Dtype>
|
|
135
149
|
|
|
136
|
-
|
|
137
|
-
|
|
150
|
+
// Verify base class is datetime64_dtype
|
|
151
|
+
&& std::is_base_of_v<traits::datetime64_dtype<Dtype::precision>, Dtype>
|
|
138
152
|
|
|
139
|
-
|
|
140
|
-
|
|
153
|
+
// datetime64 is always a 64bit object
|
|
154
|
+
&& dtype64<Dtype>
|
|
141
155
|
|
|
142
|
-
|
|
143
|
-
|
|
156
|
+
// It needs to have a precision
|
|
157
|
+
&& std::is_enum_v<decltype(Dtype::precision)>;
|
|
144
158
|
|
|
145
159
|
template <typename Dtype>
|
|
146
160
|
concept variable_width_dtype =
|
|
@@ -159,11 +173,11 @@ concept variable_width_dtype =
|
|
|
159
173
|
template <typename Dtype>
|
|
160
174
|
concept object_dtype = dtype<Dtype>
|
|
161
175
|
|
|
162
|
-
|
|
163
|
-
|
|
176
|
+
// Objects are always fixed width (64-bit pointers, effectively)
|
|
177
|
+
&& fixed_width_dtype<Dtype>
|
|
164
178
|
|
|
165
|
-
|
|
166
|
-
|
|
179
|
+
// Verify base class
|
|
180
|
+
&& std::is_base_of_v<traits::object_dtype<typename Dtype::value_type>, Dtype>;
|
|
167
181
|
|
|
168
182
|
// Trivial dtypes are useful for deciding whether you can use fast memcpy-based
|
|
169
183
|
// conversions, e.g. when numpy's int64 has the exact same representation as
|
quasardb/continuous.hpp
CHANGED
quasardb/convert/array.hpp
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
*
|
|
3
3
|
* Official Python API
|
|
4
4
|
*
|
|
5
|
-
* Copyright (c) 2009-
|
|
5
|
+
* Copyright (c) 2009-2023, quasardb SAS. All rights reserved.
|
|
6
6
|
* All rights reserved.
|
|
7
7
|
*
|
|
8
8
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -79,8 +79,8 @@ struct convert_array;
|
|
|
79
79
|
//
|
|
80
80
|
/////
|
|
81
81
|
template <typename From, typename To>
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
requires(concepts::dtype<From> && !concepts::delegate_dtype<From> && concepts::qdb_primitive<To>) struct
|
|
83
|
+
convert_array<From, To>
|
|
84
84
|
{
|
|
85
85
|
using value_type = typename From::value_type;
|
|
86
86
|
static constexpr value_converter<From, To> const xform_{};
|
|
@@ -105,8 +105,7 @@ struct convert_array<From, To>
|
|
|
105
105
|
//
|
|
106
106
|
/////
|
|
107
107
|
template <typename From, typename To>
|
|
108
|
-
|
|
109
|
-
struct convert_array<From, To>
|
|
108
|
+
requires(concepts::delegate_dtype<From> && concepts::qdb_primitive<To>) struct convert_array<From, To>
|
|
110
109
|
{
|
|
111
110
|
// Source value_type, e.g. std::int32_t
|
|
112
111
|
using value_type = typename From::value_type;
|
|
@@ -145,8 +144,7 @@ struct convert_array<From, To>
|
|
|
145
144
|
//
|
|
146
145
|
/////
|
|
147
146
|
template <typename From, typename To>
|
|
148
|
-
|
|
149
|
-
struct convert_array<From, To>
|
|
147
|
+
requires(concepts::qdb_primitive<From> && !concepts::delegate_dtype<To>) struct convert_array<From, To>
|
|
150
148
|
{
|
|
151
149
|
static constexpr value_converter<From, To> const xform_{};
|
|
152
150
|
|
|
@@ -156,6 +154,49 @@ struct convert_array<From, To>
|
|
|
156
154
|
};
|
|
157
155
|
};
|
|
158
156
|
|
|
157
|
+
/////
|
|
158
|
+
//
|
|
159
|
+
// qdb->numpy
|
|
160
|
+
// "Delegate" transforms
|
|
161
|
+
//
|
|
162
|
+
// In some cases numpy's representations are more rich than what Quasardb's primitives
|
|
163
|
+
// support, e.g. int32. In this case, we first transform this to the "delegate type",
|
|
164
|
+
// int64, which can then figure out the rest.
|
|
165
|
+
//
|
|
166
|
+
// Input: range of length N, type: qdb_primitive
|
|
167
|
+
// Output: range of length N, dtype: To
|
|
168
|
+
//
|
|
169
|
+
/////
|
|
170
|
+
template <typename From, typename To>
|
|
171
|
+
requires(concepts::qdb_primitive<From> && concepts::delegate_dtype<To>) struct convert_array<From, To>
|
|
172
|
+
{
|
|
173
|
+
// Destination value_type, e.g. std::int32_t
|
|
174
|
+
using value_type = typename To::value_type;
|
|
175
|
+
|
|
176
|
+
// Delegate dtype, e.g. traits::int64_dtype
|
|
177
|
+
using Delegate = typename To::delegate_type;
|
|
178
|
+
|
|
179
|
+
// Delegate value_type, e.g. std::int64_t
|
|
180
|
+
using delegate_value_type = typename Delegate::value_type;
|
|
181
|
+
|
|
182
|
+
static constexpr convert_array<From, Delegate> const delegate{};
|
|
183
|
+
|
|
184
|
+
[[nodiscard]] constexpr inline auto operator()() const noexcept
|
|
185
|
+
{
|
|
186
|
+
auto xform = [](value_type const & x) -> delegate_value_type {
|
|
187
|
+
if (To::is_null(x))
|
|
188
|
+
{
|
|
189
|
+
return Delegate::null_value();
|
|
190
|
+
}
|
|
191
|
+
else
|
|
192
|
+
{
|
|
193
|
+
return static_cast<delegate_value_type>(x);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
return ranges::views::transform(xform) | delegate();
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
|
|
159
200
|
}; // namespace qdb::convert::detail
|
|
160
201
|
|
|
161
202
|
namespace qdb::convert
|
|
@@ -225,4 +266,17 @@ static inline constexpr std::vector<To> masked_array(qdb::masked_array const & x
|
|
|
225
266
|
return array<From, To>(xs.filled<From>());
|
|
226
267
|
}
|
|
227
268
|
|
|
269
|
+
// qdb -> numpy
|
|
270
|
+
template <concepts::qdb_primitive From, concepts::dtype To, ranges::input_range R>
|
|
271
|
+
requires(concepts::input_range_t<R, From>) static inline qdb::masked_array masked_array(R && xs)
|
|
272
|
+
{
|
|
273
|
+
if (ranges::empty(xs)) [[unlikely]]
|
|
274
|
+
{
|
|
275
|
+
return {};
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
py::array xs_ = detail::to_array<To>(xs | detail::convert_array<From, To>{}());
|
|
279
|
+
return qdb::masked_array(xs_, qdb::masked_array::masked_null<To>(xs_));
|
|
280
|
+
}
|
|
281
|
+
|
|
228
282
|
}; // namespace qdb::convert
|
quasardb/convert/point.hpp
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
*
|
|
3
3
|
* Official Python API
|
|
4
4
|
*
|
|
5
|
-
* Copyright (c) 2009-
|
|
5
|
+
* Copyright (c) 2009-2023, quasardb SAS. All rights reserved.
|
|
6
6
|
* All rights reserved.
|
|
7
7
|
*
|
|
8
8
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -58,12 +58,10 @@ namespace py = pybind11;
|
|
|
58
58
|
////////////////////////////////////////////////////////////////////////////////
|
|
59
59
|
|
|
60
60
|
template <typename T>
|
|
61
|
-
|
|
62
|
-
using point_type = typename traits::qdb_value<T>::point_type;
|
|
61
|
+
requires(concepts::qdb_primitive<T>) using point_type = typename traits::qdb_value<T>::point_type;
|
|
63
62
|
|
|
64
63
|
template <typename T>
|
|
65
|
-
|
|
66
|
-
using primitive_type = typename traits::qdb_value<T>::primitive_type;
|
|
64
|
+
requires(concepts::qdb_point<T>) using primitive_type = typename traits::qdb_value<T>::primitive_type;
|
|
67
65
|
|
|
68
66
|
// Base declaration of pair-to-point function
|
|
69
67
|
template <concepts::qdb_primitive T>
|
|
@@ -136,8 +134,7 @@ struct convert_point_array;
|
|
|
136
134
|
//
|
|
137
135
|
/////
|
|
138
136
|
template <typename From, typename To>
|
|
139
|
-
|
|
140
|
-
struct convert_point_array<From, To>
|
|
137
|
+
requires(concepts::dtype<From> && concepts::qdb_primitive<To>) struct convert_point_array<From, To>
|
|
141
138
|
{
|
|
142
139
|
static constexpr convert_array<From, To> const value_delegate_{};
|
|
143
140
|
static constexpr convert_array<traits::datetime64_ns_dtype, qdb_timespec_t> const ts_delegate_{};
|
|
@@ -176,8 +173,7 @@ struct convert_point_array<From, To>
|
|
|
176
173
|
//
|
|
177
174
|
/////
|
|
178
175
|
template <typename From, typename To>
|
|
179
|
-
|
|
180
|
-
struct convert_point_array<From, To>
|
|
176
|
+
requires(concepts::qdb_primitive<From> && concepts::dtype<To>) struct convert_point_array<From, To>
|
|
181
177
|
{
|
|
182
178
|
static constexpr convert_array<From, To> const value_delegate_{};
|
|
183
179
|
static constexpr convert_array<qdb_timespec_t, traits::datetime64_ns_dtype> const ts_delegate_{};
|
|
@@ -192,6 +188,7 @@ struct convert_point_array<From, To>
|
|
|
192
188
|
|
|
193
189
|
auto timestamps_ = timestamps | ts_delegate_();
|
|
194
190
|
auto values_ = values | value_delegate_();
|
|
191
|
+
|
|
195
192
|
return std::make_pair(timestamps_, values_);
|
|
196
193
|
}
|
|
197
194
|
};
|
|
@@ -288,13 +285,21 @@ static inline std::vector<point_type<To>> point_array(
|
|
|
288
285
|
return point_array<From, To>(timestamps, values.filled<From>());
|
|
289
286
|
};
|
|
290
287
|
|
|
288
|
+
// numpy -> qdb
|
|
289
|
+
template <concepts::dtype From, concepts::qdb_primitive To>
|
|
290
|
+
static inline std::vector<point_type<To>> point_array(
|
|
291
|
+
std::pair<py::array, qdb::masked_array> const & xs)
|
|
292
|
+
{
|
|
293
|
+
return point_array<From, To>(std::get<0>(xs), std::get<1>(xs));
|
|
294
|
+
};
|
|
295
|
+
|
|
291
296
|
// qdb -> numpy
|
|
292
297
|
//
|
|
293
298
|
// Takes a range of qdb point structs (eg qdb_ts_double_point) and returns a pair of two
|
|
294
299
|
// numpy ndarrays, one for timestamps and another for the values.
|
|
295
300
|
template <concepts::qdb_primitive From, concepts::dtype To, ranges::input_range R>
|
|
296
|
-
|
|
297
|
-
|
|
301
|
+
requires(concepts::input_range_t<R, point_type<From>>) static inline std::pair<py::array,
|
|
302
|
+
qdb::masked_array> point_array(R && xs)
|
|
298
303
|
{
|
|
299
304
|
if (ranges::empty(xs)) [[unlikely]]
|
|
300
305
|
{
|