24#include "pybind11/pybind11.h"
25#include "pybind11/stl.h"
27#include "ndarray/pybind11.h"
35using namespace py::literals;
41using utils::python::WrapperCollection;
45using PyBaseColumnView = py::class_<BaseColumnView, std::shared_ptr<BaseColumnView>>;
47using PyBitsColumn = py::class_<BitsColumn, std::shared_ptr<BitsColumn>>;
49template <
typename T,
typename PyClass>
50static void declareBaseColumnViewOverloads(PyClass &cls) {
51 cls.def(
"_basicget", [](BaseColumnView & self, Key<T>
const &key) ->
typename ndarray::Array<T, 1>
const {
56template <
typename U,
typename PyClass>
57static void declareBaseColumnViewArrayOverloads(PyClass &cls) {
60 typename ndarray::Array<U, 2, 1>
const {
return self[key]; });
64template <
typename PyClass>
65static void declareBaseColumnViewFlagOverloads(PyClass &cls) {
67 [](BaseColumnView &self, Key<Flag>
const &key) -> ndarray::Array<bool const, 1, 1>
const {
70 "Flag/bool access via ColumnView objects is deprecated in favor of more complete support "
71 "on Catalog. Will be removed after v26.",
74 return ndarray::copy(self[key]);
78static void declareBaseColumnView(WrapperCollection &wrappers) {
82 wrappers.wrapType(PyBaseColumnView(wrappers.module,
"_BaseColumnViewBase"), [](
auto &mod,
auto &cls) {
83 cls.def(
"getTable", &BaseColumnView::getTable);
84 cls.def_property_readonly(
"table", &BaseColumnView::getTable);
85 cls.def(
"getSchema", &BaseColumnView::getSchema);
86 cls.def_property_readonly(
"schema", &BaseColumnView::getSchema);
88 cls.def(
"_getBits", &BaseColumnView::getBits);
89 cls.def(
"getAllBits", &BaseColumnView::getAllBits);
90 declareBaseColumnViewOverloads<std::uint8_t>(cls);
91 declareBaseColumnViewOverloads<std::uint16_t>(cls);
92 declareBaseColumnViewOverloads<std::int32_t>(cls);
93 declareBaseColumnViewOverloads<std::int64_t>(cls);
94 declareBaseColumnViewOverloads<float>(cls);
95 declareBaseColumnViewOverloads<double>(cls);
96 declareBaseColumnViewFlagOverloads(cls);
99 declareBaseColumnViewArrayOverloads<std::uint8_t>(cls);
100 declareBaseColumnViewArrayOverloads<std::uint16_t>(cls);
101 declareBaseColumnViewArrayOverloads<int>(cls);
102 declareBaseColumnViewArrayOverloads<float>(cls);
103 declareBaseColumnViewArrayOverloads<double>(cls);
107 cls.def(
"_basicget", &BaseColumnView::get_radians_array);
111static void declareBitsColumn(WrapperCollection &wrappers) {
112 wrappers.wrapType(PyBitsColumn(wrappers.module,
"BitsColumn"), [](
auto &mod,
auto &cls) {
113 cls.def(
"getArray", &BitsColumn::getArray);
114 cls.def_property_readonly(
"array", &BitsColumn::getArray);
115 cls.def(
"getBit", (BitsColumn::SizeT(BitsColumn::*)(Key<Flag> const &) const) & BitsColumn::getBit,
117 cls.def(
"getBit", (BitsColumn::SizeT(BitsColumn::*)(std::string const &) const) & BitsColumn::getBit,
119 cls.def(
"getMask", (BitsColumn::SizeT(BitsColumn::*)(Key<Flag> const &) const) & BitsColumn::getMask,
121 cls.def(
"getMask", (BitsColumn::SizeT(BitsColumn::*)(std::string const &) const) & BitsColumn::getMask,
Tag types used to declare specialized field types.
void wrapBaseColumnView(WrapperCollection &wrappers)