]> git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/cpp/src/arrow/c/abi.h
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / cpp / src / arrow / c / abi.h
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17
18 #pragma once
19
20 #include <stdint.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 #define ARROW_FLAG_DICTIONARY_ORDERED 1
27 #define ARROW_FLAG_NULLABLE 2
28 #define ARROW_FLAG_MAP_KEYS_SORTED 4
29
30 struct ArrowSchema {
31 // Array type description
32 const char* format;
33 const char* name;
34 const char* metadata;
35 int64_t flags;
36 int64_t n_children;
37 struct ArrowSchema** children;
38 struct ArrowSchema* dictionary;
39
40 // Release callback
41 void (*release)(struct ArrowSchema*);
42 // Opaque producer-specific data
43 void* private_data;
44 };
45
46 struct ArrowArray {
47 // Array data description
48 int64_t length;
49 int64_t null_count;
50 int64_t offset;
51 int64_t n_buffers;
52 int64_t n_children;
53 const void** buffers;
54 struct ArrowArray** children;
55 struct ArrowArray* dictionary;
56
57 // Release callback
58 void (*release)(struct ArrowArray*);
59 // Opaque producer-specific data
60 void* private_data;
61 };
62
63 // EXPERIMENTAL: C stream interface
64
65 struct ArrowArrayStream {
66 // Callback to get the stream type
67 // (will be the same for all arrays in the stream).
68 //
69 // Return value: 0 if successful, an `errno`-compatible error code otherwise.
70 //
71 // If successful, the ArrowSchema must be released independently from the stream.
72 int (*get_schema)(struct ArrowArrayStream*, struct ArrowSchema* out);
73
74 // Callback to get the next array
75 // (if no error and the array is released, the stream has ended)
76 //
77 // Return value: 0 if successful, an `errno`-compatible error code otherwise.
78 //
79 // If successful, the ArrowArray must be released independently from the stream.
80 int (*get_next)(struct ArrowArrayStream*, struct ArrowArray* out);
81
82 // Callback to get optional detailed error information.
83 // This must only be called if the last stream operation failed
84 // with a non-0 return code.
85 //
86 // Return value: pointer to a null-terminated character array describing
87 // the last error, or NULL if no description is available.
88 //
89 // The returned pointer is only valid until the next operation on this stream
90 // (including release).
91 const char* (*get_last_error)(struct ArrowArrayStream*);
92
93 // Release callback: release the stream's own resources.
94 // Note that arrays returned by `get_next` must be individually released.
95 void (*release)(struct ArrowArrayStream*);
96
97 // Opaque producer-specific data
98 void* private_data;
99 };
100
101 #ifdef __cplusplus
102 }
103 #endif