Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate slowdown in 4.5.8 #396

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 0 additions & 108 deletions .github/workflows/ci.yml

This file was deleted.

103 changes: 53 additions & 50 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,55 +17,55 @@ defaults:
shell: bash -el {0}

jobs:
macos-tests:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.9', '3.10', '3.11']
PYARROW_VERSION: ['10.0.1']
include:
- PYTHON_VERSION: "3.10"
PYARROW_VERSION: "9.0.0"
- PYTHON_VERSION: "3.11"
PYARROW_VERSION: "12.0.0"
- PYTHON_VERSION: "3.11"
PYARROW_VERSION: "13.0.0"
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
submodules: true
- name: Fetch full git history
run: git fetch --prune --unshallow
- name: Set up Conda env
uses: mamba-org/provision-with-micromamba@e2b397b12d0a38069451664382b769c9456e3d6d
with:
condarc-file: .github/workflows/.condarc
cache-env: true
extra-specs: |
python=${{ matrix.PYTHON_VERSION }}
pyarrow=${{ matrix.PYARROW_VERSION }}
pytest-md
pytest-emoji
- name: Build with CMake
run: |
mkdir build && \
cd build && \
cmake -DBOOST_ROOT=${CONDA_PREFIX} -DBUILD_COVERAGE=ON \
-DCMAKE_INSTALL_PREFIX=./dist \
-DPYTHON_EXECUTABLE=$(which python) \
-GNinja .. && \
ninja && \
cmake --build . --target install
- name: Install repository
run: |
cd build/dist && python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e .
- name: Test import
run: |
cd /
python -c 'import turbodbc'
python -c "import turbodbc.arrow_support"
# macos-tests:
# runs-on: macos-latest
# strategy:
# fail-fast: false
# matrix:
# PYTHON_VERSION: ['3.9', '3.10', '3.11']
# PYARROW_VERSION: ['10.0.1']
# include:
# - PYTHON_VERSION: "3.10"
# PYARROW_VERSION: "9.0.0"
# - PYTHON_VERSION: "3.11"
# PYARROW_VERSION: "12.0.0"
# - PYTHON_VERSION: "3.11"
# PYARROW_VERSION: "13.0.0"
# steps:
# - name: Checkout branch
# uses: actions/checkout@v3
# with:
# submodules: true
# - name: Fetch full git history
# run: git fetch --prune --unshallow
# - name: Set up Conda env
# uses: mamba-org/provision-with-micromamba@e2b397b12d0a38069451664382b769c9456e3d6d
# with:
# condarc-file: .github/workflows/.condarc
# cache-env: true
# extra-specs: |
# python=${{ matrix.PYTHON_VERSION }}
# pyarrow=${{ matrix.PYARROW_VERSION }}
# pytest-md
# pytest-emoji
# - name: Build with CMake
# run: |
# mkdir build && \
# cd build && \
# cmake -DBOOST_ROOT=${CONDA_PREFIX} -DBUILD_COVERAGE=ON \
# -DCMAKE_INSTALL_PREFIX=./dist \
# -DPYTHON_EXECUTABLE=$(which python) \
# -GNinja .. && \
# ninja && \
# cmake --build . --target install
# - name: Install repository
# run: |
# cd build/dist && python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e .
# - name: Test import
# run: |
# cd /
# python -c 'import turbodbc'
# python -c "import turbodbc.arrow_support"
windows-tests:
runs-on: windows-latest
defaults:
Expand Down Expand Up @@ -127,8 +127,11 @@ jobs:
dir src
dir src\turbodbc_arrow
if %errorlevel% neq 0 exit /b %errorlevel%
python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e .
set "BOOST_ROOT=%CONDA_PREFIX%\Library"
python -m pip install --no-build-isolation --no-deps --disable-pip-version-check .
if %errorlevel% neq 0 exit /b %errorlevel%
@CALL micromamba install build
python -m build --outdir ./dist
- name: Test import
run: |
@CALL micromamba activate turbodbc
Expand Down
8 changes: 8 additions & 0 deletions cmake_scripts/default_build_setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,11 @@ add_custom_target(refresh_cmake_configuration
cmake -E touch ${CMAKE_PARENT_LIST_FILE} # make cmake detect configuration is changed on NEXT build
COMMENT "Forcing refreshing of the CMake configuration. This allows to use globbing safely."
)

if(WIN32)
add_definitions("-std=c++17")
link_directories("$ENV{PYTHON}/libs")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS "TRUE")
# set(Boost_USE_STATIC_RUNTIME "ON")
# set(Boost_USE_STATIC_LIBS "ON")
endif()
3 changes: 3 additions & 0 deletions cpp/cpp_odbc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
find_package(Boost REQUIRED COMPONENTS locale)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})

find_package(odbc REQUIRED)
include_directories(SYSTEM ${Odbc_INCLUDE_DIR})

Expand Down
9 changes: 8 additions & 1 deletion cpp/cpp_odbc/Library/src/level2/level1_connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <locale>
#include <sstream>

#include <boost/locale.hpp>

namespace impl {

template <typename Output_Handle, typename Input_Handle>
Expand Down Expand Up @@ -430,7 +432,12 @@ column_description level1_connector::do_describe_column_wide(statement_handle co

impl::throw_on_error(return_code, *this, handle);

std::string const utf8_name = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.to_bytes(name);
// TODO-Simeon: throws
// throw std::invalid_argument("Simeon conversion in level1_connector");
// TODO-Simeon: throws

//std::string const utf8_name = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.to_bytes(name);
auto const utf8_name = boost::locale::conv::utf_to_utf<char>(static_cast<std::u16string>(name));
return {utf8_name, data_type, size, decimal_digits, allows_nullable};
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/turbodbc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
find_package(Boost REQUIRED COMPONENTS system date_time)
find_package(Boost REQUIRED COMPONENTS system date_time locale)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})

find_package(odbc REQUIRED)
Expand Down
2 changes: 2 additions & 0 deletions cpp/turbodbc/Library/src/connect.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "turbodbc/connect.h"
#include <cpp_odbc/make_environment.h>

using namespace std;

turbodbc::connection turbodbc::connect(std::string const & connection_string, options options)
{
auto environment = cpp_odbc::make_environment();
Expand Down
11 changes: 9 additions & 2 deletions cpp/turbodbc/Library/src/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@
#include <sstream>
#include <codecvt>

#include <boost/locale.hpp>

namespace {

std::u16string as_utf16(std::string utf8_encoded) {
// TODO-Simeon: throws
// throw std::invalid_argument("Simeon conversion in cursor");
// TODO-Simeon: throws

// not all compilers support the new C++11 conversion facets
static std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> converter;
return converter.from_bytes(utf8_encoded);
return boost::locale::conv::utf_to_utf<char16_t>(utf8_encoded);
//static std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> converter;
//return converter.from_bytes(utf8_encoded);
}

}
Expand Down
6 changes: 6 additions & 0 deletions cpp/turbodbc_arrow/Library/src/arrow_result_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <codecvt>
#include <vector>

#include <boost/locale.hpp>

using arrow::default_memory_pool;
using arrow::AdaptiveIntBuilder;
using arrow::ArrayBuilder;
Expand Down Expand Up @@ -127,7 +129,11 @@ Status AppendUnicodeStringsToBuilder(size_t rows_in_batch, BuilderType& builder,
if (element.indicator == SQL_NULL_DATA) {
ARROW_RETURN_NOT_OK(builder.AppendNullProxy());
} else {
// TODO-Simeon: throws
// throw std::invalid_argument("Simeon conversion in arrow_result_set");
// TODO-Simeon: throws
std::u16string str_u16(reinterpret_cast<const char16_t*>(element.data_pointer), element.indicator / 2);
//std::string u8string = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.to_bytes(str_u16);
std::string u8string = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.to_bytes(str_u16);
ARROW_RETURN_NOT_OK(builder.AppendProxy(u8string.data(), u8string.size()));
}
Expand Down
2 changes: 2 additions & 0 deletions cpp/turbodbc_arrow/Library/src/set_arrow_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <ciso646>
#include <codecvt>

#include <boost/locale.hpp>

using arrow::BooleanArray;
using arrow::BinaryArray;
using arrow::ChunkedArray;
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
dependencies:
- python>=3.9
- pyarrow>=7.0,<14
- sel(unix): unixodbc
# - sel(unix): unixodbc
- c-compiler
- cxx-compiler
- gmock=1.10.0
Expand Down
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ def __str__(self):
extra_compile_args.append("/std:c++17")
boost_root = os.getenv("BOOST_ROOT")
if boost_root:
# raise Exception("Hey")
library_dirs.append(boost_root)
library_dirs.append(os.path.join(boost_root, "lib"))

include_dirs.append(boost_root)
library_dirs.append(boost_root)
library_dirs.append(os.path.join(boost_root, "stage", "lib"))
library_dirs.append(os.path.join(boost_root, "lib64-msvc-14.0"))
else:
Expand Down
Loading
Loading