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

Vectorized hash grouping by a single text column #7586

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions .unreleased/vectorized-text-grouping
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implements: #7586 Vectorized aggregation with grouping by a single text column.
2 changes: 1 addition & 1 deletion scripts/clang_format_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ SCRIPT_DIR=$(cd "$(dirname $0)" || exit; pwd)
BASE_DIR=$(dirname $SCRIPT_DIR)

find ${BASE_DIR} \( -path "${BASE_DIR}/src/*" -or -path "${BASE_DIR}/test/*" -or -path "${BASE_DIR}/tsl/*" \) \
-and -not \( -path "*/.*" -or -path "*CMake*" \) \
-and -not \( -path "*/.*" -or -path "*CMake*" -or -path "${BASE_DIR}/tsl/src/import/*" \) \
-and \( -name '*.c' -or -name '*.h' \) -print0 | xargs -0 ${SCRIPT_DIR}/clang_format_wrapper.sh -style=file -i
50 changes: 50 additions & 0 deletions tsl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,55 @@ if(COMPRESSION_FUZZING)
add_compile_definitions(TS_COMPRESSION_FUZZING=1)
endif()

# Check whether we can enable the pclmul instruction required for the UMASH
# hashing on amd64. Shouldn't be done if the user has manually specified the
# target architecture, no idea how to detect this, but at least we shouldn't do
# this when cross-compiling.
if(NOT CMAKE_CROSSCOMPILING)
check_c_compiler_flag(-mpclmul CC_PCLMUL)
if(CC_PCLMUL)
add_compile_options(-mpclmul)
# The "C source compiles" check below doesn't use the global compilation
# flags, so we have to modify its flags separately.
set(CMAKE_REQUIRED_FLAGS -mpclmul)
endif()
endif()

# Detect if we can compile UMASH on this platform. It is not tested on Windows
# and leads to a weird CI freeze, so don't even try for now.
if(NOT WIN32)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
check_c_source_compiles(
"
#if defined(__PCLMUL__)
#include <stdint.h>
#include <immintrin.h>
/*
* For some reason, this doesn't compile on our i386 CI, but I also can't detect
* it using the standard condition of defined(__x86_64__) && !defined(__ILP32__),
* as described at https://wiki.debian.org/X32Port .
*/
void test() { (void) _mm_cvtsi64_si128((uint64_t) 0); }
#elif defined(__ARM_FEATURE_CRYPTO)
#else
#error Unsupported platform for UMASH
#endif
"
UMASH_SUPPORTED)
unset(CMAKE_REQUIRED_FLAGS)
unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
else()
set(UMASH_SUPPORTED CACHE OFF)
endif()

option(USE_UMASH
"Use the UMASH hash for string and multi-column vectorized grouping"
${UMASH_SUPPORTED})

if(USE_UMASH)
add_compile_definitions(TS_USE_UMASH)
endif()

# Add the subdirectories
add_subdirectory(test)
add_subdirectory(src)
17 changes: 15 additions & 2 deletions tsl/src/import/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
set(SOURCES "")
target_sources(${PROJECT_NAME} PRIVATE ${SOURCES})
set(SOURCES)

if(USE_UMASH)
list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/umash.c)
endif()

if(SOURCES)
# Disable clang-tidy for imported code
add_library(target_no_static_code_analysis OBJECT ${SOURCES})
set_target_properties(target_no_static_code_analysis PROPERTIES C_CLANG_TIDY
"")

target_link_libraries(${TSL_LIBRARY_NAME}
$<TARGET_OBJECTS:target_no_static_code_analysis>)
endif()
Loading
Loading