Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit 4bb176e

Browse files
kgpaifacebook-github-bot
authored andcommitted
Create PyVelox package and move type dependencies over. (#503)
Summary: PyVelox package is gated with CMake flags in this pr. This refactoring will allow Torcharrow and Koski to use a common set of bindings. Pull Request resolved: #503 Reviewed By: wenleix Differential Revision: D40082189 Pulled By: kgpai fbshipit-source-id: 925f3808cc8429e36d37e084abf73df2596a6346
1 parent 74d0df7 commit 4bb176e

14 files changed

+415
-256
lines changed

csrc/velox/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ cmake_minimum_required(VERSION 3.15)
99

1010
# _torcharrow is a shared library as it's a Python extension
1111
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
12+
set(CREATE_PYVELOX_MODULE OFF)
1213

1314
# To make the right CPython is built with on GitHub Actions,
1415
# see https://github.com/actions/setup-python/issues/121#issuecomment-1014500503
@@ -91,6 +92,7 @@ endif()
9192
# set_target_properties(_torcharrow PROPERTIES CXX_VISIBILITY_PRESET default)
9293
add_subdirectory(velox)
9394
add_subdirectory(functions)
95+
add_subdirectory(pyvelox)
9496

9597

9698
# Link with Velox:
@@ -103,6 +105,7 @@ target_link_libraries(_torcharrow PRIVATE
103105
velox_function_registry
104106
velox_arrow_bridge
105107
torcharrow_udfs
108+
pyvelox
106109
)
107110

108111
target_compile_definitions(

csrc/velox/_torcharrow.pyi

+62-62
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ __all__ = [
4949
"SimpleColumnVARCHAR",
5050
"TypeKind",
5151
"VeloxType",
52-
"VeloxArrayType",
53-
"VeloxFixedArrayType",
54-
"VeloxMapType",
55-
"VeloxRowType",
56-
"VeloxType_BIGINT",
57-
"VeloxType_BOOLEAN",
58-
"VeloxType_DOUBLE",
59-
"VeloxType_INTEGER",
60-
"VeloxType_REAL",
61-
"VeloxType_SMALLINT",
62-
"VeloxType_TINYINT",
63-
"VeloxType_VARCHAR",
52+
"ArrayType",
53+
"FixedSizeArrayType",
54+
"MapType",
55+
"RowType",
56+
"BigintType",
57+
"BooleanType",
58+
"DoubleType",
59+
"IntegerType",
60+
"RealType",
61+
"SmallintType",
62+
"TinyintType",
63+
"VarcharType",
6464
"Vocab",
6565
"fb_SentencePiece",
6666
"Column",
@@ -2153,30 +2153,30 @@ class VeloxType:
21532153
def kind_name(self) -> str: ...
21542154
__pybind11_module_local_v4_clang_libstdcpp_cxxabi1002__ = ... # type: PyCapsule # value = <capsule object NULL at 0x7f50e2a512d0>
21552155
pass
2156-
class VeloxArrayType(VeloxType):
2156+
class ArrayType(VeloxType):
21572157
def __init__(self, arg0: VeloxType) -> None: ...
21582158
def element_type(self) -> VeloxType: ...
21592159
def kind(self) -> TypeKind: ...
21602160
def kind_name(self) -> str: ...
21612161
__pybind11_module_local_v4_clang_libstdcpp_cxxabi1002__ = ... # type: PyCapsule # value = <capsule object NULL at 0x7f50e2a69660>
21622162
pass
2163-
class VeloxFixedArrayType(VeloxType):
2163+
class FixedSizeArrayType(VeloxType):
21642164
def __init__(self, arg0: int, arg1: VeloxType) -> None: ...
21652165
def element_type(self) -> VeloxType: ...
21662166
def fixed_width(self) -> int: ...
21672167
def kind(self) -> TypeKind: ...
21682168
def kind_name(self) -> str: ...
21692169
__pybind11_module_local_v4_clang_libstdcpp_cxxabi1002__ = ... # type: PyCapsule # value = <capsule object NULL at 0x7f50e2a69780>
21702170
pass
2171-
class VeloxMapType(VeloxType):
2171+
class MapType(VeloxType):
21722172
def __init__(self, arg0: VeloxType, arg1: VeloxType) -> None: ...
21732173
def key_type(self) -> VeloxType: ...
21742174
def kind(self) -> TypeKind: ...
21752175
def kind_name(self) -> str: ...
21762176
def value_type(self) -> VeloxType: ...
21772177
__pybind11_module_local_v4_clang_libstdcpp_cxxabi1002__ = ... # type: PyCapsule # value = <capsule object NULL at 0x7f50e2a69c30>
21782178
pass
2179-
class VeloxRowType(VeloxType):
2179+
class RowType(VeloxType):
21802180
def __init__(self, arg0: List[str], arg1: List[VeloxType]) -> None: ...
21812181
def child_at(self, arg0: int) -> VeloxType: ...
21822182
def contains_child(self, arg0: str) -> bool: ...
@@ -2187,49 +2187,49 @@ class VeloxRowType(VeloxType):
21872187
def size(self) -> int: ...
21882188
__pybind11_module_local_v4_clang_libstdcpp_cxxabi1002__ = ... # type: PyCapsule # value = <capsule object NULL at 0x7f50e2a70120>
21892189
pass
2190-
class VeloxType_BIGINT(VeloxType):
2190+
class BigintType(VeloxType):
21912191
def __init__(self) -> None: ...
21922192
def kind(self) -> TypeKind: ...
21932193
def kind_name(self) -> str: ...
21942194
__pybind11_module_local_v4_clang_libstdcpp_cxxabi1002__ = ... # type: PyCapsule # value = <capsule object NULL at 0x7f50e2a51540>
21952195
pass
2196-
class VeloxType_BOOLEAN(VeloxType):
2196+
class BooleanType(VeloxType):
21972197
def __init__(self) -> None: ...
21982198
def kind(self) -> TypeKind: ...
21992199
def kind_name(self) -> str: ...
22002200
__pybind11_module_local_v4_clang_libstdcpp_cxxabi1002__ = ... # type: PyCapsule # value = <capsule object NULL at 0x7f50e2a5eea0>
22012201
pass
2202-
class VeloxType_DOUBLE(VeloxType):
2202+
class DoubleType(VeloxType):
22032203
def __init__(self) -> None: ...
22042204
def kind(self) -> TypeKind: ...
22052205
def kind_name(self) -> str: ...
22062206
__pybind11_module_local_v4_clang_libstdcpp_cxxabi1002__ = ... # type: PyCapsule # value = <capsule object NULL at 0x7f50e2a65540>
22072207
pass
2208-
class VeloxType_INTEGER(VeloxType):
2208+
class IntegerType(VeloxType):
22092209
def __init__(self) -> None: ...
22102210
def kind(self) -> TypeKind: ...
22112211
def kind_name(self) -> str: ...
22122212
__pybind11_module_local_v4_clang_libstdcpp_cxxabi1002__ = ... # type: PyCapsule # value = <capsule object NULL at 0x7f50e2a553f0>
22132213
pass
2214-
class VeloxType_REAL(VeloxType):
2214+
class RealType(VeloxType):
22152215
def __init__(self) -> None: ...
22162216
def kind(self) -> TypeKind: ...
22172217
def kind_name(self) -> str: ...
22182218
__pybind11_module_local_v4_clang_libstdcpp_cxxabi1002__ = ... # type: PyCapsule # value = <capsule object NULL at 0x7f50e2a627b0>
22192219
pass
2220-
class VeloxType_SMALLINT(VeloxType):
2220+
class SmallintType(VeloxType):
22212221
def __init__(self) -> None: ...
22222222
def kind(self) -> TypeKind: ...
22232223
def kind_name(self) -> str: ...
22242224
__pybind11_module_local_v4_clang_libstdcpp_cxxabi1002__ = ... # type: PyCapsule # value = <capsule object NULL at 0x7f50e2a59240>
22252225
pass
2226-
class VeloxType_TINYINT(VeloxType):
2226+
class TinyintType(VeloxType):
22272227
def __init__(self) -> None: ...
22282228
def kind(self) -> TypeKind: ...
22292229
def kind_name(self) -> str: ...
22302230
__pybind11_module_local_v4_clang_libstdcpp_cxxabi1002__ = ... # type: PyCapsule # value = <capsule object NULL at 0x7f50e2a5e090>
22312231
pass
2232-
class VeloxType_VARCHAR(VeloxType):
2232+
class VarcharType(VeloxType):
22332233
def __init__(self) -> None: ...
22342234
def kind(self) -> TypeKind: ...
22352235
def kind_name(self) -> str: ...
@@ -2265,94 +2265,94 @@ class fb_SentencePiece:
22652265
def process(self, arg0: str) -> List[str]: ...
22662266
pass
22672267
@overload
2268-
def Column(arg0: VeloxType_DOUBLE) -> SimpleColumnDOUBLE:
2268+
def Column(arg0: DoubleType) -> SimpleColumnDOUBLE:
22692269
pass
22702270
@overload
2271-
def Column(arg0: VeloxType_INTEGER) -> SimpleColumnINTEGER:
2271+
def Column(arg0: IntegerType) -> SimpleColumnINTEGER:
22722272
pass
22732273
@overload
2274-
def Column(arg0: VeloxType_INTEGER, arg1: list) -> SimpleColumnINTEGER:
2274+
def Column(arg0: IntegerType, arg1: list) -> SimpleColumnINTEGER:
22752275
pass
22762276
@overload
2277-
def Column(arg0: VeloxType_SMALLINT, arg1: tuple) -> SimpleColumnSMALLINT:
2277+
def Column(arg0: SmallintType, arg1: tuple) -> SimpleColumnSMALLINT:
22782278
pass
22792279
@overload
2280-
def Column(arg0: VeloxType_SMALLINT) -> SimpleColumnSMALLINT:
2280+
def Column(arg0: SmallintType) -> SimpleColumnSMALLINT:
22812281
pass
22822282
@overload
2283-
def Column(arg0: VeloxType_REAL, arg1: tuple) -> SimpleColumnREAL:
2283+
def Column(arg0: RealType, arg1: tuple) -> SimpleColumnREAL:
22842284
pass
22852285
@overload
2286-
def Column(arg0: VeloxRowType) -> RowColumn:
2286+
def Column(arg0: RowType) -> RowColumn:
22872287
pass
22882288
@overload
2289-
def Column(arg0: VeloxType_SMALLINT, arg1: list) -> SimpleColumnSMALLINT:
2289+
def Column(arg0: SmallintType, arg1: list) -> SimpleColumnSMALLINT:
22902290
pass
22912291
@overload
2292-
def Column(arg0: VeloxType_TINYINT, arg1: tuple) -> SimpleColumnTINYINT:
2292+
def Column(arg0: TinyintType, arg1: tuple) -> SimpleColumnTINYINT:
22932293
pass
22942294
@overload
2295-
def Column(arg0: VeloxFixedArrayType, arg1: list) -> ArrayColumn:
2295+
def Column(arg0: FixedSizeArrayType, arg1: list) -> ArrayColumn:
22962296
pass
22972297
@overload
2298-
def Column(arg0: VeloxType_BIGINT, arg1: tuple) -> SimpleColumnBIGINT:
2298+
def Column(arg0: BigintType, arg1: tuple) -> SimpleColumnBIGINT:
22992299
pass
23002300
@overload
2301-
def Column(arg0: VeloxArrayType) -> ArrayColumn:
2301+
def Column(arg0: ArrayType) -> ArrayColumn:
23022302
pass
23032303
@overload
2304-
def Column(arg0: VeloxType_DOUBLE, arg1: tuple) -> SimpleColumnDOUBLE:
2304+
def Column(arg0: DoubleType, arg1: tuple) -> SimpleColumnDOUBLE:
23052305
pass
23062306
@overload
2307-
def Column(arg0: VeloxArrayType, arg1: list) -> ArrayColumn:
2307+
def Column(arg0: ArrayType, arg1: list) -> ArrayColumn:
23082308
pass
23092309
@overload
2310-
def Column(arg0: VeloxType_BOOLEAN) -> SimpleColumnBOOLEAN:
2310+
def Column(arg0: BooleanType) -> SimpleColumnBOOLEAN:
23112311
pass
23122312
@overload
2313-
def Column(arg0: VeloxType_VARCHAR, arg1: tuple) -> SimpleColumnVARCHAR:
2313+
def Column(arg0: VarcharType, arg1: tuple) -> SimpleColumnVARCHAR:
23142314
pass
23152315
@overload
2316-
def Column(arg0: VeloxMapType) -> MapColumn:
2316+
def Column(arg0: MapType) -> MapColumn:
23172317
pass
23182318
@overload
2319-
def Column(arg0: VeloxType_TINYINT) -> SimpleColumnTINYINT:
2319+
def Column(arg0: TinyintType) -> SimpleColumnTINYINT:
23202320
pass
23212321
@overload
2322-
def Column(arg0: VeloxFixedArrayType) -> ArrayColumn:
2322+
def Column(arg0: FixedSizeArrayType) -> ArrayColumn:
23232323
pass
23242324
@overload
2325-
def Column(arg0: VeloxType_INTEGER, arg1: tuple) -> SimpleColumnINTEGER:
2325+
def Column(arg0: IntegerType, arg1: tuple) -> SimpleColumnINTEGER:
23262326
pass
23272327
@overload
2328-
def Column(arg0: VeloxType_REAL) -> SimpleColumnREAL:
2328+
def Column(arg0: RealType) -> SimpleColumnREAL:
23292329
pass
23302330
@overload
2331-
def Column(arg0: VeloxType_BIGINT) -> SimpleColumnBIGINT:
2331+
def Column(arg0: BigintType) -> SimpleColumnBIGINT:
23322332
pass
23332333
@overload
2334-
def Column(arg0: VeloxType_TINYINT, arg1: list) -> SimpleColumnTINYINT:
2334+
def Column(arg0: TinyintType, arg1: list) -> SimpleColumnTINYINT:
23352335
pass
23362336
@overload
2337-
def Column(arg0: VeloxType_DOUBLE, arg1: list) -> SimpleColumnDOUBLE:
2337+
def Column(arg0: DoubleType, arg1: list) -> SimpleColumnDOUBLE:
23382338
pass
23392339
@overload
2340-
def Column(arg0: VeloxType_BIGINT, arg1: list) -> SimpleColumnBIGINT:
2340+
def Column(arg0: BigintType, arg1: list) -> SimpleColumnBIGINT:
23412341
pass
23422342
@overload
2343-
def Column(arg0: VeloxType_REAL, arg1: list) -> SimpleColumnREAL:
2343+
def Column(arg0: RealType, arg1: list) -> SimpleColumnREAL:
23442344
pass
23452345
@overload
2346-
def Column(arg0: VeloxType_BOOLEAN, arg1: tuple) -> SimpleColumnBOOLEAN:
2346+
def Column(arg0: BooleanType, arg1: tuple) -> SimpleColumnBOOLEAN:
23472347
pass
23482348
@overload
2349-
def Column(arg0: VeloxType_VARCHAR) -> SimpleColumnVARCHAR:
2349+
def Column(arg0: VarcharType) -> SimpleColumnVARCHAR:
23502350
pass
23512351
@overload
2352-
def Column(arg0: VeloxType_VARCHAR, arg1: list) -> SimpleColumnVARCHAR:
2352+
def Column(arg0: VarcharType, arg1: list) -> SimpleColumnVARCHAR:
23532353
pass
23542354
@overload
2355-
def Column(arg0: VeloxType_BOOLEAN, arg1: list) -> SimpleColumnBOOLEAN:
2355+
def Column(arg0: BooleanType, arg1: list) -> SimpleColumnBOOLEAN:
23562356
pass
23572357
@overload
23582358
def ConstantColumn(arg0: handle, arg1: int, arg2: VeloxType) -> BaseColumn:
@@ -2361,28 +2361,28 @@ def ConstantColumn(arg0: handle, arg1: int, arg2: VeloxType) -> BaseColumn:
23612361
def ConstantColumn(arg0: handle, arg1: int) -> BaseColumn:
23622362
pass
23632363
@overload
2364-
def _import_from_arrow(arg0: VeloxType_SMALLINT, arg1: int, arg2: int) -> SimpleColumnSMALLINT:
2364+
def _import_from_arrow(arg0: SmallintType, arg1: int, arg2: int) -> SimpleColumnSMALLINT:
23652365
pass
23662366
@overload
2367-
def _import_from_arrow(arg0: VeloxType_DOUBLE, arg1: int, arg2: int) -> SimpleColumnDOUBLE:
2367+
def _import_from_arrow(arg0: DoubleType, arg1: int, arg2: int) -> SimpleColumnDOUBLE:
23682368
pass
23692369
@overload
2370-
def _import_from_arrow(arg0: VeloxType_TINYINT, arg1: int, arg2: int) -> SimpleColumnTINYINT:
2370+
def _import_from_arrow(arg0: TinyintType, arg1: int, arg2: int) -> SimpleColumnTINYINT:
23712371
pass
23722372
@overload
2373-
def _import_from_arrow(arg0: VeloxType_BOOLEAN, arg1: int, arg2: int) -> SimpleColumnBOOLEAN:
2373+
def _import_from_arrow(arg0: BooleanType, arg1: int, arg2: int) -> SimpleColumnBOOLEAN:
23742374
pass
23752375
@overload
2376-
def _import_from_arrow(arg0: VeloxType_INTEGER, arg1: int, arg2: int) -> SimpleColumnINTEGER:
2376+
def _import_from_arrow(arg0: IntegerType, arg1: int, arg2: int) -> SimpleColumnINTEGER:
23772377
pass
23782378
@overload
2379-
def _import_from_arrow(arg0: VeloxRowType, arg1: int, arg2: int) -> RowColumn:
2379+
def _import_from_arrow(arg0: RowType, arg1: int, arg2: int) -> RowColumn:
23802380
pass
23812381
@overload
2382-
def _import_from_arrow(arg0: VeloxType_BIGINT, arg1: int, arg2: int) -> SimpleColumnBIGINT:
2382+
def _import_from_arrow(arg0: BigintType, arg1: int, arg2: int) -> SimpleColumnBIGINT:
23832383
pass
23842384
@overload
2385-
def _import_from_arrow(arg0: VeloxType_REAL, arg1: int, arg2: int) -> SimpleColumnREAL:
2385+
def _import_from_arrow(arg0: RealType, arg1: int, arg2: int) -> SimpleColumnREAL:
23862386
pass
23872387
def _populate_dense_features_nopresence(arg0: RowColumn, arg1: int) -> None:
23882388
pass

0 commit comments

Comments
 (0)