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

DecimalArray #307

Merged
merged 38 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
97a37bc
wip
DerThorsten Dec 6, 2024
15cefc1
Merge remote-tracking branch 'upstream/main' into decimal
DerThorsten Dec 6, 2024
9dbbc94
decimals type itself
DerThorsten Dec 6, 2024
669716b
decimal array v0
DerThorsten Dec 9, 2024
1963681
...ignore
DerThorsten Dec 9, 2024
cb5db87
...ignore
DerThorsten Dec 9, 2024
ddd7df9
headers
DerThorsten Dec 9, 2024
89e8372
false positive warnings...
DerThorsten Dec 9, 2024
4adc712
false positive warnings.......
DerThorsten Dec 9, 2024
b58fc62
..
DerThorsten Dec 9, 2024
17b5f69
pow
DerThorsten Dec 9, 2024
48111ae
winci
DerThorsten Dec 10, 2024
b79a28a
clouless
DerThorsten Dec 10, 2024
ec36290
clouless
DerThorsten Dec 10, 2024
c69b048
fix
DerThorsten Dec 10, 2024
6b0e226
disable more
DerThorsten Dec 10, 2024
0e34bfe
fix tests
DerThorsten Dec 10, 2024
c2ab5a0
install boost
DerThorsten Dec 10, 2024
d4de2d8
fix
DerThorsten Dec 10, 2024
54dd0f2
use placeholder types
DerThorsten Dec 10, 2024
7373dbb
use placeholder types
DerThorsten Dec 10, 2024
51f3a97
exotic
DerThorsten Dec 10, 2024
eac9cd3
fix
DerThorsten Dec 10, 2024
cd09f02
fix
DerThorsten Dec 10, 2024
7700e54
cstdint
DerThorsten Dec 10, 2024
3d61e48
no boost
DerThorsten Dec 10, 2024
26ace9d
cleanup
DerThorsten Dec 16, 2024
d551cff
cleanup
DerThorsten Dec 16, 2024
6fa441a
Update include/sparrow/layout/decimal_array.hpp
DerThorsten Dec 16, 2024
658938d
Update include/sparrow/utils/large_int.hpp
DerThorsten Dec 16, 2024
7a13009
cleanup
DerThorsten Dec 16, 2024
8e2ed2e
cleanup
DerThorsten Dec 16, 2024
81f6cca
formated
DerThorsten Dec 16, 2024
48e2e0d
formated
DerThorsten Dec 16, 2024
a96118f
formating
DerThorsten Dec 16, 2024
8656fa8
formating
DerThorsten Dec 16, 2024
09ce390
formating
DerThorsten Dec 16, 2024
d5a7d3e
formating
DerThorsten Dec 16, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/qemu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ jobs:
-DUSE_DATE_POLYFILL=${{matrix.target.date-polyfill}} \
-DBUILD_TESTS=ON \
-DBUILD_EXAMPLES=ON \
-DUSE_LARGE_INT_PLACEHOLDERS=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache
cd build
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
matrix:
runs-on: [windows-latest]
toolchain:
- {compiler: msvc, date-polyfill: 'ON'}
- {compiler: msvc, date-polyfill: 'OFF'}
- {compiler: clang, date-polyfill: 'ON', version: 18}
- {compiler: clang, date-polyfill: 'OFF', version: 18}
- {compiler: msvc, date-polyfill: 'ON', use-large-int-placeholders: 'ON'}
- {compiler: msvc, date-polyfill: 'OFF', use-large-int-placeholders: 'ON'}
- {compiler: clang, date-polyfill: 'ON', version: 18, use-large-int-placeholders: 'ON'}
- {compiler: clang, date-polyfill: 'OFF', version: 18, use-large-int-placeholders: 'ON'}
target-arch:
- {
name: "Win64",
Expand Down Expand Up @@ -125,6 +125,7 @@ jobs:
echo "SPARROW_DEPS_PREFIX=$CONDA_PREFIX" >> $GITHUB_ENV
echo "SPARROW_INSTALL_PREFIX=$CONDA_PREFIX" >> $GITHUB_ENV
echo "SPARROW_ADDITIONAL_OPTIONS=-DSPARROW_TARGET_32BIT=OFF" >> $GITHUB_ENV


- name: Set dependencies install prefix dir for 32bit
if: matrix.target-arch.name == 'Win32'
Expand Down Expand Up @@ -174,6 +175,7 @@ jobs:
-DCMAKE_INSTALL_PREFIX=$SPARROW_INSTALL_PREFIX \
-DBUILD_TESTS=ON \
-DBUILD_EXAMPLES=ON \
-DUSE_LARGE_INT_PLACEHOLDERS=${{matrix.toolchain.use-large-int-placeholders}} \
-DUSE_DATE_POLYFILL=${{matrix.toolchain.date-polyfill}} \
$GENERATOR_EXTRA_FLAGS \
$SPARROW_CHECKS \
Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.5
hooks:
- id: clang-format
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ OPTION(BUILD_TESTS "Build sparrow test suite" OFF)
OPTION(BUILD_DOCS "Build sparrow documentation" OFF)
OPTION(BUILD_EXAMPLES "Build sparrow examples" OFF)
OPTION(USE_DATE_POLYFILL "Use date polyfill implementation" ON)
OPTION(USE_LARGE_INT_PLACEHOLDERS "use types without api for big integers" OFF)

OPTION(SPARROW_TARGET_32BIT "Test 32bit support" OFF)

Expand Down Expand Up @@ -131,6 +132,11 @@ if (USE_DATE_POLYFILL)
add_compile_definitions(SPARROW_USE_DATE_POLYFILL)
endif()

if(USE_LARGE_INT_PLACEHOLDERS)

add_compile_definitions(SPARROW_USE_LARGE_INT_PLACEHOLDERS)
endif()

# Build
# =====

Expand Down Expand Up @@ -230,6 +236,7 @@ else()
${SPARROW_SOURCE_DIR}/record_batch.cpp
${SPARROW_SOURCE_DIR}/run_encoded_array.cpp
${SPARROW_SOURCE_DIR}/struct_value.cpp
${SPARROW_SOURCE_DIR}/types/data_type.cpp
)
endif()

Expand Down
3 changes: 2 additions & 1 deletion include/sparrow/arrow_interface/arrow_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ namespace sparrow
SPARROW_API void release_arrow_array(ArrowArray* array);

/**
* Empty release function to use for the `ArrowArray.release` member. Should be used for view of ArrowArray.
* Empty release function to use for the `ArrowArray.release` member. Should be used for view of
* ArrowArray.
*/
SPARROW_API void empty_release_arrow_array(ArrowArray* array);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ namespace sparrow
case data_type::FLOAT:
case data_type::DOUBLE:
case data_type::TIMESTAMP:
case data_type::DECIMAL:
case data_type::DECIMAL32:
case data_type::DECIMAL64:
case data_type::DECIMAL128:
case data_type::DECIMAL256:
case data_type::LIST:
case data_type::STRUCT:
case data_type::STRING:
Expand Down
24 changes: 24 additions & 0 deletions include/sparrow/details/3rdparty/large_integers/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
BSD 2-Clause License

Copyright (c) 2016 - 2019, Kim Walisch.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
139 changes: 139 additions & 0 deletions include/sparrow/details/3rdparty/large_integers/int128_t.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// SPARROW: THIS HAS BEEN COPY-PASTED FROM https://github.com/kimwalisch/primesum/blob/master/include/int128_t.hpp
// PLEASE UPDATE THIS COMMENT IF YOU REPLACE THIS
// SEE README.md for rational
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification from the original:
// * disabled io operators
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// @file int128_t.hpp
/// @brief Support for int128_t, uint128_t types.
///
/// Copyright (C) 2018 Kim Walisch, <[email protected]>
///
/// This file is distributed under the BSD License. See the COPYING
/// file in the top level directory.
///

#ifndef INT128_T_HPP
#define INT128_T_HPP

#include <stdint.h>
#include <limits>
#include <type_traits>

/// The __int128_t type (GCC/Clang) is not well supported by
/// the C++ standard library (in 2016) so we have to define
/// some functions ourselves. We also define typedefs so we
/// can use int128_t instead of __int128_t. Once this is done
/// int128_t can be used like a regular integer type.
///
#if !defined(INT128_MAX) && \
defined(__SIZEOF_INT128__)

#include <ostream>
#include <string>

namespace primesum {

using int128_t = __int128_t;
using uint128_t = __uint128_t;

// inline std::ostream& operator<<(std::ostream& stream, uint128_t n)
// {
// std::string str;

// while (n > 0)
// {
// str += '0' + n % 10;
// n /= 10;
// }
// if (str.empty())
// str = "0";

// stream << std::string(str.rbegin(), str.rend());
// return stream;
// }

// inline std::ostream& operator<<(std::ostream& stream, int128_t n)
// {
// if (n < 0)
// {
// stream << "-";
// n = -n;
// }
// stream << (uint128_t) n;
// return stream;
// }

} // namespace

#endif

namespace primesum {

/// Portable namespace, includes functions which (unlike the versions
/// form the C++ standard library) work with the int128_t and
/// uint128_t types (2014).
///
namespace prt {

template <typename T>
struct numeric_limits
{
static constexpr T max()
{
return std::numeric_limits<T>::max();
}
};

template <>
struct numeric_limits<int128_t>
{
static constexpr int128_t min() { return ((int128_t) 1) << 127; }
static constexpr int128_t max() { return ~min(); }
};

template <>
struct numeric_limits<uint128_t>
{
static constexpr uint128_t min() { return 0; }
static constexpr uint128_t max() { return ~min(); }
};

template <typename T>
struct is_integral
{
enum
{
value = std::is_integral<T>::value ||
std::is_same<T, int128_t>::value ||
std::is_same<T, uint128_t>::value
};
};

template <typename T>
struct is_signed
{
enum
{
value = std::is_signed<T>::value ||
std::is_same<T, int128_t>::value
};
};

template <typename T>
struct is_unsigned
{
enum
{
value = std::is_unsigned<T>::value ||
std::is_same<T, uint128_t>::value
};
};

} // namespace prt
} // namespace primesum

#endif
Loading
Loading