Skip to content

Commit dc7426c

Browse files
authored
Remove vendored pyarrow code and upgrade arrow to 19 (#507)
* Remove vendored pyarrow code Signed-off-by: Arham Chopra <arham.chopra@cubistsystematic.com> * Pin cmake version<3.27 to enable vcpkg build Signed-off-by: Arham Chopra <arham.chopra@cubistsystematic.com> * Upgrade vcpkg, and pin arrow to 19.0.1 in vcpkg.json Signed-off-by: Arham Chopra <arham.chopra@cubistsystematic.com> * Upgrade arrow pin to <20 in conda, pyproject.toml Signed-off-by: Arham Chopra <arham.chopra@cubistsystematic.com> * Address comments Signed-off-by: Arham Chopra <arham.chopra@cubistsystematic.com> --------- Signed-off-by: Arham Chopra <arham.chopra@cubistsystematic.com>
1 parent adc59c5 commit dc7426c

71 files changed

Lines changed: 15 additions & 17259 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

conda/dev-environment-unix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies:
1616
- graphviz
1717
- gtest
1818
- httpx>=0.20,<1
19-
- libarrow=16
19+
- libarrow<20
2020
- libboost>=1.80.0
2121
- libboost-headers>=1.80.0
2222
- librdkafka
@@ -31,7 +31,7 @@ dependencies:
3131
- pillow
3232
- polars
3333
- psutil
34-
- pyarrow>=15,<19
34+
- pyarrow>=15,<20
3535
- pydantic>=2
3636
- pytest
3737
- pytest-asyncio

conda/dev-environment-win.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies:
1616
- graphviz
1717
- gtest
1818
- httpx>=0.20,<1
19-
- libarrow=16
19+
- libarrow<20
2020
- libboost>=1.80.0
2121
- libboost-headers>=1.80.0
2222
- librdkafka
@@ -31,7 +31,7 @@ dependencies:
3131
- pillow
3232
- polars
3333
- psutil
34-
- pyarrow>=7,<19
34+
- pyarrow>=15,<20
3535
- pydantic>=2
3636
- pytest
3737
- pytest-asyncio

cpp/csp/adapters/parquet/ParquetFileWriterWrapper.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ void ParquetFileWriterWrapper::openImpl( const std::string &fileName, const std:
2121
::parquet::ArrowWriterProperties::Builder arrowBuilder;
2222
arrowBuilder.store_schema();
2323

24-
STATUS_OK_OR_THROW_RUNTIME(
25-
::parquet::arrow::FileWriter::Open( *getSchema(), arrow::default_memory_pool(), m_outputStream, builder.build(), arrowBuilder.build(),
26-
&m_fileWriter ),
27-
"Failed to open parquet file writer" );
24+
auto res = ::parquet::arrow::FileWriter::Open( *getSchema(), arrow::default_memory_pool(), m_outputStream, builder.build(), arrowBuilder.build() );
25+
STATUS_OK_OR_THROW_RUNTIME( res.status(), "Failed to open parquet file writer" );
26+
m_fileWriter = res.MoveValueUnsafe();
2827
}
2928

3029
void ParquetFileWriterWrapper::close()

cpp/csp/python/adapters/CMakeLists.txt

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,9 @@ if(CSP_BUILD_KAFKA_ADAPTER)
66
endif()
77

88
if(CSP_BUILD_PARQUET_ADAPTER)
9-
set(VENDORED_PYARROW_ROOT "${CMAKE_SOURCE_DIR}/cpp/csp/python/adapters/vendored/pyarrow-16.0.0/")
10-
set(ARROW_PYTHON_SRCS
11-
${VENDORED_PYARROW_ROOT}/arrow/python/arrow_to_pandas.cc
12-
${VENDORED_PYARROW_ROOT}/arrow/python/benchmark.cc
13-
${VENDORED_PYARROW_ROOT}/arrow/python/common.cc
14-
${VENDORED_PYARROW_ROOT}/arrow/python/datetime.cc
15-
${VENDORED_PYARROW_ROOT}/arrow/python/decimal.cc
16-
${VENDORED_PYARROW_ROOT}/arrow/python/deserialize.cc
17-
${VENDORED_PYARROW_ROOT}/arrow/python/extension_type.cc
18-
${VENDORED_PYARROW_ROOT}/arrow/python/gdb.cc
19-
${VENDORED_PYARROW_ROOT}/arrow/python/helpers.cc
20-
${VENDORED_PYARROW_ROOT}/arrow/python/inference.cc
21-
${VENDORED_PYARROW_ROOT}/arrow/python/init.cc
22-
${VENDORED_PYARROW_ROOT}/arrow/python/io.cc
23-
${VENDORED_PYARROW_ROOT}/arrow/python/ipc.cc
24-
${VENDORED_PYARROW_ROOT}/arrow/python/numpy_convert.cc
25-
${VENDORED_PYARROW_ROOT}/arrow/python/numpy_to_arrow.cc
26-
${VENDORED_PYARROW_ROOT}/arrow/python/python_to_arrow.cc
27-
${VENDORED_PYARROW_ROOT}/arrow/python/pyarrow.cc
28-
${VENDORED_PYARROW_ROOT}/arrow/python/serialize.cc
29-
${VENDORED_PYARROW_ROOT}/arrow/python/csv.cc
30-
${VENDORED_PYARROW_ROOT}/arrow/python/filesystem.cc)
31-
add_library(parquetadapterimpl SHARED parquetadapterimpl.cpp ${ARROW_PYTHON_SRCS})
32-
# Ignore warning regarding static datetime API initialization coming from vendored Arrow code
33-
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
34-
set_target_properties(parquetadapterimpl PROPERTIES COMPILE_OPTIONS "-Wno-unused-variable")
35-
endif()
9+
add_library(parquetadapterimpl SHARED parquetadapterimpl.cpp)
3610
target_link_libraries(parquetadapterimpl csp_core csp_engine cspimpl csp_parquet_adapter)
37-
target_include_directories(parquetadapterimpl PUBLIC ${ARROW_INCLUDE_DIR} ${PARQUET_INCLUDE_DIR} "${VENDORED_PYARROW_ROOT}")
38-
target_compile_definitions(parquetadapterimpl PUBLIC ARROW_PYTHON_STATIC)
11+
target_include_directories(parquetadapterimpl PUBLIC ${ARROW_INCLUDE_DIR} ${PARQUET_INCLUDE_DIR})
3912
install(TARGETS parquetadapterimpl RUNTIME DESTINATION ${CSP_RUNTIME_INSTALL_SUBDIR} )
4013
endif()
4114

cpp/csp/python/adapters/parquetadapterimpl.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <csp/python/PyCppNode.h>
1818
#include <csp/python/PyNodeWrapper.h>
1919
#include <csp/python/NumpyConversions.h>
20-
#include <arrow/python/pyarrow.h>
2120
#include <arrow/io/memory.h>
2221
#include <arrow/ipc/reader.h>
2322
#include <locale>
@@ -77,21 +76,6 @@ REGISTER_CPPNODE( csp::cppnodes, parquet_dict_basket_writer );
7776
namespace
7877
{
7978

80-
struct PyArrowInitializer
81-
{
82-
static inline bool ensureInitialized()
83-
{
84-
static bool initialized = false;
85-
if( unlikely( !initialized ) )
86-
{
87-
if( arrow::py::import_pyarrow() != 0 )
88-
CSP_THROW( csp::python::PythonPassthrough, "" );
89-
initialized = true;
90-
}
91-
return initialized;
92-
}
93-
};
94-
9579
class FileNameGenerator : public csp::Generator<std::string, csp::DateTime, csp::DateTime>
9680
{
9781
public:
@@ -145,7 +129,6 @@ class ArrowTableGenerator : public csp::Generator<std::shared_ptr<arrow::Table>,
145129
ArrowTableGenerator( PyObject *wrappedGenerator )
146130
: m_wrappedGenerator( csp::python::PyObjectPtr::incref( wrappedGenerator ) )
147131
{
148-
PyArrowInitializer::ensureInitialized();
149132
}
150133

151134
void init( csp::DateTime start, csp::DateTime end ) override

cpp/csp/python/adapters/vendored/pyarrow-16.0.0/arrow/python/CMakeLists.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

cpp/csp/python/adapters/vendored/pyarrow-16.0.0/arrow/python/api.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)