forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyarrow.h
More file actions
108 lines (83 loc) · 4.06 KB
/
Copy pathpyarrow.h
File metadata and controls
108 lines (83 loc) · 4.06 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#ifndef ARROW_PYTHON_PYARROW_H
#define ARROW_PYTHON_PYARROW_H
#include "arrow/python/platform.h"
#include <memory>
#include "arrow/python/visibility.h"
#include "arrow/sparse_tensor.h"
// Work around ARROW-2317 (C linkage warning from Cython)
extern "C++" {
namespace arrow {
class Array;
class Buffer;
class DataType;
class Field;
class RecordBatch;
class Schema;
class Status;
class Table;
class Tensor;
namespace py {
// Returns 0 on success, -1 on error.
ARROW_PYTHON_EXPORT int import_pyarrow();
ARROW_PYTHON_EXPORT bool is_buffer(PyObject* buffer);
ARROW_PYTHON_EXPORT Status unwrap_buffer(PyObject* buffer, std::shared_ptr<Buffer>* out);
ARROW_PYTHON_EXPORT PyObject* wrap_buffer(const std::shared_ptr<Buffer>& buffer);
ARROW_PYTHON_EXPORT bool is_data_type(PyObject* data_type);
ARROW_PYTHON_EXPORT Status unwrap_data_type(PyObject* data_type,
std::shared_ptr<DataType>* out);
ARROW_PYTHON_EXPORT PyObject* wrap_data_type(const std::shared_ptr<DataType>& type);
ARROW_PYTHON_EXPORT bool is_field(PyObject* field);
ARROW_PYTHON_EXPORT Status unwrap_field(PyObject* field, std::shared_ptr<Field>* out);
ARROW_PYTHON_EXPORT PyObject* wrap_field(const std::shared_ptr<Field>& field);
ARROW_PYTHON_EXPORT bool is_schema(PyObject* schema);
ARROW_PYTHON_EXPORT Status unwrap_schema(PyObject* schema, std::shared_ptr<Schema>* out);
ARROW_PYTHON_EXPORT PyObject* wrap_schema(const std::shared_ptr<Schema>& schema);
ARROW_PYTHON_EXPORT bool is_array(PyObject* array);
ARROW_PYTHON_EXPORT Status unwrap_array(PyObject* array, std::shared_ptr<Array>* out);
ARROW_PYTHON_EXPORT PyObject* wrap_array(const std::shared_ptr<Array>& array);
ARROW_PYTHON_EXPORT PyObject* wrap_chunked_array(
const std::shared_ptr<ChunkedArray>& array);
ARROW_PYTHON_EXPORT bool is_tensor(PyObject* tensor);
ARROW_PYTHON_EXPORT Status unwrap_tensor(PyObject* tensor, std::shared_ptr<Tensor>* out);
ARROW_PYTHON_EXPORT PyObject* wrap_tensor(const std::shared_ptr<Tensor>& tensor);
ARROW_PYTHON_EXPORT bool is_sparse_tensor_coo(PyObject* sparse_tensor);
ARROW_PYTHON_EXPORT Status
unwrap_sparse_coo_tensor(PyObject* sparse_tensor, std::shared_ptr<SparseCOOTensor>* out);
ARROW_PYTHON_EXPORT PyObject* wrap_sparse_coo_tensor(
const std::shared_ptr<SparseCOOTensor>& sparse_tensor);
ARROW_PYTHON_EXPORT bool is_sparse_tensor_csr(PyObject* sparse_tensor);
ARROW_PYTHON_EXPORT Status
unwrap_sparse_csr_matrix(PyObject* sparse_tensor, std::shared_ptr<SparseCSRMatrix>* out);
ARROW_PYTHON_EXPORT PyObject* wrap_sparse_csr_matrix(
const std::shared_ptr<SparseCSRMatrix>& sparse_tensor);
ARROW_PYTHON_EXPORT bool is_table(PyObject* table);
ARROW_PYTHON_EXPORT Status unwrap_table(PyObject* table, std::shared_ptr<Table>* out);
ARROW_PYTHON_EXPORT PyObject* wrap_table(const std::shared_ptr<Table>& table);
ARROW_PYTHON_EXPORT bool is_record_batch(PyObject* batch);
ARROW_PYTHON_EXPORT Status unwrap_record_batch(PyObject* batch,
std::shared_ptr<RecordBatch>* out);
ARROW_PYTHON_EXPORT PyObject* wrap_record_batch(
const std::shared_ptr<RecordBatch>& batch);
namespace internal {
ARROW_PYTHON_EXPORT int check_status(const Status& status);
} // namespace internal
} // namespace py
} // namespace arrow
} // extern "C++"
#endif // ARROW_PYTHON_PYARROW_H