-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpy_query_result.h
More file actions
67 lines (41 loc) · 1.49 KB
/
py_query_result.h
File metadata and controls
67 lines (41 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
#include <memory>
#include <vector>
#include "arrow_array.h"
#include "common/arrow/arrow.h"
#include "main/lbug.h"
#include "pybind_include.h"
using namespace lbug::main;
class PyQueryResult {
friend class PyConnection;
public:
static void initialize(py::handle& m);
PyQueryResult() = default;
~PyQueryResult();
bool hasNext();
py::list getNext();
bool hasNextQueryResult();
std::unique_ptr<PyQueryResult> getNextQueryResult();
void close();
static py::object convertValueToPyObject(const lbug::common::Value& value);
py::object getAsDF();
lbug::pyarrow::Table getAsArrow(std::int64_t chunkSize, bool fallbackExtensionTypes);
py::list getColumnDataTypes();
py::list getColumnNames();
void resetIterator();
bool isSuccess() const;
std::string getErrorMessage() const;
double getExecutionTime();
double getCompilingTime();
size_t getNumTuples();
private:
static py::dict convertNodeIdToPyDict(const lbug::common::nodeID_t& nodeId);
void getNextArrowChunk(const std::vector<lbug::common::LogicalType>& types,
const std::vector<std::string>& names, py::list& batches, std::int64_t chunkSize,
bool fallbackExtensionTypes);
py::object getArrowChunks(const std::vector<lbug::common::LogicalType>& types,
const std::vector<std::string>& names, std::int64_t chunkSize, bool fallbackExtensionTypes);
private:
QueryResult* queryResult = nullptr;
bool isOwned = false;
};