diff --git a/.github/actions/manylinux_2014_setup/action.yml b/.github/actions/manylinux_2014_setup/action.yml
index 71bb3f0a..5efb89ae 100644
--- a/.github/actions/manylinux_2014_setup/action.yml
+++ b/.github/actions/manylinux_2014_setup/action.yml
@@ -108,4 +108,4 @@ runs:
uses: hendrikmuhs/ccache-action@v1.2.11 # Note: pinned due to GLIBC incompatibility in later releases
with:
key: ${{ github.job }}
- save: ${{ github.ref == 'refs/heads/main' || github.repository != 'duckdb/duckdb-java' }}
\ No newline at end of file
+ save: ${{ github.ref == 'refs/heads/main' || github.repository != 'duckdb/duckdb-java' }}
diff --git a/.github/workflows/Java.yml b/.github/workflows/Java.yml
index 088dbedd..7db850fa 100644
--- a/.github/workflows/Java.yml
+++ b/.github/workflows/Java.yml
@@ -26,7 +26,7 @@ jobs:
name: Java Linux (amd64)
runs-on: ubuntu-latest
container:
- image: quay.io/pypa/manylinux2014_x86_64
+ image: quay.io/pypa/manylinux_2_28_x86_64
env:
GEN: ninja
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
@@ -71,7 +71,7 @@ jobs:
name: Java Linux (aarch64)
runs-on: ubuntu-latest
container:
- image: ubuntu:18.04
+ image: ubuntu:20.04
needs: java-linux-amd64
env:
GEN: ninja
@@ -239,8 +239,8 @@ jobs:
- name: Combine JARs
shell: bash
run: |
- mkdir -p ~/.gnupg
- echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf
+ mkdir -m 700 -p ~/.gnupg
+ echo -e "passphrase asdf\npinentry-mode loopback\nno-tty\nbatch\n" > ~/.gnupg/gpg.conf
if [[ "$GITHUB_REF" =~ ^(refs/heads/main|refs/tags/v.+)$ && "$GITHUB_REPOSITORY" = "duckdb/duckdb-java" ]] ; then
export XML='
'
mkdir ~/.m2
- echo $XML | sed "s/PASSWORD/${{ secrets.MAVEN_PASSWORD }}/" > ~/.m2/settings.xml
+ echo $XML | sed "s|PASSWORD|${{ secrets.MAVEN_PASSWORD }}|" > ~/.m2/settings.xml
echo "${{ secrets.MAVEN_PGP_PK }}" | base64 -d > maven_pgp_key
gpg --batch --import maven_pgp_key
python scripts/jdbc_maven_deploy.py ${{ github.ref_name }} jdbc-artifacts .
@@ -276,7 +276,7 @@ jobs:
runs-on: ubuntu-20.04
if: ${{ inputs.skip_tests != 'true' }}
needs: java-linux-amd64
- container: quay.io/pypa/manylinux2014_x86_64
+ container: quay.io/pypa/manylinux_2_28_x86_64
env:
BUILD_JDBC: 1
GEN: ninja
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b65f369d..3a00fbdc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,13 +19,13 @@ project(DuckDBJava)
include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
-include_directories(src/duckdb/src/include src/duckdb/third_party/concurrentqueue src/duckdb/third_party/fast_float src/duckdb/third_party/fastpforlib src/duckdb/third_party/fmt/include src/duckdb/third_party/fsst src/duckdb/third_party/httplib src/duckdb/third_party/hyperloglog src/duckdb/third_party/jaro_winkler src/duckdb/third_party/jaro_winkler/details src/duckdb/third_party/libpg_query src/duckdb/third_party/libpg_query/include src/duckdb/third_party/lz4 src/duckdb/third_party/brotli/include src/duckdb/third_party/brotli/common src/duckdb/third_party/brotli/dec src/duckdb/third_party/brotli/enc src/duckdb/third_party/mbedtls src/duckdb/third_party/mbedtls/include src/duckdb/third_party/mbedtls/library src/duckdb/third_party/miniz src/duckdb/third_party/pcg src/duckdb/third_party/re2 src/duckdb/third_party/skiplist src/duckdb/third_party/tdigest src/duckdb/third_party/utf8proc src/duckdb/third_party/utf8proc/include src/duckdb/third_party/yyjson/include src/duckdb/extension/parquet/include src/duckdb/third_party/parquet src/duckdb/third_party/thrift src/duckdb/third_party/lz4 src/duckdb/third_party/brotli/include src/duckdb/third_party/brotli/common src/duckdb/third_party/brotli/dec src/duckdb/third_party/brotli/enc src/duckdb/third_party/snappy src/duckdb/third_party/zstd/include src/duckdb/third_party/mbedtls src/duckdb/third_party/mbedtls/include src/duckdb/extension/icu/include src/duckdb/extension/icu/third_party/icu/common src/duckdb/extension/icu/third_party/icu/i18n src/duckdb/extension/json/include)
-add_definitions(-DDUCKDB_EXTENSION_PARQUET_LINKED -DDUCKDB_EXTENSION_ICU_LINKED -DDUCKDB_EXTENSION_JSON_LINKED)
+include_directories(src/duckdb/src/include src/duckdb/third_party/concurrentqueue src/duckdb/third_party/fast_float src/duckdb/third_party/fastpforlib src/duckdb/third_party/fmt/include src/duckdb/third_party/fsst src/duckdb/third_party/httplib src/duckdb/third_party/hyperloglog src/duckdb/third_party/jaro_winkler src/duckdb/third_party/jaro_winkler/details src/duckdb/third_party/libpg_query src/duckdb/third_party/libpg_query/include src/duckdb/third_party/lz4 src/duckdb/third_party/brotli/include src/duckdb/third_party/brotli/common src/duckdb/third_party/brotli/dec src/duckdb/third_party/brotli/enc src/duckdb/third_party/mbedtls src/duckdb/third_party/mbedtls/include src/duckdb/third_party/mbedtls/library src/duckdb/third_party/miniz src/duckdb/third_party/pcg src/duckdb/third_party/re2 src/duckdb/third_party/skiplist src/duckdb/third_party/tdigest src/duckdb/third_party/utf8proc src/duckdb/third_party/utf8proc/include src/duckdb/third_party/yyjson/include src/duckdb/third_party/zstd/include src/duckdb/extension/core_functions/include src/duckdb/extension/parquet/include src/duckdb/third_party/parquet src/duckdb/third_party/thrift src/duckdb/third_party/lz4 src/duckdb/third_party/brotli/include src/duckdb/third_party/brotli/common src/duckdb/third_party/brotli/dec src/duckdb/third_party/brotli/enc src/duckdb/third_party/snappy src/duckdb/third_party/mbedtls src/duckdb/third_party/mbedtls/include src/duckdb/third_party/zstd/include src/duckdb/extension/icu/include src/duckdb/extension/icu/third_party/icu/common src/duckdb/extension/icu/third_party/icu/i18n src/duckdb/extension/json/include)
+add_definitions(-DDUCKDB_EXTENSION_CORE_FUNCTIONS_LINKED -DDUCKDB_EXTENSION_PARQUET_LINKED -DDUCKDB_EXTENSION_ICU_LINKED -DDUCKDB_EXTENSION_JSON_LINKED)
add_definitions(-DDUCKDB_EXTENSION_AUTOLOAD_DEFAULT=1 -DDUCKDB_EXTENSION_AUTOINSTALL_DEFAULT=1)
file(GLOB_RECURSE JAVA_SRC_FILES src/main/java/org/duckdb/*.java)
file(GLOB_RECURSE JAVA_TEST_FILES src/test/java/org/duckdb/*.java)
-set(DUCKDB_SRC_FILES src/duckdb/ub_src_catalog.cpp src/duckdb/ub_src_catalog_catalog_entry.cpp src/duckdb/ub_src_catalog_catalog_entry_dependency.cpp src/duckdb/ub_src_catalog_default.cpp src/duckdb/ub_src_common_adbc.cpp src/duckdb/ub_src_common_adbc_nanoarrow.cpp src/duckdb/ub_src_common.cpp src/duckdb/ub_src_common_arrow_appender.cpp src/duckdb/ub_src_common_arrow.cpp src/duckdb/ub_src_common_crypto.cpp src/duckdb/ub_src_common_enums.cpp src/duckdb/ub_src_common_exception.cpp src/duckdb/ub_src_common_operator.cpp src/duckdb/ub_src_common_progress_bar.cpp src/duckdb/ub_src_common_row_operations.cpp src/duckdb/ub_src_common_serializer.cpp src/duckdb/ub_src_common_sort.cpp src/duckdb/ub_src_common_tree_renderer.cpp src/duckdb/ub_src_common_types.cpp src/duckdb/ub_src_common_types_column.cpp src/duckdb/ub_src_common_types_row.cpp src/duckdb/ub_src_common_value_operations.cpp src/duckdb/src/common/vector_operations/boolean_operators.cpp src/duckdb/src/common/vector_operations/comparison_operators.cpp src/duckdb/src/common/vector_operations/generators.cpp src/duckdb/src/common/vector_operations/is_distinct_from.cpp src/duckdb/src/common/vector_operations/null_operations.cpp src/duckdb/src/common/vector_operations/numeric_inplace_operators.cpp src/duckdb/src/common/vector_operations/vector_cast.cpp src/duckdb/src/common/vector_operations/vector_copy.cpp src/duckdb/src/common/vector_operations/vector_hash.cpp src/duckdb/src/common/vector_operations/vector_storage.cpp src/duckdb/ub_src_core_functions_aggregate_algebraic.cpp src/duckdb/ub_src_core_functions_aggregate_distributive.cpp src/duckdb/ub_src_core_functions_aggregate_holistic.cpp src/duckdb/ub_src_core_functions_aggregate_nested.cpp src/duckdb/ub_src_core_functions_aggregate_regression.cpp src/duckdb/ub_src_core_functions.cpp src/duckdb/ub_src_core_functions_scalar_array.cpp src/duckdb/ub_src_core_functions_scalar_bit.cpp src/duckdb/ub_src_core_functions_scalar_blob.cpp src/duckdb/ub_src_core_functions_scalar_date.cpp src/duckdb/ub_src_core_functions_scalar_debug.cpp src/duckdb/ub_src_core_functions_scalar_enum.cpp src/duckdb/ub_src_core_functions_scalar_generic.cpp src/duckdb/ub_src_core_functions_scalar_list.cpp src/duckdb/ub_src_core_functions_scalar_map.cpp src/duckdb/ub_src_core_functions_scalar_math.cpp src/duckdb/ub_src_core_functions_scalar_operators.cpp src/duckdb/ub_src_core_functions_scalar_random.cpp src/duckdb/ub_src_core_functions_scalar_string.cpp src/duckdb/ub_src_core_functions_scalar_struct.cpp src/duckdb/ub_src_core_functions_scalar_union.cpp src/duckdb/ub_src_execution.cpp src/duckdb/ub_src_execution_expression_executor.cpp src/duckdb/ub_src_execution_index_art.cpp src/duckdb/ub_src_execution_index.cpp src/duckdb/ub_src_execution_nested_loop_join.cpp src/duckdb/ub_src_execution_operator_aggregate.cpp src/duckdb/ub_src_execution_operator_csv_scanner_buffer_manager.cpp src/duckdb/ub_src_execution_operator_csv_scanner_scanner.cpp src/duckdb/ub_src_execution_operator_csv_scanner_sniffer.cpp src/duckdb/ub_src_execution_operator_csv_scanner_state_machine.cpp src/duckdb/ub_src_execution_operator_csv_scanner_table_function.cpp src/duckdb/ub_src_execution_operator_csv_scanner_util.cpp src/duckdb/ub_src_execution_operator_filter.cpp src/duckdb/ub_src_execution_operator_helper.cpp src/duckdb/ub_src_execution_operator_join.cpp src/duckdb/ub_src_execution_operator_order.cpp src/duckdb/ub_src_execution_operator_persistent.cpp src/duckdb/ub_src_execution_operator_projection.cpp src/duckdb/ub_src_execution_operator_scan.cpp src/duckdb/ub_src_execution_operator_schema.cpp src/duckdb/ub_src_execution_operator_set.cpp src/duckdb/ub_src_execution_physical_plan.cpp src/duckdb/ub_src_function_aggregate_distributive.cpp src/duckdb/ub_src_function_aggregate.cpp src/duckdb/ub_src_function.cpp src/duckdb/ub_src_function_cast.cpp src/duckdb/ub_src_function_cast_union.cpp src/duckdb/ub_src_function_pragma.cpp src/duckdb/ub_src_function_scalar_compressed_materialization.cpp src/duckdb/ub_src_function_scalar.cpp src/duckdb/ub_src_function_scalar_generic.cpp src/duckdb/ub_src_function_scalar_list.cpp src/duckdb/ub_src_function_scalar_operators.cpp src/duckdb/ub_src_function_scalar_sequence.cpp src/duckdb/ub_src_function_scalar_string.cpp src/duckdb/ub_src_function_scalar_string_regexp.cpp src/duckdb/ub_src_function_scalar_struct.cpp src/duckdb/ub_src_function_scalar_system.cpp src/duckdb/ub_src_function_table_arrow.cpp src/duckdb/ub_src_function_table.cpp src/duckdb/ub_src_function_table_system.cpp src/duckdb/ub_src_function_table_version.cpp src/duckdb/ub_src_main.cpp src/duckdb/ub_src_main_buffered_data.cpp src/duckdb/ub_src_main_capi.cpp src/duckdb/ub_src_main_capi_cast.cpp src/duckdb/ub_src_main_chunk_scan_state.cpp src/duckdb/ub_src_main_extension.cpp src/duckdb/ub_src_main_relation.cpp src/duckdb/ub_src_main_secret.cpp src/duckdb/ub_src_main_settings.cpp src/duckdb/ub_src_optimizer.cpp src/duckdb/ub_src_optimizer_compressed_materialization.cpp src/duckdb/ub_src_optimizer_join_order.cpp src/duckdb/ub_src_optimizer_matcher.cpp src/duckdb/ub_src_optimizer_pullup.cpp src/duckdb/ub_src_optimizer_pushdown.cpp src/duckdb/ub_src_optimizer_rule.cpp src/duckdb/ub_src_optimizer_statistics_expression.cpp src/duckdb/ub_src_optimizer_statistics_operator.cpp src/duckdb/ub_src_parallel.cpp src/duckdb/ub_src_parser.cpp src/duckdb/ub_src_parser_constraints.cpp src/duckdb/ub_src_parser_expression.cpp src/duckdb/ub_src_parser_parsed_data.cpp src/duckdb/ub_src_parser_query_node.cpp src/duckdb/ub_src_parser_statement.cpp src/duckdb/ub_src_parser_tableref.cpp src/duckdb/ub_src_parser_transform_constraint.cpp src/duckdb/ub_src_parser_transform_expression.cpp src/duckdb/ub_src_parser_transform_helpers.cpp src/duckdb/ub_src_parser_transform_statement.cpp src/duckdb/ub_src_parser_transform_tableref.cpp src/duckdb/ub_src_planner.cpp src/duckdb/ub_src_planner_binder_expression.cpp src/duckdb/ub_src_planner_binder_query_node.cpp src/duckdb/ub_src_planner_binder_statement.cpp src/duckdb/ub_src_planner_binder_tableref.cpp src/duckdb/ub_src_planner_expression.cpp src/duckdb/ub_src_planner_expression_binder.cpp src/duckdb/ub_src_planner_filter.cpp src/duckdb/ub_src_planner_operator.cpp src/duckdb/ub_src_planner_subquery.cpp src/duckdb/ub_src_storage.cpp src/duckdb/ub_src_storage_buffer.cpp src/duckdb/ub_src_storage_checkpoint.cpp src/duckdb/ub_src_storage_compression_alp.cpp src/duckdb/ub_src_storage_compression.cpp src/duckdb/ub_src_storage_compression_chimp.cpp src/duckdb/ub_src_storage_metadata.cpp src/duckdb/ub_src_storage_serialization.cpp src/duckdb/ub_src_storage_statistics.cpp src/duckdb/ub_src_storage_table.cpp src/duckdb/ub_src_transaction.cpp src/duckdb/src/verification/copied_statement_verifier.cpp src/duckdb/src/verification/deserialized_statement_verifier.cpp src/duckdb/src/verification/external_statement_verifier.cpp src/duckdb/src/verification/fetch_row_verifier.cpp src/duckdb/src/verification/no_operator_caching_verifier.cpp src/duckdb/src/verification/parsed_statement_verifier.cpp src/duckdb/src/verification/prepared_statement_verifier.cpp src/duckdb/src/verification/statement_verifier.cpp src/duckdb/src/verification/unoptimized_statement_verifier.cpp src/duckdb/third_party/fmt/format.cc src/duckdb/third_party/fsst/libfsst.cpp src/duckdb/third_party/miniz/miniz.cpp src/duckdb/third_party/re2/re2/bitmap256.cc src/duckdb/third_party/re2/re2/bitstate.cc src/duckdb/third_party/re2/re2/compile.cc src/duckdb/third_party/re2/re2/dfa.cc src/duckdb/third_party/re2/re2/filtered_re2.cc src/duckdb/third_party/re2/re2/mimics_pcre.cc src/duckdb/third_party/re2/re2/nfa.cc src/duckdb/third_party/re2/re2/onepass.cc src/duckdb/third_party/re2/re2/parse.cc src/duckdb/third_party/re2/re2/perl_groups.cc src/duckdb/third_party/re2/re2/prefilter.cc src/duckdb/third_party/re2/re2/prefilter_tree.cc src/duckdb/third_party/re2/re2/prog.cc src/duckdb/third_party/re2/re2/re2.cc src/duckdb/third_party/re2/re2/regexp.cc src/duckdb/third_party/re2/re2/set.cc src/duckdb/third_party/re2/re2/simplify.cc src/duckdb/third_party/re2/re2/stringpiece.cc src/duckdb/third_party/re2/re2/tostring.cc src/duckdb/third_party/re2/re2/unicode_casefold.cc src/duckdb/third_party/re2/re2/unicode_groups.cc src/duckdb/third_party/re2/util/rune.cc src/duckdb/third_party/re2/util/strutil.cc src/duckdb/third_party/hyperloglog/hyperloglog.cpp src/duckdb/third_party/hyperloglog/sds.cpp src/duckdb/third_party/skiplist/SkipList.cpp src/duckdb/third_party/fastpforlib/bitpacking.cpp src/duckdb/third_party/utf8proc/utf8proc.cpp src/duckdb/third_party/utf8proc/utf8proc_wrapper.cpp src/duckdb/third_party/libpg_query/pg_functions.cpp src/duckdb/third_party/libpg_query/postgres_parser.cpp src/duckdb/third_party/libpg_query/src_backend_nodes_list.cpp src/duckdb/third_party/libpg_query/src_backend_nodes_makefuncs.cpp src/duckdb/third_party/libpg_query/src_backend_nodes_value.cpp src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp src/duckdb/third_party/libpg_query/src_backend_parser_parser.cpp src/duckdb/third_party/libpg_query/src_backend_parser_scan.cpp src/duckdb/third_party/libpg_query/src_backend_parser_scansup.cpp src/duckdb/third_party/libpg_query/src_common_keywords.cpp src/duckdb/third_party/mbedtls/library/aes.cpp src/duckdb/third_party/mbedtls/library/aria.cpp src/duckdb/third_party/mbedtls/library/asn1parse.cpp src/duckdb/third_party/mbedtls/library/base64.cpp src/duckdb/third_party/mbedtls/library/bignum.cpp src/duckdb/third_party/mbedtls/library/camellia.cpp src/duckdb/third_party/mbedtls/library/cipher.cpp src/duckdb/third_party/mbedtls/library/cipher_wrap.cpp src/duckdb/third_party/mbedtls/library/constant_time.cpp src/duckdb/third_party/mbedtls/library/entropy.cpp src/duckdb/third_party/mbedtls/library/entropy_poll.cpp src/duckdb/third_party/mbedtls/library/gcm.cpp src/duckdb/third_party/mbedtls/library/md.cpp src/duckdb/third_party/mbedtls/library/oid.cpp src/duckdb/third_party/mbedtls/library/pem.cpp src/duckdb/third_party/mbedtls/library/pk.cpp src/duckdb/third_party/mbedtls/library/pk_wrap.cpp src/duckdb/third_party/mbedtls/library/pkparse.cpp src/duckdb/third_party/mbedtls/library/platform_util.cpp src/duckdb/third_party/mbedtls/library/rsa.cpp src/duckdb/third_party/mbedtls/library/rsa_alt_helpers.cpp src/duckdb/third_party/mbedtls/library/sha1.cpp src/duckdb/third_party/mbedtls/library/sha256.cpp src/duckdb/third_party/mbedtls/library/sha512.cpp src/duckdb/third_party/mbedtls/mbedtls_wrapper.cpp src/duckdb/third_party/yyjson/yyjson.cpp src/duckdb/extension/parquet/column_reader.cpp src/duckdb/extension/parquet/column_writer.cpp src/duckdb/extension/parquet/parquet_crypto.cpp src/duckdb/extension/parquet/parquet_extension.cpp src/duckdb/extension/parquet/parquet_metadata.cpp src/duckdb/extension/parquet/parquet_reader.cpp src/duckdb/extension/parquet/parquet_statistics.cpp src/duckdb/extension/parquet/parquet_timestamp.cpp src/duckdb/extension/parquet/parquet_writer.cpp src/duckdb/extension/parquet/serialize_parquet.cpp src/duckdb/extension/parquet/zstd_file_system.cpp src/duckdb/extension/parquet/geo_parquet.cpp src/duckdb/third_party/parquet/parquet_constants.cpp src/duckdb/third_party/parquet/parquet_types.cpp src/duckdb/third_party/thrift/thrift/protocol/TProtocol.cpp src/duckdb/third_party/thrift/thrift/transport/TTransportException.cpp src/duckdb/third_party/thrift/thrift/transport/TBufferTransports.cpp src/duckdb/third_party/snappy/snappy.cc src/duckdb/third_party/snappy/snappy-sinksource.cc src/duckdb/third_party/zstd/decompress/zstd_ddict.cpp src/duckdb/third_party/zstd/decompress/huf_decompress.cpp src/duckdb/third_party/zstd/decompress/zstd_decompress.cpp src/duckdb/third_party/zstd/decompress/zstd_decompress_block.cpp src/duckdb/third_party/zstd/common/entropy_common.cpp src/duckdb/third_party/zstd/common/fse_decompress.cpp src/duckdb/third_party/zstd/common/zstd_common.cpp src/duckdb/third_party/zstd/common/error_private.cpp src/duckdb/third_party/zstd/common/xxhash.cpp src/duckdb/third_party/zstd/compress/fse_compress.cpp src/duckdb/third_party/zstd/compress/hist.cpp src/duckdb/third_party/zstd/compress/huf_compress.cpp src/duckdb/third_party/zstd/compress/zstd_compress.cpp src/duckdb/third_party/zstd/compress/zstd_compress_literals.cpp src/duckdb/third_party/zstd/compress/zstd_compress_sequences.cpp src/duckdb/third_party/zstd/compress/zstd_compress_superblock.cpp src/duckdb/third_party/zstd/compress/zstd_double_fast.cpp src/duckdb/third_party/zstd/compress/zstd_fast.cpp src/duckdb/third_party/zstd/compress/zstd_lazy.cpp src/duckdb/third_party/zstd/compress/zstd_ldm.cpp src/duckdb/third_party/zstd/compress/zstd_opt.cpp src/duckdb/third_party/lz4/lz4.cpp src/duckdb/third_party/brotli/common/constants.cpp src/duckdb/third_party/brotli/common/context.cpp src/duckdb/third_party/brotli/common/dictionary.cpp src/duckdb/third_party/brotli/common/platform.cpp src/duckdb/third_party/brotli/common/shared_dictionary.cpp src/duckdb/third_party/brotli/common/transform.cpp src/duckdb/third_party/brotli/dec/bit_reader.cpp src/duckdb/third_party/brotli/dec/decode.cpp src/duckdb/third_party/brotli/dec/huffman.cpp src/duckdb/third_party/brotli/dec/state.cpp src/duckdb/third_party/brotli/enc/backward_references.cpp src/duckdb/third_party/brotli/enc/backward_references_hq.cpp src/duckdb/third_party/brotli/enc/bit_cost.cpp src/duckdb/third_party/brotli/enc/block_splitter.cpp src/duckdb/third_party/brotli/enc/brotli_bit_stream.cpp src/duckdb/third_party/brotli/enc/cluster.cpp src/duckdb/third_party/brotli/enc/command.cpp src/duckdb/third_party/brotli/enc/compound_dictionary.cpp src/duckdb/third_party/brotli/enc/compress_fragment.cpp src/duckdb/third_party/brotli/enc/compress_fragment_two_pass.cpp src/duckdb/third_party/brotli/enc/dictionary_hash.cpp src/duckdb/third_party/brotli/enc/encode.cpp src/duckdb/third_party/brotli/enc/encoder_dict.cpp src/duckdb/third_party/brotli/enc/entropy_encode.cpp src/duckdb/third_party/brotli/enc/fast_log.cpp src/duckdb/third_party/brotli/enc/histogram.cpp src/duckdb/third_party/brotli/enc/literal_cost.cpp src/duckdb/third_party/brotli/enc/memory.cpp src/duckdb/third_party/brotli/enc/metablock.cpp src/duckdb/third_party/brotli/enc/static_dict.cpp src/duckdb/third_party/brotli/enc/utf8_util.cpp src/duckdb/extension/icu/./icu-makedate.cpp src/duckdb/extension/icu/./icu-datefunc.cpp src/duckdb/extension/icu/./icu-table-range.cpp src/duckdb/extension/icu/./icu_extension.cpp src/duckdb/extension/icu/./icu-datesub.cpp src/duckdb/extension/icu/./icu-dateadd.cpp src/duckdb/extension/icu/./icu-datetrunc.cpp src/duckdb/extension/icu/./icu-strptime.cpp src/duckdb/extension/icu/./icu-timezone.cpp src/duckdb/extension/icu/./icu-list-range.cpp src/duckdb/extension/icu/./icu-datepart.cpp src/duckdb/extension/icu/./icu-timebucket.cpp src/duckdb/ub_extension_icu_third_party_icu_common.cpp src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp src/duckdb/extension/icu/third_party/icu/stubdata/stubdata.cpp src/duckdb/extension/json/buffered_json_reader.cpp src/duckdb/extension/json/json_enums.cpp src/duckdb/extension/json/json_extension.cpp src/duckdb/extension/json/json_common.cpp src/duckdb/extension/json/json_functions.cpp src/duckdb/extension/json/json_scan.cpp src/duckdb/extension/json/json_serializer.cpp src/duckdb/extension/json/json_deserializer.cpp src/duckdb/extension/json/serialize_json.cpp src/duckdb/ub_extension_json_json_functions.cpp)
+set(DUCKDB_SRC_FILES src/duckdb/ub_src_catalog.cpp src/duckdb/ub_src_catalog_catalog_entry.cpp src/duckdb/ub_src_catalog_catalog_entry_dependency.cpp src/duckdb/ub_src_catalog_default.cpp src/duckdb/ub_src_common_adbc.cpp src/duckdb/ub_src_common_adbc_nanoarrow.cpp src/duckdb/ub_src_common.cpp src/duckdb/ub_src_common_arrow_appender.cpp src/duckdb/ub_src_common_arrow.cpp src/duckdb/ub_src_common_crypto.cpp src/duckdb/ub_src_common_enums.cpp src/duckdb/ub_src_common_exception.cpp src/duckdb/ub_src_common_operator.cpp src/duckdb/ub_src_common_progress_bar.cpp src/duckdb/ub_src_common_row_operations.cpp src/duckdb/ub_src_common_serializer.cpp src/duckdb/ub_src_common_sort.cpp src/duckdb/ub_src_common_tree_renderer.cpp src/duckdb/ub_src_common_types.cpp src/duckdb/ub_src_common_types_column.cpp src/duckdb/ub_src_common_types_row.cpp src/duckdb/ub_src_common_value_operations.cpp src/duckdb/src/common/vector_operations/boolean_operators.cpp src/duckdb/src/common/vector_operations/comparison_operators.cpp src/duckdb/src/common/vector_operations/generators.cpp src/duckdb/src/common/vector_operations/is_distinct_from.cpp src/duckdb/src/common/vector_operations/null_operations.cpp src/duckdb/src/common/vector_operations/numeric_inplace_operators.cpp src/duckdb/src/common/vector_operations/vector_cast.cpp src/duckdb/src/common/vector_operations/vector_copy.cpp src/duckdb/src/common/vector_operations/vector_hash.cpp src/duckdb/src/common/vector_operations/vector_storage.cpp src/duckdb/ub_src_execution.cpp src/duckdb/ub_src_execution_expression_executor.cpp src/duckdb/ub_src_execution_index_art.cpp src/duckdb/ub_src_execution_index.cpp src/duckdb/ub_src_execution_nested_loop_join.cpp src/duckdb/ub_src_execution_operator_aggregate.cpp src/duckdb/ub_src_execution_operator_csv_scanner_buffer_manager.cpp src/duckdb/ub_src_execution_operator_csv_scanner_encode.cpp src/duckdb/ub_src_execution_operator_csv_scanner_scanner.cpp src/duckdb/ub_src_execution_operator_csv_scanner_sniffer.cpp src/duckdb/ub_src_execution_operator_csv_scanner_state_machine.cpp src/duckdb/ub_src_execution_operator_csv_scanner_table_function.cpp src/duckdb/ub_src_execution_operator_csv_scanner_util.cpp src/duckdb/ub_src_execution_operator_filter.cpp src/duckdb/ub_src_execution_operator_helper.cpp src/duckdb/ub_src_execution_operator_join.cpp src/duckdb/ub_src_execution_operator_order.cpp src/duckdb/ub_src_execution_operator_persistent.cpp src/duckdb/ub_src_execution_operator_projection.cpp src/duckdb/ub_src_execution_operator_scan.cpp src/duckdb/ub_src_execution_operator_schema.cpp src/duckdb/ub_src_execution_operator_set.cpp src/duckdb/ub_src_execution_physical_plan.cpp src/duckdb/ub_src_function_aggregate_distributive.cpp src/duckdb/ub_src_function_aggregate.cpp src/duckdb/ub_src_function.cpp src/duckdb/ub_src_function_cast.cpp src/duckdb/ub_src_function_cast_union.cpp src/duckdb/ub_src_function_pragma.cpp src/duckdb/ub_src_function_scalar_compressed_materialization.cpp src/duckdb/ub_src_function_scalar.cpp src/duckdb/ub_src_function_scalar_date.cpp src/duckdb/ub_src_function_scalar_generic.cpp src/duckdb/ub_src_function_scalar_list.cpp src/duckdb/ub_src_function_scalar_map.cpp src/duckdb/ub_src_function_scalar_operator.cpp src/duckdb/ub_src_function_scalar_sequence.cpp src/duckdb/ub_src_function_scalar_string.cpp src/duckdb/ub_src_function_scalar_string_regexp.cpp src/duckdb/ub_src_function_scalar_struct.cpp src/duckdb/ub_src_function_scalar_system.cpp src/duckdb/ub_src_function_table_arrow.cpp src/duckdb/ub_src_function_table.cpp src/duckdb/ub_src_function_table_system.cpp src/duckdb/ub_src_function_table_version.cpp src/duckdb/ub_src_function_window.cpp src/duckdb/ub_src_main.cpp src/duckdb/ub_src_main_buffered_data.cpp src/duckdb/ub_src_main_capi.cpp src/duckdb/ub_src_main_capi_cast.cpp src/duckdb/ub_src_main_chunk_scan_state.cpp src/duckdb/ub_src_main_extension.cpp src/duckdb/ub_src_main_relation.cpp src/duckdb/ub_src_main_secret.cpp src/duckdb/ub_src_main_settings.cpp src/duckdb/ub_src_optimizer.cpp src/duckdb/ub_src_optimizer_compressed_materialization.cpp src/duckdb/ub_src_optimizer_join_order.cpp src/duckdb/ub_src_optimizer_matcher.cpp src/duckdb/ub_src_optimizer_pullup.cpp src/duckdb/ub_src_optimizer_pushdown.cpp src/duckdb/ub_src_optimizer_rule.cpp src/duckdb/ub_src_optimizer_statistics_expression.cpp src/duckdb/ub_src_optimizer_statistics_operator.cpp src/duckdb/ub_src_parallel.cpp src/duckdb/ub_src_parser.cpp src/duckdb/ub_src_parser_constraints.cpp src/duckdb/ub_src_parser_expression.cpp src/duckdb/ub_src_parser_parsed_data.cpp src/duckdb/ub_src_parser_query_node.cpp src/duckdb/ub_src_parser_statement.cpp src/duckdb/ub_src_parser_tableref.cpp src/duckdb/ub_src_parser_transform_constraint.cpp src/duckdb/ub_src_parser_transform_expression.cpp src/duckdb/ub_src_parser_transform_helpers.cpp src/duckdb/ub_src_parser_transform_statement.cpp src/duckdb/ub_src_parser_transform_tableref.cpp src/duckdb/ub_src_planner.cpp src/duckdb/ub_src_planner_binder_expression.cpp src/duckdb/ub_src_planner_binder_query_node.cpp src/duckdb/ub_src_planner_binder_statement.cpp src/duckdb/ub_src_planner_binder_tableref.cpp src/duckdb/ub_src_planner_expression.cpp src/duckdb/ub_src_planner_expression_binder.cpp src/duckdb/ub_src_planner_filter.cpp src/duckdb/ub_src_planner_operator.cpp src/duckdb/ub_src_planner_subquery.cpp src/duckdb/ub_src_storage.cpp src/duckdb/ub_src_storage_buffer.cpp src/duckdb/ub_src_storage_checkpoint.cpp src/duckdb/ub_src_storage_compression_alp.cpp src/duckdb/ub_src_storage_compression.cpp src/duckdb/ub_src_storage_compression_chimp.cpp src/duckdb/ub_src_storage_compression_roaring.cpp src/duckdb/ub_src_storage_metadata.cpp src/duckdb/ub_src_storage_serialization.cpp src/duckdb/ub_src_storage_statistics.cpp src/duckdb/ub_src_storage_table.cpp src/duckdb/ub_src_transaction.cpp src/duckdb/src/verification/copied_statement_verifier.cpp src/duckdb/src/verification/deserialized_statement_verifier.cpp src/duckdb/src/verification/external_statement_verifier.cpp src/duckdb/src/verification/fetch_row_verifier.cpp src/duckdb/src/verification/no_operator_caching_verifier.cpp src/duckdb/src/verification/parsed_statement_verifier.cpp src/duckdb/src/verification/prepared_statement_verifier.cpp src/duckdb/src/verification/statement_verifier.cpp src/duckdb/src/verification/unoptimized_statement_verifier.cpp src/duckdb/third_party/fmt/format.cc src/duckdb/third_party/fsst/libfsst.cpp src/duckdb/third_party/miniz/miniz.cpp src/duckdb/third_party/re2/re2/bitmap256.cc src/duckdb/third_party/re2/re2/bitstate.cc src/duckdb/third_party/re2/re2/compile.cc src/duckdb/third_party/re2/re2/dfa.cc src/duckdb/third_party/re2/re2/filtered_re2.cc src/duckdb/third_party/re2/re2/mimics_pcre.cc src/duckdb/third_party/re2/re2/nfa.cc src/duckdb/third_party/re2/re2/onepass.cc src/duckdb/third_party/re2/re2/parse.cc src/duckdb/third_party/re2/re2/perl_groups.cc src/duckdb/third_party/re2/re2/prefilter.cc src/duckdb/third_party/re2/re2/prefilter_tree.cc src/duckdb/third_party/re2/re2/prog.cc src/duckdb/third_party/re2/re2/re2.cc src/duckdb/third_party/re2/re2/regexp.cc src/duckdb/third_party/re2/re2/set.cc src/duckdb/third_party/re2/re2/simplify.cc src/duckdb/third_party/re2/re2/stringpiece.cc src/duckdb/third_party/re2/re2/tostring.cc src/duckdb/third_party/re2/re2/unicode_casefold.cc src/duckdb/third_party/re2/re2/unicode_groups.cc src/duckdb/third_party/re2/util/rune.cc src/duckdb/third_party/re2/util/strutil.cc src/duckdb/third_party/hyperloglog/hyperloglog.cpp src/duckdb/third_party/hyperloglog/sds.cpp src/duckdb/third_party/skiplist/SkipList.cpp src/duckdb/third_party/fastpforlib/bitpacking.cpp src/duckdb/third_party/utf8proc/utf8proc.cpp src/duckdb/third_party/utf8proc/utf8proc_wrapper.cpp src/duckdb/third_party/libpg_query/pg_functions.cpp src/duckdb/third_party/libpg_query/postgres_parser.cpp src/duckdb/third_party/libpg_query/src_backend_nodes_list.cpp src/duckdb/third_party/libpg_query/src_backend_nodes_makefuncs.cpp src/duckdb/third_party/libpg_query/src_backend_nodes_value.cpp src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp src/duckdb/third_party/libpg_query/src_backend_parser_parser.cpp src/duckdb/third_party/libpg_query/src_backend_parser_scan.cpp src/duckdb/third_party/libpg_query/src_backend_parser_scansup.cpp src/duckdb/third_party/libpg_query/src_common_keywords.cpp src/duckdb/third_party/mbedtls/library/aes.cpp src/duckdb/third_party/mbedtls/library/aria.cpp src/duckdb/third_party/mbedtls/library/asn1parse.cpp src/duckdb/third_party/mbedtls/library/base64.cpp src/duckdb/third_party/mbedtls/library/bignum.cpp src/duckdb/third_party/mbedtls/library/camellia.cpp src/duckdb/third_party/mbedtls/library/cipher.cpp src/duckdb/third_party/mbedtls/library/cipher_wrap.cpp src/duckdb/third_party/mbedtls/library/constant_time.cpp src/duckdb/third_party/mbedtls/library/entropy.cpp src/duckdb/third_party/mbedtls/library/entropy_poll.cpp src/duckdb/third_party/mbedtls/library/gcm.cpp src/duckdb/third_party/mbedtls/library/md.cpp src/duckdb/third_party/mbedtls/library/oid.cpp src/duckdb/third_party/mbedtls/library/pem.cpp src/duckdb/third_party/mbedtls/library/pk.cpp src/duckdb/third_party/mbedtls/library/pk_wrap.cpp src/duckdb/third_party/mbedtls/library/pkparse.cpp src/duckdb/third_party/mbedtls/library/platform_util.cpp src/duckdb/third_party/mbedtls/library/rsa.cpp src/duckdb/third_party/mbedtls/library/rsa_alt_helpers.cpp src/duckdb/third_party/mbedtls/library/sha1.cpp src/duckdb/third_party/mbedtls/library/sha256.cpp src/duckdb/third_party/mbedtls/library/sha512.cpp src/duckdb/third_party/mbedtls/mbedtls_wrapper.cpp src/duckdb/third_party/yyjson/yyjson.cpp src/duckdb/third_party/zstd/common/debug.cpp src/duckdb/third_party/zstd/common/entropy_common.cpp src/duckdb/third_party/zstd/common/error_private.cpp src/duckdb/third_party/zstd/common/fse_decompress.cpp src/duckdb/third_party/zstd/common/pool.cpp src/duckdb/third_party/zstd/common/threading.cpp src/duckdb/third_party/zstd/common/xxhash.cpp src/duckdb/third_party/zstd/common/zstd_common.cpp src/duckdb/third_party/zstd/compress/fse_compress.cpp src/duckdb/third_party/zstd/compress/hist.cpp src/duckdb/third_party/zstd/compress/huf_compress.cpp src/duckdb/third_party/zstd/compress/zstd_compress.cpp src/duckdb/third_party/zstd/compress/zstd_compress_literals.cpp src/duckdb/third_party/zstd/compress/zstd_compress_sequences.cpp src/duckdb/third_party/zstd/compress/zstd_compress_superblock.cpp src/duckdb/third_party/zstd/compress/zstd_double_fast.cpp src/duckdb/third_party/zstd/compress/zstd_fast.cpp src/duckdb/third_party/zstd/compress/zstd_lazy.cpp src/duckdb/third_party/zstd/compress/zstd_ldm.cpp src/duckdb/third_party/zstd/compress/zstd_opt.cpp src/duckdb/third_party/zstd/compress/zstdmt_compress.cpp src/duckdb/third_party/zstd/decompress/huf_decompress.cpp src/duckdb/third_party/zstd/decompress/zstd_ddict.cpp src/duckdb/third_party/zstd/decompress/zstd_decompress.cpp src/duckdb/third_party/zstd/decompress/zstd_decompress_block.cpp src/duckdb/third_party/zstd/deprecated/zbuff_common.cpp src/duckdb/third_party/zstd/deprecated/zbuff_compress.cpp src/duckdb/third_party/zstd/deprecated/zbuff_decompress.cpp src/duckdb/third_party/zstd/dict/cover.cpp src/duckdb/third_party/zstd/dict/divsufsort.cpp src/duckdb/third_party/zstd/dict/fastcover.cpp src/duckdb/third_party/zstd/dict/zdict.cpp src/duckdb/extension/core_functions/lambda_functions.cpp src/duckdb/extension/core_functions/core_functions_extension.cpp src/duckdb/extension/core_functions/function_list.cpp src/duckdb/ub_extension_core_functions_aggregate_algebraic.cpp src/duckdb/ub_extension_core_functions_aggregate_nested.cpp src/duckdb/ub_extension_core_functions_aggregate_regression.cpp src/duckdb/ub_extension_core_functions_aggregate_distributive.cpp src/duckdb/ub_extension_core_functions_aggregate_holistic.cpp src/duckdb/ub_extension_core_functions_scalar_random.cpp src/duckdb/ub_extension_core_functions_scalar_bit.cpp src/duckdb/ub_extension_core_functions_scalar_math.cpp src/duckdb/ub_extension_core_functions_scalar_operators.cpp src/duckdb/ub_extension_core_functions_scalar_struct.cpp src/duckdb/ub_extension_core_functions_scalar_map.cpp src/duckdb/ub_extension_core_functions_scalar_list.cpp src/duckdb/ub_extension_core_functions_scalar_blob.cpp src/duckdb/ub_extension_core_functions_scalar_array.cpp src/duckdb/ub_extension_core_functions_scalar_date.cpp src/duckdb/ub_extension_core_functions_scalar_string.cpp src/duckdb/ub_extension_core_functions_scalar_generic.cpp src/duckdb/ub_extension_core_functions_scalar_union.cpp src/duckdb/ub_extension_core_functions_scalar_debug.cpp src/duckdb/ub_extension_core_functions_scalar_enum.cpp src/duckdb/extension/parquet/column_reader.cpp src/duckdb/extension/parquet/column_writer.cpp src/duckdb/extension/parquet/parquet_crypto.cpp src/duckdb/extension/parquet/parquet_extension.cpp src/duckdb/extension/parquet/parquet_metadata.cpp src/duckdb/extension/parquet/parquet_reader.cpp src/duckdb/extension/parquet/parquet_statistics.cpp src/duckdb/extension/parquet/parquet_timestamp.cpp src/duckdb/extension/parquet/parquet_writer.cpp src/duckdb/extension/parquet/serialize_parquet.cpp src/duckdb/extension/parquet/zstd_file_system.cpp src/duckdb/extension/parquet/geo_parquet.cpp src/duckdb/third_party/parquet/parquet_types.cpp src/duckdb/third_party/thrift/thrift/protocol/TProtocol.cpp src/duckdb/third_party/thrift/thrift/transport/TTransportException.cpp src/duckdb/third_party/thrift/thrift/transport/TBufferTransports.cpp src/duckdb/third_party/snappy/snappy.cc src/duckdb/third_party/snappy/snappy-sinksource.cc src/duckdb/third_party/lz4/lz4.cpp src/duckdb/third_party/brotli/common/constants.cpp src/duckdb/third_party/brotli/common/context.cpp src/duckdb/third_party/brotli/common/dictionary.cpp src/duckdb/third_party/brotli/common/platform.cpp src/duckdb/third_party/brotli/common/shared_dictionary.cpp src/duckdb/third_party/brotli/common/transform.cpp src/duckdb/third_party/brotli/dec/bit_reader.cpp src/duckdb/third_party/brotli/dec/decode.cpp src/duckdb/third_party/brotli/dec/huffman.cpp src/duckdb/third_party/brotli/dec/state.cpp src/duckdb/third_party/brotli/enc/backward_references.cpp src/duckdb/third_party/brotli/enc/backward_references_hq.cpp src/duckdb/third_party/brotli/enc/bit_cost.cpp src/duckdb/third_party/brotli/enc/block_splitter.cpp src/duckdb/third_party/brotli/enc/brotli_bit_stream.cpp src/duckdb/third_party/brotli/enc/cluster.cpp src/duckdb/third_party/brotli/enc/command.cpp src/duckdb/third_party/brotli/enc/compound_dictionary.cpp src/duckdb/third_party/brotli/enc/compress_fragment.cpp src/duckdb/third_party/brotli/enc/compress_fragment_two_pass.cpp src/duckdb/third_party/brotli/enc/dictionary_hash.cpp src/duckdb/third_party/brotli/enc/encode.cpp src/duckdb/third_party/brotli/enc/encoder_dict.cpp src/duckdb/third_party/brotli/enc/entropy_encode.cpp src/duckdb/third_party/brotli/enc/fast_log.cpp src/duckdb/third_party/brotli/enc/histogram.cpp src/duckdb/third_party/brotli/enc/literal_cost.cpp src/duckdb/third_party/brotli/enc/memory.cpp src/duckdb/third_party/brotli/enc/metablock.cpp src/duckdb/third_party/brotli/enc/static_dict.cpp src/duckdb/third_party/brotli/enc/utf8_util.cpp src/duckdb/extension/icu/./icu-timebucket.cpp src/duckdb/extension/icu/./icu-timezone.cpp src/duckdb/extension/icu/./icu-datetrunc.cpp src/duckdb/extension/icu/./icu_extension.cpp src/duckdb/extension/icu/./icu-dateadd.cpp src/duckdb/extension/icu/./icu-table-range.cpp src/duckdb/extension/icu/./icu-datesub.cpp src/duckdb/extension/icu/./icu-datefunc.cpp src/duckdb/extension/icu/./icu-makedate.cpp src/duckdb/extension/icu/./icu-strptime.cpp src/duckdb/extension/icu/./icu-list-range.cpp src/duckdb/extension/icu/./icu-datepart.cpp src/duckdb/ub_extension_icu_third_party_icu_common.cpp src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp src/duckdb/extension/icu/third_party/icu/stubdata/stubdata.cpp src/duckdb/extension/json/buffered_json_reader.cpp src/duckdb/extension/json/json_enums.cpp src/duckdb/extension/json/json_extension.cpp src/duckdb/extension/json/json_common.cpp src/duckdb/extension/json/json_functions.cpp src/duckdb/extension/json/json_scan.cpp src/duckdb/extension/json/json_serializer.cpp src/duckdb/extension/json/json_deserializer.cpp src/duckdb/extension/json/serialize_json.cpp src/duckdb/ub_extension_json_json_functions.cpp)
set(CMAKE_JAVA_COMPILE_FLAGS -source 1.8 -target 1.8 -encoding utf-8)
diff --git a/scripts/jdbc_maven_deploy.py b/scripts/jdbc_maven_deploy.py
index 0fabceca..9f40fe46 100644
--- a/scripts/jdbc_maven_deploy.py
+++ b/scripts/jdbc_maven_deploy.py
@@ -115,8 +115,8 @@ def exec(cmd):
1.6.14
true
- ossrh
- https://oss.sonatype.org/
+ ossrh
+ https://oss.sonatype.org/
@@ -179,7 +179,7 @@ def exec(cmd):
shutil.copyfile(jar, os.path.join(results_dir, os.path.basename(jar)))
print("JARs created, uploading (this can take a while!)")
-deploy_cmd_prefix = 'mvn gpg:sign-and-deploy-file -Durl=%s -DrepositoryId=ossrh' % deploy_url
+deploy_cmd_prefix = 'mvn --no-transfer-progress gpg:sign-and-deploy-file -Durl=%s -DrepositoryId=ossrh' % deploy_url
exec("%s -DpomFile=%s -Dfile=%s" % (deploy_cmd_prefix, pom, binary_jar))
exec("%s -Dclassifier=sources -DpomFile=%s -Dfile=%s" % (deploy_cmd_prefix, pom, sources_jar))
exec("%s -Dclassifier=javadoc -DpomFile=%s -Dfile=%s" % (deploy_cmd_prefix, pom, javadoc_jar))
diff --git a/src/duckdb/src/core_functions/aggregate/algebraic/avg.cpp b/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp
similarity index 98%
rename from src/duckdb/src/core_functions/aggregate/algebraic/avg.cpp
rename to src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp
index d00e743f..f242b277 100644
--- a/src/duckdb/src/core_functions/aggregate/algebraic/avg.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp
@@ -1,5 +1,5 @@
-#include "duckdb/core_functions/aggregate/algebraic_functions.hpp"
-#include "duckdb/core_functions/aggregate/sum_helpers.hpp"
+#include "core_functions/aggregate/algebraic_functions.hpp"
+#include "core_functions/aggregate/sum_helpers.hpp"
#include "duckdb/common/types/hugeint.hpp"
#include "duckdb/common/exception.hpp"
#include "duckdb/function/function_set.hpp"
diff --git a/src/duckdb/src/core_functions/aggregate/algebraic/corr.cpp b/src/duckdb/extension/core_functions/aggregate/algebraic/corr.cpp
similarity index 53%
rename from src/duckdb/src/core_functions/aggregate/algebraic/corr.cpp
rename to src/duckdb/extension/core_functions/aggregate/algebraic/corr.cpp
index 61678684..bf53a5ad 100644
--- a/src/duckdb/src/core_functions/aggregate/algebraic/corr.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/algebraic/corr.cpp
@@ -1,7 +1,7 @@
-#include "duckdb/core_functions/aggregate/algebraic_functions.hpp"
-#include "duckdb/core_functions/aggregate/algebraic/covar.hpp"
-#include "duckdb/core_functions/aggregate/algebraic/stddev.hpp"
-#include "duckdb/core_functions/aggregate/algebraic/corr.hpp"
+#include "core_functions/aggregate/algebraic_functions.hpp"
+#include "core_functions/aggregate/algebraic/covar.hpp"
+#include "core_functions/aggregate/algebraic/stddev.hpp"
+#include "core_functions/aggregate/algebraic/corr.hpp"
#include "duckdb/function/function_set.hpp"
namespace duckdb {
diff --git a/src/duckdb/src/core_functions/aggregate/algebraic/covar.cpp b/src/duckdb/extension/core_functions/aggregate/algebraic/covar.cpp
similarity index 80%
rename from src/duckdb/src/core_functions/aggregate/algebraic/covar.cpp
rename to src/duckdb/extension/core_functions/aggregate/algebraic/covar.cpp
index ced7d8be..fddb9ed2 100644
--- a/src/duckdb/src/core_functions/aggregate/algebraic/covar.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/algebraic/covar.cpp
@@ -1,6 +1,6 @@
-#include "duckdb/core_functions/aggregate/algebraic_functions.hpp"
+#include "core_functions/aggregate/algebraic_functions.hpp"
#include "duckdb/common/types/null_value.hpp"
-#include "duckdb/core_functions/aggregate/algebraic/covar.hpp"
+#include "core_functions/aggregate/algebraic/covar.hpp"
namespace duckdb {
diff --git a/src/duckdb/src/core_functions/aggregate/algebraic/stddev.cpp b/src/duckdb/extension/core_functions/aggregate/algebraic/stddev.cpp
similarity index 91%
rename from src/duckdb/src/core_functions/aggregate/algebraic/stddev.cpp
rename to src/duckdb/extension/core_functions/aggregate/algebraic/stddev.cpp
index b21467ee..e9d14ee2 100644
--- a/src/duckdb/src/core_functions/aggregate/algebraic/stddev.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/algebraic/stddev.cpp
@@ -1,7 +1,7 @@
-#include "duckdb/core_functions/aggregate/algebraic_functions.hpp"
+#include "core_functions/aggregate/algebraic_functions.hpp"
#include "duckdb/common/vector_operations/vector_operations.hpp"
#include "duckdb/function/function_set.hpp"
-#include "duckdb/core_functions/aggregate/algebraic/stddev.hpp"
+#include "core_functions/aggregate/algebraic/stddev.hpp"
#include
namespace duckdb {
diff --git a/src/duckdb/src/core_functions/aggregate/distributive/approx_count.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/approx_count.cpp
similarity index 98%
rename from src/duckdb/src/core_functions/aggregate/distributive/approx_count.cpp
rename to src/duckdb/extension/core_functions/aggregate/distributive/approx_count.cpp
index 13d33220..37f05b20 100644
--- a/src/duckdb/src/core_functions/aggregate/distributive/approx_count.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/distributive/approx_count.cpp
@@ -1,7 +1,7 @@
#include "duckdb/common/exception.hpp"
#include "duckdb/common/types/hash.hpp"
#include "duckdb/common/types/hyperloglog.hpp"
-#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
+#include "core_functions/aggregate/distributive_functions.hpp"
#include "duckdb/function/function_set.hpp"
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
#include "hyperloglog.hpp"
diff --git a/src/duckdb/src/core_functions/aggregate/distributive/arg_min_max.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/arg_min_max.cpp
similarity index 90%
rename from src/duckdb/src/core_functions/aggregate/distributive/arg_min_max.cpp
rename to src/duckdb/extension/core_functions/aggregate/distributive/arg_min_max.cpp
index 5120bc79..63c112b3 100644
--- a/src/duckdb/src/core_functions/aggregate/distributive/arg_min_max.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/distributive/arg_min_max.cpp
@@ -1,14 +1,14 @@
#include "duckdb/common/exception.hpp"
#include "duckdb/common/operator/comparison_operators.hpp"
#include "duckdb/common/vector_operations/vector_operations.hpp"
-#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
+#include "core_functions/aggregate/distributive_functions.hpp"
#include "duckdb/function/cast/cast_function_set.hpp"
#include "duckdb/function/function_set.hpp"
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
#include "duckdb/planner/expression/bound_comparison_expression.hpp"
#include "duckdb/planner/expression_binder.hpp"
-#include "duckdb/core_functions/create_sort_key.hpp"
-#include "duckdb/core_functions/aggregate/minmax_n_helpers.hpp"
+#include "duckdb/function/create_sort_key.hpp"
+#include "duckdb/function/aggregate/minmax_n_helpers.hpp"
namespace duckdb {
@@ -192,7 +192,7 @@ struct GenericArgMinMaxState {
static void PrepareData(Vector &by, idx_t count, Vector &extra_state, UnifiedVectorFormat &result) {
OrderModifiers modifiers(ORDER_TYPE, OrderByNullType::NULLS_LAST);
- CreateSortKeyHelpers::CreateSortKey(by, count, modifiers, extra_state);
+ CreateSortKeyHelpers::CreateSortKeyWithValidity(by, extra_state, modifiers, count);
extra_state.ToUnifiedFormat(count, result);
}
};
@@ -285,7 +285,6 @@ struct VectorArgMinMaxBase : ArgMinMaxBase {
target.arg_null = source.arg_null;
if (!target.arg_null) {
STATE::template AssignValue(target.arg, source.arg);
- ;
}
target.is_initialized = true;
}
@@ -303,21 +302,43 @@ struct VectorArgMinMaxBase : ArgMinMaxBase {
static unique_ptr Bind(ClientContext &context, AggregateFunction &function,
vector> &arguments) {
+ if (arguments[1]->return_type.InternalType() == PhysicalType::VARCHAR) {
+ ExpressionBinder::PushCollation(context, arguments[1], arguments[1]->return_type);
+ }
function.arguments[0] = arguments[0]->return_type;
function.return_type = arguments[0]->return_type;
return nullptr;
}
};
+template
+AggregateFunction GetGenericArgMinMaxFunction() {
+ using STATE = ArgMinMaxState;
+ return AggregateFunction(
+ {LogicalType::ANY, LogicalType::ANY}, LogicalType::ANY, AggregateFunction::StateSize,
+ AggregateFunction::StateInitialize, OP::template Update,
+ AggregateFunction::StateCombine, AggregateFunction::StateVoidFinalize, nullptr, OP::Bind,
+ AggregateFunction::StateDestroy);
+}
+
template
AggregateFunction GetVectorArgMinMaxFunctionInternal(const LogicalType &by_type, const LogicalType &type) {
+#ifndef DUCKDB_SMALLER_BINARY
using STATE = ArgMinMaxState;
- return AggregateFunction(
- {type, by_type}, type, AggregateFunction::StateSize, AggregateFunction::StateInitialize,
- OP::template Update, AggregateFunction::StateCombine,
- AggregateFunction::StateVoidFinalize, nullptr, OP::Bind, AggregateFunction::StateDestroy);
+ return AggregateFunction({type, by_type}, type, AggregateFunction::StateSize,
+ AggregateFunction::StateInitialize,
+ OP::template Update, AggregateFunction::StateCombine,
+ AggregateFunction::StateVoidFinalize, nullptr, OP::Bind,
+ AggregateFunction::StateDestroy);
+#else
+ auto function = GetGenericArgMinMaxFunction();
+ function.arguments = {type, by_type};
+ function.return_type = type;
+ return function;
+#endif
}
+#ifndef DUCKDB_SMALLER_BINARY
template
AggregateFunction GetVectorArgMinMaxFunctionBy(const LogicalType &by_type, const LogicalType &type) {
switch (by_type.InternalType()) {
@@ -335,6 +356,7 @@ AggregateFunction GetVectorArgMinMaxFunctionBy(const LogicalType &by_type, const
throw InternalException("Unimplemented arg_min/arg_max aggregate");
}
}
+#endif
static const vector ArgMaxByTypes() {
vector types = {LogicalType::INTEGER, LogicalType::BIGINT, LogicalType::HUGEINT,
@@ -347,21 +369,34 @@ template
void AddVectorArgMinMaxFunctionBy(AggregateFunctionSet &fun, const LogicalType &type) {
auto by_types = ArgMaxByTypes();
for (const auto &by_type : by_types) {
+#ifndef DUCKDB_SMALLER_BINARY
fun.AddFunction(GetVectorArgMinMaxFunctionBy(by_type, type));
+#else
+ fun.AddFunction(GetVectorArgMinMaxFunctionInternal(by_type, type));
+#endif
}
}
template
AggregateFunction GetArgMinMaxFunctionInternal(const LogicalType &by_type, const LogicalType &type) {
+#ifndef DUCKDB_SMALLER_BINARY
using STATE = ArgMinMaxState;
- auto function = AggregateFunction::BinaryAggregate(type, by_type, type);
+ auto function =
+ AggregateFunction::BinaryAggregate(
+ type, by_type, type);
if (type.InternalType() == PhysicalType::VARCHAR || by_type.InternalType() == PhysicalType::VARCHAR) {
function.destructor = AggregateFunction::StateDestroy;
}
function.bind = OP::Bind;
+#else
+ auto function = GetGenericArgMinMaxFunction();
+ function.arguments = {type, by_type};
+ function.return_type = type;
+#endif
return function;
}
+#ifndef DUCKDB_SMALLER_BINARY
template
AggregateFunction GetArgMinMaxFunctionBy(const LogicalType &by_type, const LogicalType &type) {
switch (by_type.InternalType()) {
@@ -379,18 +414,24 @@ AggregateFunction GetArgMinMaxFunctionBy(const LogicalType &by_type, const Logic
throw InternalException("Unimplemented arg_min/arg_max by aggregate");
}
}
+#endif
template
void AddArgMinMaxFunctionBy(AggregateFunctionSet &fun, const LogicalType &type) {
auto by_types = ArgMaxByTypes();
for (const auto &by_type : by_types) {
+#ifndef DUCKDB_SMALLER_BINARY
fun.AddFunction(GetArgMinMaxFunctionBy(by_type, type));
+#else
+ fun.AddFunction(GetArgMinMaxFunctionInternal(by_type, type));
+#endif
}
}
template
static AggregateFunction GetDecimalArgMinMaxFunction(const LogicalType &by_type, const LogicalType &type) {
D_ASSERT(type.id() == LogicalTypeId::DECIMAL);
+#ifndef DUCKDB_SMALLER_BINARY
switch (type.InternalType()) {
case PhysicalType::INT16:
return GetArgMinMaxFunctionBy(by_type, type);
@@ -401,6 +442,9 @@ static AggregateFunction GetDecimalArgMinMaxFunction(const LogicalType &by_type,
default:
return GetArgMinMaxFunctionBy(by_type, type);
}
+#else
+ return GetArgMinMaxFunctionInternal(by_type, type);
+#endif
}
template
@@ -449,17 +493,19 @@ void AddDecimalArgMinMaxFunctionBy(AggregateFunctionSet &fun, const LogicalType
template
void AddGenericArgMinMaxFunction(AggregateFunctionSet &fun) {
- using STATE = ArgMinMaxState;
- fun.AddFunction(
- AggregateFunction({LogicalType::ANY, LogicalType::ANY}, LogicalType::ANY, AggregateFunction::StateSize,
- AggregateFunction::StateInitialize, OP::template Update,
- AggregateFunction::StateCombine, AggregateFunction::StateVoidFinalize,
- nullptr, OP::Bind, AggregateFunction::StateDestroy));
+ fun.AddFunction(GetGenericArgMinMaxFunction());
}
template
static void AddArgMinMaxFunctions(AggregateFunctionSet &fun) {
+ using GENERIC_VECTOR_OP = VectorArgMinMaxBase>;
+#ifndef DUCKDB_SMALLER_BINARY
using OP = ArgMinMaxBase;
+ using VECTOR_OP = VectorArgMinMaxBase;
+#else
+ using OP = GENERIC_VECTOR_OP;
+ using VECTOR_OP = GENERIC_VECTOR_OP;
+#endif
AddArgMinMaxFunctionBy(fun, LogicalType::INTEGER);
AddArgMinMaxFunctionBy(fun, LogicalType::BIGINT);
AddArgMinMaxFunctionBy(fun, LogicalType::DOUBLE);
@@ -474,11 +520,9 @@ static void AddArgMinMaxFunctions(AggregateFunctionSet &fun) {
AddDecimalArgMinMaxFunctionBy(fun, by_type);
}
- using VECTOR_OP = VectorArgMinMaxBase;
AddVectorArgMinMaxFunctionBy(fun, LogicalType::ANY);
// we always use LessThan when using sort keys because the ORDER_TYPE takes care of selecting the lowest or highest
- using GENERIC_VECTOR_OP = VectorArgMinMaxBase>;
AddGenericArgMinMaxFunction(fun);
}
@@ -577,7 +621,7 @@ static void SpecializeArgMinMaxNFunction(AggregateFunction &function) {
using OP = MinMaxNOperation;
function.state_size = AggregateFunction::StateSize;
- function.initialize = AggregateFunction::StateInitialize;
+ function.initialize = AggregateFunction::StateInitialize;
function.combine = AggregateFunction::StateCombine;
function.destructor = AggregateFunction::StateDestroy;
@@ -588,6 +632,7 @@ static void SpecializeArgMinMaxNFunction(AggregateFunction &function) {
template
static void SpecializeArgMinMaxNFunction(PhysicalType arg_type, AggregateFunction &function) {
switch (arg_type) {
+#ifndef DUCKDB_SMALLER_BINARY
case PhysicalType::VARCHAR:
SpecializeArgMinMaxNFunction(function);
break;
@@ -603,6 +648,7 @@ static void SpecializeArgMinMaxNFunction(PhysicalType arg_type, AggregateFunctio
case PhysicalType::DOUBLE:
SpecializeArgMinMaxNFunction, COMPARATOR>(function);
break;
+#endif
default:
SpecializeArgMinMaxNFunction(function);
break;
@@ -612,6 +658,7 @@ static void SpecializeArgMinMaxNFunction(PhysicalType arg_type, AggregateFunctio
template
static void SpecializeArgMinMaxNFunction(PhysicalType val_type, PhysicalType arg_type, AggregateFunction &function) {
switch (val_type) {
+#ifndef DUCKDB_SMALLER_BINARY
case PhysicalType::VARCHAR:
SpecializeArgMinMaxNFunction(arg_type, function);
break;
@@ -627,6 +674,7 @@ static void SpecializeArgMinMaxNFunction(PhysicalType val_type, PhysicalType arg
case PhysicalType::DOUBLE:
SpecializeArgMinMaxNFunction, COMPARATOR>(arg_type, function);
break;
+#endif
default:
SpecializeArgMinMaxNFunction(arg_type, function);
break;
diff --git a/src/duckdb/src/core_functions/aggregate/distributive/bitagg.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/bitagg.cpp
similarity index 99%
rename from src/duckdb/src/core_functions/aggregate/distributive/bitagg.cpp
rename to src/duckdb/extension/core_functions/aggregate/distributive/bitagg.cpp
index af305635..241d2569 100644
--- a/src/duckdb/src/core_functions/aggregate/distributive/bitagg.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/distributive/bitagg.cpp
@@ -1,4 +1,4 @@
-#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
+#include "core_functions/aggregate/distributive_functions.hpp"
#include "duckdb/common/exception.hpp"
#include "duckdb/common/types/null_value.hpp"
#include "duckdb/common/vector_operations/vector_operations.hpp"
diff --git a/src/duckdb/src/core_functions/aggregate/distributive/bitstring_agg.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/bitstring_agg.cpp
similarity index 91%
rename from src/duckdb/src/core_functions/aggregate/distributive/bitstring_agg.cpp
rename to src/duckdb/extension/core_functions/aggregate/distributive/bitstring_agg.cpp
index 36920a47..4e8143c7 100644
--- a/src/duckdb/src/core_functions/aggregate/distributive/bitstring_agg.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/distributive/bitstring_agg.cpp
@@ -1,4 +1,4 @@
-#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
+#include "core_functions/aggregate/distributive_functions.hpp"
#include "duckdb/common/exception.hpp"
#include "duckdb/common/types/null_value.hpp"
#include "duckdb/common/vector_operations/aggregate_executor.hpp"
@@ -8,6 +8,8 @@
#include "duckdb/execution/expression_executor.hpp"
#include "duckdb/common/types/cast_helpers.hpp"
#include "duckdb/common/operator/subtract.hpp"
+#include "duckdb/common/serializer/deserializer.hpp"
+#include "duckdb/common/serializer/serializer.hpp"
namespace duckdb {
@@ -43,6 +45,21 @@ struct BitstringAggBindData : public FunctionData {
}
return false;
}
+
+ static void Serialize(Serializer &serializer, const optional_ptr bind_data_p,
+ const AggregateFunction &) {
+ auto &bind_data = bind_data_p->Cast();
+ serializer.WriteProperty(100, "min", bind_data.min);
+ serializer.WriteProperty(101, "max", bind_data.max);
+ }
+
+ static unique_ptr Deserialize(Deserializer &deserializer, AggregateFunction &) {
+ Value min;
+ Value max;
+ deserializer.ReadProperty(100, "min", min);
+ deserializer.ReadProperty(101, "max", max);
+ return make_uniq(min, max);
+ }
};
struct BitStringAggOperation {
@@ -247,7 +264,9 @@ static void BindBitString(AggregateFunctionSet &bitstring_agg, const LogicalType
auto function =
AggregateFunction::UnaryAggregateDestructor, TYPE, string_t, BitStringAggOperation>(
type, LogicalType::BIT);
- function.bind = BindBitstringAgg; // create new a 'BitstringAggBindData'
+ function.bind = BindBitstringAgg; // create new a 'BitstringAggBindData'
+ function.serialize = BitstringAggBindData::Serialize;
+ function.deserialize = BitstringAggBindData::Deserialize;
function.statistics = BitstringPropagateStats; // stores min and max from column stats in BitstringAggBindData
bitstring_agg.AddFunction(function); // uses the BitstringAggBindData to access statistics for creating bitstring
function.arguments = {type, type, type};
diff --git a/src/duckdb/src/core_functions/aggregate/distributive/bool.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/bool.cpp
similarity index 93%
rename from src/duckdb/src/core_functions/aggregate/distributive/bool.cpp
rename to src/duckdb/extension/core_functions/aggregate/distributive/bool.cpp
index 20f2f3ba..9b781f84 100644
--- a/src/duckdb/src/core_functions/aggregate/distributive/bool.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/distributive/bool.cpp
@@ -1,4 +1,4 @@
-#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
+#include "core_functions/aggregate/distributive_functions.hpp"
#include "duckdb/common/exception.hpp"
#include "duckdb/common/vector_operations/vector_operations.hpp"
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
@@ -95,6 +95,7 @@ AggregateFunction BoolOrFun::GetFunction() {
auto fun = AggregateFunction::UnaryAggregate(
LogicalType(LogicalTypeId::BOOLEAN), LogicalType::BOOLEAN);
fun.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
+ fun.distinct_dependent = AggregateDistinctDependent::NOT_DISTINCT_DEPENDENT;
return fun;
}
@@ -102,6 +103,7 @@ AggregateFunction BoolAndFun::GetFunction() {
auto fun = AggregateFunction::UnaryAggregate(
LogicalType(LogicalTypeId::BOOLEAN), LogicalType::BOOLEAN);
fun.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
+ fun.distinct_dependent = AggregateDistinctDependent::NOT_DISTINCT_DEPENDENT;
return fun;
}
diff --git a/src/duckdb/src/core_functions/aggregate/distributive/kurtosis.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/kurtosis.cpp
similarity index 98%
rename from src/duckdb/src/core_functions/aggregate/distributive/kurtosis.cpp
rename to src/duckdb/extension/core_functions/aggregate/distributive/kurtosis.cpp
index bca51bd1..4f9f6f30 100644
--- a/src/duckdb/src/core_functions/aggregate/distributive/kurtosis.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/distributive/kurtosis.cpp
@@ -1,4 +1,4 @@
-#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
+#include "core_functions/aggregate/distributive_functions.hpp"
#include "duckdb/common/exception.hpp"
#include "duckdb/common/vector_operations/vector_operations.hpp"
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
diff --git a/src/duckdb/src/core_functions/aggregate/distributive/product.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/product.cpp
similarity index 95%
rename from src/duckdb/src/core_functions/aggregate/distributive/product.cpp
rename to src/duckdb/extension/core_functions/aggregate/distributive/product.cpp
index fbe76617..324893f6 100644
--- a/src/duckdb/src/core_functions/aggregate/distributive/product.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/distributive/product.cpp
@@ -1,4 +1,4 @@
-#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
+#include "core_functions/aggregate/distributive_functions.hpp"
#include "duckdb/common/exception.hpp"
#include "duckdb/common/vector_operations/vector_operations.hpp"
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
diff --git a/src/duckdb/src/core_functions/aggregate/distributive/skew.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/skew.cpp
similarity index 96%
rename from src/duckdb/src/core_functions/aggregate/distributive/skew.cpp
rename to src/duckdb/extension/core_functions/aggregate/distributive/skew.cpp
index ef42dce4..12f23761 100644
--- a/src/duckdb/src/core_functions/aggregate/distributive/skew.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/distributive/skew.cpp
@@ -1,4 +1,4 @@
-#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
+#include "core_functions/aggregate/distributive_functions.hpp"
#include "duckdb/common/exception.hpp"
#include "duckdb/common/vector_operations/vector_operations.hpp"
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
@@ -62,7 +62,7 @@ struct SkewnessOperation {
}
double div = std::sqrt(p);
if (div == 0) {
- finalize_data.ReturnNull();
+ target = NAN;
return;
}
double temp1 = std::sqrt(n * (n - 1)) / (n - 2);
diff --git a/src/duckdb/src/core_functions/aggregate/distributive/string_agg.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/string_agg.cpp
similarity index 98%
rename from src/duckdb/src/core_functions/aggregate/distributive/string_agg.cpp
rename to src/duckdb/extension/core_functions/aggregate/distributive/string_agg.cpp
index f2caa890..b694a236 100644
--- a/src/duckdb/src/core_functions/aggregate/distributive/string_agg.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/distributive/string_agg.cpp
@@ -1,4 +1,4 @@
-#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
+#include "core_functions/aggregate/distributive_functions.hpp"
#include "duckdb/common/exception.hpp"
#include "duckdb/common/types/null_value.hpp"
#include "duckdb/common/vector_operations/vector_operations.hpp"
diff --git a/src/duckdb/src/core_functions/aggregate/distributive/sum.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/sum.cpp
similarity index 94%
rename from src/duckdb/src/core_functions/aggregate/distributive/sum.cpp
rename to src/duckdb/extension/core_functions/aggregate/distributive/sum.cpp
index 3aa254e3..be37d5df 100644
--- a/src/duckdb/src/core_functions/aggregate/distributive/sum.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/distributive/sum.cpp
@@ -1,5 +1,5 @@
-#include "duckdb/core_functions/aggregate/distributive_functions.hpp"
-#include "duckdb/core_functions/aggregate/sum_helpers.hpp"
+#include "core_functions/aggregate/distributive_functions.hpp"
+#include "core_functions/aggregate/sum_helpers.hpp"
#include "duckdb/common/exception.hpp"
#include "duckdb/common/types/decimal.hpp"
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
@@ -157,6 +157,12 @@ unique_ptr SumPropagateStats(ClientContext &context, BoundAggreg
AggregateFunction GetSumAggregate(PhysicalType type) {
switch (type) {
+ case PhysicalType::BOOL: {
+ auto function = AggregateFunction::UnaryAggregate, bool, hugeint_t, IntegerSumOperation>(
+ LogicalType::BOOLEAN, LogicalType::HUGEINT);
+ function.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
+ return function;
+ }
case PhysicalType::INT16: {
auto function = AggregateFunction::UnaryAggregate, int16_t, hugeint_t, IntegerSumOperation>(
LogicalType::SMALLINT, LogicalType::HUGEINT);
@@ -209,6 +215,7 @@ AggregateFunctionSet SumFun::GetFunctions() {
sum.AddFunction(AggregateFunction({LogicalTypeId::DECIMAL}, LogicalTypeId::DECIMAL, nullptr, nullptr, nullptr,
nullptr, nullptr, FunctionNullHandling::DEFAULT_NULL_HANDLING, nullptr,
BindDecimalSum));
+ sum.AddFunction(GetSumAggregate(PhysicalType::BOOL));
sum.AddFunction(GetSumAggregate(PhysicalType::INT16));
sum.AddFunction(GetSumAggregate(PhysicalType::INT32));
sum.AddFunction(GetSumAggregate(PhysicalType::INT64));
@@ -218,6 +225,10 @@ AggregateFunctionSet SumFun::GetFunctions() {
return sum;
}
+AggregateFunction CountIfFun::GetFunction() {
+ return GetSumAggregate(PhysicalType::BOOL);
+}
+
AggregateFunctionSet SumNoOverflowFun::GetFunctions() {
AggregateFunctionSet sum_no_overflow;
sum_no_overflow.AddFunction(GetSumAggregateNoOverflow(PhysicalType::INT32));
diff --git a/src/duckdb/src/core_functions/aggregate/holistic/approx_top_k.cpp b/src/duckdb/extension/core_functions/aggregate/holistic/approx_top_k.cpp
similarity index 92%
rename from src/duckdb/src/core_functions/aggregate/holistic/approx_top_k.cpp
rename to src/duckdb/extension/core_functions/aggregate/holistic/approx_top_k.cpp
index 19b3ae88..4eb2b9d3 100644
--- a/src/duckdb/src/core_functions/aggregate/holistic/approx_top_k.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/holistic/approx_top_k.cpp
@@ -1,6 +1,6 @@
-#include "duckdb/core_functions/aggregate/histogram_helpers.hpp"
-#include "duckdb/core_functions/aggregate/holistic_functions.hpp"
-#include "duckdb/core_functions/aggregate/sort_key_helpers.hpp"
+#include "core_functions/aggregate/histogram_helpers.hpp"
+#include "core_functions/aggregate/holistic_functions.hpp"
+#include "duckdb/function/aggregate/sort_key_helpers.hpp"
#include "duckdb/execution/expression_executor.hpp"
#include "duckdb/common/string_map_set.hpp"
#include "duckdb/common/printer.hpp"
@@ -48,7 +48,7 @@ struct ApproxTopKValue {
uint32_t capacity = 0;
};
-struct ApproxTopKState {
+struct InternalApproxTopKState {
// the top-k data structure has two components
// a list of k values sorted on "count" (i.e. values[0] has the lowest count)
// a lookup map: string_t -> idx in "values" array
@@ -169,15 +169,34 @@ struct ApproxTopKState {
}
};
+struct ApproxTopKState {
+ InternalApproxTopKState *state;
+
+ InternalApproxTopKState &GetState() {
+ if (!state) {
+ state = new InternalApproxTopKState();
+ }
+ return *state;
+ }
+
+ const InternalApproxTopKState &GetState() const {
+ if (!state) {
+ throw InternalException("No state available");
+ }
+ return *state;
+ }
+};
+
struct ApproxTopKOperation {
template
static void Initialize(STATE &state) {
- new (&state) STATE();
+ state.state = nullptr;
}
template
- static void Operation(STATE &state, const TYPE &input, AggregateInputData &aggr_input, Vector &top_k_vector,
+ static void Operation(STATE &aggr_state, const TYPE &input, AggregateInputData &aggr_input, Vector &top_k_vector,
idx_t offset, idx_t count) {
+ auto &state = aggr_state.GetState();
if (state.values.empty()) {
static constexpr int64_t MAX_APPROX_K = 1000000;
// not initialized yet - initialize the K value and set all counters to 0
@@ -208,7 +227,13 @@ struct ApproxTopKOperation {
}
template
- static void Combine(const STATE &source, STATE &target, AggregateInputData &aggr_input) {
+ static void Combine(const STATE &aggr_source, STATE &aggr_target, AggregateInputData &aggr_input) {
+ if (!aggr_source.state) {
+ // source state is empty
+ return;
+ }
+ auto &source = aggr_source.GetState();
+ auto &target = aggr_target.GetState();
if (source.values.empty()) {
// source is empty
return;
@@ -279,7 +304,7 @@ struct ApproxTopKOperation {
template
static void Destroy(STATE &state, AggregateInputData &aggr_input_data) {
- state.~STATE();
+ delete state.state;
}
static bool IgnoreNull() {
@@ -324,7 +349,7 @@ static void ApproxTopKFinalize(Vector &state_vector, AggregateInputData &, Vecto
idx_t new_entries = 0;
// figure out how much space we need
for (idx_t i = 0; i < count; i++) {
- auto &state = *states[sdata.sel->get_index(i)];
+ auto &state = states[sdata.sel->get_index(i)]->GetState();
if (state.values.empty()) {
continue;
}
@@ -340,7 +365,7 @@ static void ApproxTopKFinalize(Vector &state_vector, AggregateInputData &, Vecto
idx_t current_offset = old_len;
for (idx_t i = 0; i < count; i++) {
const auto rid = i + offset;
- auto &state = *states[sdata.sel->get_index(i)];
+ auto &state = states[sdata.sel->get_index(i)]->GetState();
if (state.values.empty()) {
mask.SetInvalid(rid);
continue;
diff --git a/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp b/src/duckdb/extension/core_functions/aggregate/holistic/approximate_quantile.cpp
similarity index 88%
rename from src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp
rename to src/duckdb/extension/core_functions/aggregate/holistic/approximate_quantile.cpp
index 5b6abcd2..23d2cf47 100644
--- a/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/holistic/approximate_quantile.cpp
@@ -1,5 +1,5 @@
#include "duckdb/execution/expression_executor.hpp"
-#include "duckdb/core_functions/aggregate/holistic_functions.hpp"
+#include "core_functions/aggregate/holistic_functions.hpp"
#include "t_digest.hpp"
#include "duckdb/planner/expression.hpp"
#include "duckdb/common/operator/cast_operators.hpp"
@@ -230,13 +230,18 @@ unique_ptr BindApproxQuantile(ClientContext &context, AggregateFun
return make_uniq(quantiles);
}
-unique_ptr BindApproxQuantileDecimal(ClientContext &context, AggregateFunction &function,
- vector> &arguments) {
- auto bind_data = BindApproxQuantile(context, function, arguments);
- function = GetApproximateQuantileDecimalAggregateFunction(arguments[0]->return_type);
+AggregateFunction ApproxQuantileDecimalFunction(const LogicalType &type) {
+ auto function = GetApproximateQuantileDecimalAggregateFunction(type);
function.name = "approx_quantile";
function.serialize = ApproximateQuantileBindData::Serialize;
function.deserialize = ApproximateQuantileBindData::Deserialize;
+ return function;
+}
+
+unique_ptr BindApproxQuantileDecimal(ClientContext &context, AggregateFunction &function,
+ vector> &arguments) {
+ auto bind_data = BindApproxQuantile(context, function, arguments);
+ function = ApproxQuantileDecimalFunction(arguments[0]->return_type);
return bind_data;
}
@@ -344,13 +349,18 @@ AggregateFunction GetApproxQuantileListAggregateFunction(const LogicalType &type
}
}
-unique_ptr BindApproxQuantileDecimalList(ClientContext &context, AggregateFunction &function,
- vector> &arguments) {
- auto bind_data = BindApproxQuantile(context, function, arguments);
- function = GetApproxQuantileListAggregateFunction(arguments[0]->return_type);
+AggregateFunction ApproxQuantileDecimalListFunction(const LogicalType &type) {
+ auto function = GetApproxQuantileListAggregateFunction(type);
function.name = "approx_quantile";
function.serialize = ApproximateQuantileBindData::Serialize;
function.deserialize = ApproximateQuantileBindData::Deserialize;
+ return function;
+}
+
+unique_ptr BindApproxQuantileDecimalList(ClientContext &context, AggregateFunction &function,
+ vector> &arguments) {
+ auto bind_data = BindApproxQuantile(context, function, arguments);
+ function = ApproxQuantileDecimalListFunction(arguments[0]->return_type);
return bind_data;
}
@@ -365,11 +375,39 @@ AggregateFunction GetApproxQuantileListAggregate(const LogicalType &type) {
return fun;
}
+unique_ptr ApproxQuantileDecimalDeserialize(Deserializer &deserializer, AggregateFunction &function) {
+ auto bind_data = ApproximateQuantileBindData::Deserialize(deserializer, function);
+ auto &return_type = deserializer.Get();
+ if (return_type.id() == LogicalTypeId::LIST) {
+ function = ApproxQuantileDecimalListFunction(function.arguments[0]);
+ } else {
+ function = ApproxQuantileDecimalFunction(function.arguments[0]);
+ }
+ return bind_data;
+}
+
+AggregateFunction GetApproxQuantileDecimal() {
+ // stub function - the actual function is set during bind or deserialize
+ AggregateFunction fun({LogicalTypeId::DECIMAL, LogicalType::FLOAT}, LogicalTypeId::DECIMAL, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, BindApproxQuantileDecimal);
+ fun.serialize = ApproximateQuantileBindData::Serialize;
+ fun.deserialize = ApproxQuantileDecimalDeserialize;
+ return fun;
+}
+
+AggregateFunction GetApproxQuantileDecimalList() {
+ // stub function - the actual function is set during bind or deserialize
+ AggregateFunction fun({LogicalTypeId::DECIMAL, LogicalType::LIST(LogicalType::FLOAT)},
+ LogicalType::LIST(LogicalTypeId::DECIMAL), nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, BindApproxQuantileDecimalList);
+ fun.serialize = ApproximateQuantileBindData::Serialize;
+ fun.deserialize = ApproxQuantileDecimalDeserialize;
+ return fun;
+}
+
AggregateFunctionSet ApproxQuantileFun::GetFunctions() {
AggregateFunctionSet approx_quantile;
- approx_quantile.AddFunction(AggregateFunction({LogicalTypeId::DECIMAL, LogicalType::FLOAT}, LogicalTypeId::DECIMAL,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- BindApproxQuantileDecimal));
+ approx_quantile.AddFunction(GetApproxQuantileDecimal());
approx_quantile.AddFunction(GetApproximateQuantileAggregate(LogicalType::SMALLINT));
approx_quantile.AddFunction(GetApproximateQuantileAggregate(LogicalType::INTEGER));
@@ -384,9 +422,7 @@ AggregateFunctionSet ApproxQuantileFun::GetFunctions() {
approx_quantile.AddFunction(GetApproximateQuantileAggregate(LogicalType::TIMESTAMP_TZ));
// List variants
- approx_quantile.AddFunction(AggregateFunction({LogicalTypeId::DECIMAL, LogicalType::LIST(LogicalType::FLOAT)},
- LogicalType::LIST(LogicalTypeId::DECIMAL), nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, BindApproxQuantileDecimalList));
+ approx_quantile.AddFunction(GetApproxQuantileDecimalList());
approx_quantile.AddFunction(GetApproxQuantileListAggregate(LogicalTypeId::TINYINT));
approx_quantile.AddFunction(GetApproxQuantileListAggregate(LogicalTypeId::SMALLINT));
diff --git a/src/duckdb/src/core_functions/aggregate/holistic/mad.cpp b/src/duckdb/extension/core_functions/aggregate/holistic/mad.cpp
similarity index 92%
rename from src/duckdb/src/core_functions/aggregate/holistic/mad.cpp
rename to src/duckdb/extension/core_functions/aggregate/holistic/mad.cpp
index 8be7415f..93516b59 100644
--- a/src/duckdb/src/core_functions/aggregate/holistic/mad.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/holistic/mad.cpp
@@ -1,9 +1,9 @@
#include "duckdb/execution/expression_executor.hpp"
-#include "duckdb/core_functions/aggregate/holistic_functions.hpp"
+#include "core_functions/aggregate/holistic_functions.hpp"
#include "duckdb/planner/expression.hpp"
#include "duckdb/common/operator/cast_operators.hpp"
#include "duckdb/common/operator/abs.hpp"
-#include "duckdb/core_functions/aggregate/quantile_state.hpp"
+#include "core_functions/aggregate/quantile_state.hpp"
namespace duckdb {
@@ -190,12 +190,18 @@ struct MedianAbsoluteDeviationOperation : QuantileOperation {
}
template
- static void Window(const INPUT_TYPE *data, const ValidityMask &fmask, const ValidityMask &dmask,
- AggregateInputData &aggr_input_data, STATE &state, const SubFrames &frames, Vector &result,
- idx_t ridx, const STATE *gstate) {
+ static void Window(AggregateInputData &aggr_input_data, const WindowPartitionInput &partition,
+ const_data_ptr_t g_state, data_ptr_t l_state, const SubFrames &frames, Vector &result,
+ idx_t ridx) {
+ auto &state = *reinterpret_cast(l_state);
+ auto gstate = reinterpret_cast(g_state);
+
+ auto &data = state.GetOrCreateWindowCursor(partition);
+ const auto &fmask = partition.filter_mask;
+
auto rdata = FlatVector::GetData(result);
- QuantileIncluded included(fmask, dmask);
+ QuantileIncluded included(fmask, data);
const auto n = FrameSize(included, frames);
if (!n) {
@@ -259,11 +265,14 @@ AggregateFunction GetTypedMedianAbsoluteDeviationAggregateFunction(const Logical
const LogicalType &target_type) {
using STATE = QuantileState;
using OP = MedianAbsoluteDeviationOperation;
- auto fun = AggregateFunction::UnaryAggregateDestructor(input_type, target_type);
+ auto fun = AggregateFunction::UnaryAggregateDestructor(input_type, target_type);
fun.bind = BindMAD;
fun.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT;
- fun.window = AggregateFunction::UnaryWindow;
+#ifndef DUCKDB_SMALLER_BINARY
+ fun.window = OP::template Window;
fun.window_init = OP::template WindowInit;
+#endif
return fun;
}
diff --git a/src/duckdb/src/core_functions/aggregate/holistic/mode.cpp b/src/duckdb/extension/core_functions/aggregate/holistic/mode.cpp
similarity index 60%
rename from src/duckdb/src/core_functions/aggregate/holistic/mode.cpp
rename to src/duckdb/extension/core_functions/aggregate/holistic/mode.cpp
index a8d0dbf1..bdfa0fc8 100644
--- a/src/duckdb/src/core_functions/aggregate/holistic/mode.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/holistic/mode.cpp
@@ -2,45 +2,22 @@
#include "duckdb/common/uhugeint.hpp"
#include "duckdb/common/vector_operations/vector_operations.hpp"
#include "duckdb/common/operator/comparison_operators.hpp"
-#include "duckdb/core_functions/aggregate/holistic_functions.hpp"
+#include "duckdb/common/types/column/column_data_collection.hpp"
+#include "core_functions/aggregate/distributive_functions.hpp"
+#include "core_functions/aggregate/holistic_functions.hpp"
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
#include "duckdb/common/unordered_map.hpp"
#include "duckdb/common/owning_string_map.hpp"
-#include "duckdb/core_functions/create_sort_key.hpp"
-#include "duckdb/core_functions/aggregate/sort_key_helpers.hpp"
+#include "duckdb/function/create_sort_key.hpp"
+#include "duckdb/function/aggregate/sort_key_helpers.hpp"
+#include "duckdb/common/algorithm.hpp"
#include
// MODE( )
// Returns the most frequent value for the values within expr1.
// NULL values are ignored. If all the values are NULL, or there are 0 rows, then the function returns NULL.
-namespace std {
-
-template <>
-struct hash {
- inline size_t operator()(const duckdb::interval_t &val) const {
- int64_t months, days, micros;
- val.Normalize(months, days, micros);
- return hash {}(duckdb::UnsafeNumericCast(days)) ^
- hash {}(duckdb::UnsafeNumericCast(months)) ^ hash {}(micros);
- }
-};
-
-template <>
-struct hash {
- inline size_t operator()(const duckdb::hugeint_t &val) const {
- return hash {}(val.upper) ^ hash {}(val.lower);
- }
-};
-
-template <>
-struct hash {
- inline size_t operator()(const duckdb::uhugeint_t &val) const {
- return hash {}(val.upper) ^ hash {}(val.lower);
- }
-};
-
-} // namespace std
+namespace std {} // namespace std
namespace duckdb {
@@ -98,6 +75,17 @@ struct ModeState {
bool valid = false;
size_t count = 0;
+ //! The collection being read
+ const ColumnDataCollection *inputs;
+ //! The state used for reading the collection on this thread
+ ColumnDataScanState scan;
+ //! The data chunk paged into into
+ DataChunk page;
+ //! The data pointer
+ const KEY_TYPE *data = nullptr;
+ //! The validity mask
+ const ValidityMask *validity = nullptr;
+
~ModeState() {
if (frequency_map) {
delete frequency_map;
@@ -107,6 +95,45 @@ struct ModeState {
}
}
+ void InitializePage(const WindowPartitionInput &partition) {
+ if (page.ColumnCount() == 0) {
+ D_ASSERT(partition.inputs);
+ inputs = partition.inputs;
+ D_ASSERT(partition.column_ids.size() == 1);
+ inputs->InitializeScan(scan, partition.column_ids);
+ inputs->InitializeScanChunk(scan, page);
+ }
+ }
+
+ inline sel_t RowOffset(idx_t row_idx) const {
+ D_ASSERT(RowIsVisible(row_idx));
+ return UnsafeNumericCast(row_idx - scan.current_row_index);
+ }
+
+ inline bool RowIsVisible(idx_t row_idx) const {
+ return (row_idx < scan.next_row_index && scan.current_row_index <= row_idx);
+ }
+
+ inline idx_t Seek(idx_t row_idx) {
+ if (!RowIsVisible(row_idx)) {
+ D_ASSERT(inputs);
+ inputs->Seek(row_idx, scan, page);
+ data = FlatVector::GetData(page.data[0]);
+ validity = &FlatVector::Validity(page.data[0]);
+ }
+ return RowOffset(row_idx);
+ }
+
+ inline const KEY_TYPE &GetCell(idx_t row_idx) {
+ const auto offset = Seek(row_idx);
+ return data[offset];
+ }
+
+ inline bool RowIsValid(idx_t row_idx) {
+ const auto offset = Seek(row_idx);
+ return validity->RowIsValid(offset);
+ }
+
void Reset() {
if (frequency_map) {
frequency_map->clear();
@@ -116,7 +143,8 @@ struct ModeState {
valid = false;
}
- void ModeAdd(const KEY_TYPE &key, idx_t row) {
+ void ModeAdd(idx_t row) {
+ const auto &key = GetCell(row);
auto &attr = (*frequency_map)[key];
auto new_count = (attr.count += 1);
if (new_count == 1) {
@@ -136,7 +164,8 @@ struct ModeState {
}
}
- void ModeRm(const KEY_TYPE &key, idx_t frame) {
+ void ModeRm(idx_t frame) {
+ const auto &key = GetCell(frame);
auto &attr = (*frequency_map)[key];
auto old_count = attr.count;
nonzero -= size_t(old_count == 1);
@@ -162,16 +191,16 @@ struct ModeState {
}
};
+template
struct ModeIncluded {
- inline explicit ModeIncluded(const ValidityMask &fmask_p, const ValidityMask &dmask_p)
- : fmask(fmask_p), dmask(dmask_p) {
+ inline explicit ModeIncluded(const ValidityMask &fmask_p, STATE &state) : fmask(fmask_p), state(state) {
}
inline bool operator()(const idx_t &idx) const {
- return fmask.RowIsValid(idx) && dmask.RowIsValid(idx);
+ return fmask.RowIsValid(idx) && state.RowIsValid(idx);
}
const ValidityMask &fmask;
- const ValidityMask &dmask;
+ STATE &state;
};
template
@@ -205,6 +234,7 @@ struct BaseModeFunction {
if (!target.frequency_map) {
// Copy - don't destroy! Otherwise windowing will break.
target.frequency_map = new typename STATE::Counts(*source.frequency_map);
+ target.count = source.count;
return;
}
for (auto &val : *source.frequency_map) {
@@ -226,7 +256,21 @@ struct BaseModeFunction {
};
template
-struct ModeFunction : BaseModeFunction {
+struct TypedModeFunction : BaseModeFunction {
+ template
+ static void ConstantOperation(STATE &state, const INPUT_TYPE &key, AggregateUnaryInput &aggr_input, idx_t count) {
+ if (!state.frequency_map) {
+ state.frequency_map = TYPE_OP::CreateEmpty(aggr_input.input.allocator);
+ }
+ auto &i = (*state.frequency_map)[key];
+ i.count += count;
+ i.first_row = MinValue(i.first_row, state.count);
+ state.count += count;
+ }
+};
+
+template
+struct ModeFunction : TypedModeFunction {
template
static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
if (!state.frequency_map) {
@@ -241,25 +285,12 @@ struct ModeFunction : BaseModeFunction {
}
}
- template
- static void ConstantOperation(STATE &state, const INPUT_TYPE &key, AggregateUnaryInput &aggr_input, idx_t count) {
- if (!state.frequency_map) {
- state.frequency_map = TYPE_OP::CreateEmpty(aggr_input.input.allocator);
- }
- auto &i = (*state.frequency_map)[key];
- i.count += count;
- i.first_row = MinValue(i.first_row, state.count);
- state.count += count;
- }
-
template
struct UpdateWindowState {
STATE &state;
- const INPUT_TYPE *data;
- ModeIncluded &included;
+ ModeIncluded &included;
- inline UpdateWindowState(STATE &state, const INPUT_TYPE *data, ModeIncluded &included)
- : state(state), data(data), included(included) {
+ inline UpdateWindowState(STATE &state, ModeIncluded &included) : state(state), included(included) {
}
inline void Neither(idx_t begin, idx_t end) {
@@ -268,7 +299,7 @@ struct ModeFunction : BaseModeFunction {
inline void Left(idx_t begin, idx_t end) {
for (; begin < end; ++begin) {
if (included(begin)) {
- state.ModeRm(data[begin], begin);
+ state.ModeRm(begin);
}
}
}
@@ -276,7 +307,7 @@ struct ModeFunction : BaseModeFunction {
inline void Right(idx_t begin, idx_t end) {
for (; begin < end; ++begin) {
if (included(begin)) {
- state.ModeAdd(data[begin], begin);
+ state.ModeAdd(begin);
}
}
}
@@ -286,9 +317,14 @@ struct ModeFunction : BaseModeFunction {
};
template
- static void Window(const INPUT_TYPE *data, const ValidityMask &fmask, const ValidityMask &dmask,
- AggregateInputData &aggr_input_data, STATE &state, const SubFrames &frames, Vector &result,
- idx_t rid, const STATE *gstate) {
+ static void Window(AggregateInputData &aggr_input_data, const WindowPartitionInput &partition,
+ const_data_ptr_t g_state, data_ptr_t l_state, const SubFrames &frames, Vector &result,
+ idx_t rid) {
+ auto &state = *reinterpret_cast(l_state);
+
+ state.InitializePage(partition);
+ const auto &fmask = partition.filter_mask;
+
auto rdata = FlatVector::GetData(result);
auto &rmask = FlatVector::Validity(result);
auto &prevs = state.prevs;
@@ -296,7 +332,7 @@ struct ModeFunction : BaseModeFunction {
prevs.resize(1);
}
- ModeIncluded included(fmask, dmask);
+ ModeIncluded included(fmask, state);
if (!state.frequency_map) {
state.frequency_map = TYPE_OP::CreateEmpty(Allocator::DefaultAllocator());
@@ -309,13 +345,13 @@ struct ModeFunction : BaseModeFunction {
for (const auto &frame : frames) {
for (auto i = frame.start; i < frame.end; ++i) {
if (included(i)) {
- state.ModeAdd(data[i], i);
+ state.ModeAdd(i);
}
}
}
} else {
using Updater = UpdateWindowState;
- Updater updater(state, data, included);
+ Updater updater(state, included);
AggregateExecutor::IntersectFrames(prevs, frames, updater);
}
@@ -358,28 +394,31 @@ struct ModeFallbackFunction : BaseModeFunction {
}
};
-template >
-AggregateFunction GetTypedModeFunction(const LogicalType &type) {
- using STATE = ModeState;
- using OP = ModeFunction;
- auto func = AggregateFunction::UnaryAggregateDestructor(type, type);
- func.window = AggregateFunction::UnaryWindow;
- return func;
-}
-
AggregateFunction GetFallbackModeFunction(const LogicalType &type) {
using STATE = ModeState;
using OP = ModeFallbackFunction;
AggregateFunction aggr({type}, type, AggregateFunction::StateSize,
- AggregateFunction::StateInitialize,
+ AggregateFunction::StateInitialize,
AggregateSortKeyHelpers::UnaryUpdate, AggregateFunction::StateCombine,
AggregateFunction::StateVoidFinalize, nullptr);
aggr.destructor = AggregateFunction::StateDestroy;
return aggr;
}
+template >
+AggregateFunction GetTypedModeFunction(const LogicalType &type) {
+ using STATE = ModeState;
+ using OP = ModeFunction;
+ auto func =
+ AggregateFunction::UnaryAggregateDestructor(
+ type, type);
+ func.window = OP::template Window;
+ return func;
+}
+
AggregateFunction GetModeAggregate(const LogicalType &type) {
switch (type.InternalType()) {
+#ifndef DUCKDB_SMALLER_BINARY
case PhysicalType::INT8:
return GetTypedModeFunction(type);
case PhysicalType::UINT8:
@@ -408,6 +447,7 @@ AggregateFunction GetModeAggregate(const LogicalType &type) {
return GetTypedModeFunction(type);
case PhysicalType::VARCHAR:
return GetTypedModeFunction(type);
+#endif
default:
return GetFallbackModeFunction(type);
}
@@ -421,9 +461,107 @@ unique_ptr BindModeAggregate(ClientContext &context, AggregateFunc
}
AggregateFunctionSet ModeFun::GetFunctions() {
- AggregateFunctionSet mode;
+ AggregateFunctionSet mode("mode");
mode.AddFunction(AggregateFunction({LogicalTypeId::ANY}, LogicalTypeId::ANY, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, BindModeAggregate));
return mode;
}
+
+//===--------------------------------------------------------------------===//
+// Entropy
+//===--------------------------------------------------------------------===//
+template
+static double FinalizeEntropy(STATE &state) {
+ if (!state.frequency_map) {
+ return 0;
+ }
+ double count = static_cast(state.count);
+ double entropy = 0;
+ for (auto &val : *state.frequency_map) {
+ double val_sec = static_cast(val.second.count);
+ entropy += (val_sec / count) * log2(count / val_sec);
+ }
+ return entropy;
+}
+
+template
+struct EntropyFunction : TypedModeFunction {
+ template
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
+ target = FinalizeEntropy(state);
+ }
+};
+
+template
+struct EntropyFallbackFunction : BaseModeFunction {
+ template
+ static void Finalize(STATE &state, T &target, AggregateFinalizeData &finalize_data) {
+ target = FinalizeEntropy(state);
+ }
+};
+
+template >
+AggregateFunction GetTypedEntropyFunction(const LogicalType &type) {
+ using STATE = ModeState;
+ using OP = EntropyFunction;
+ auto func =
+ AggregateFunction::UnaryAggregateDestructor(
+ type, LogicalType::DOUBLE);
+ func.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
+ return func;
+}
+
+AggregateFunction GetFallbackEntropyFunction(const LogicalType &type) {
+ using STATE = ModeState;
+ using OP = EntropyFallbackFunction;
+ AggregateFunction func({type}, LogicalType::DOUBLE, AggregateFunction::StateSize,
+ AggregateFunction::StateInitialize,
+ AggregateSortKeyHelpers::UnaryUpdate, AggregateFunction::StateCombine,
+ AggregateFunction::StateFinalize, nullptr);
+ func.destructor = AggregateFunction::StateDestroy;
+ func.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
+ return func;
+}
+
+AggregateFunction GetEntropyFunction(const LogicalType &type) {
+ switch (type.InternalType()) {
+#ifndef DUCKDB_SMALLER_BINARY
+ case PhysicalType::UINT16:
+ return GetTypedEntropyFunction(type);
+ case PhysicalType::UINT32:
+ return GetTypedEntropyFunction(type);
+ case PhysicalType::UINT64:
+ return GetTypedEntropyFunction(type);
+ case PhysicalType::INT16:
+ return GetTypedEntropyFunction(type);
+ case PhysicalType::INT32:
+ return GetTypedEntropyFunction(type);
+ case PhysicalType::INT64:
+ return GetTypedEntropyFunction(type);
+ case PhysicalType::FLOAT:
+ return GetTypedEntropyFunction(type);
+ case PhysicalType::DOUBLE:
+ return GetTypedEntropyFunction(type);
+ case PhysicalType::VARCHAR:
+ return GetTypedEntropyFunction(type);
+#endif
+ default:
+ return GetFallbackEntropyFunction(type);
+ }
+}
+
+unique_ptr BindEntropyAggregate(ClientContext &context, AggregateFunction &function,
+ vector> &arguments) {
+ function = GetEntropyFunction(arguments[0]->return_type);
+ function.name = "entropy";
+ return nullptr;
+}
+
+AggregateFunctionSet EntropyFun::GetFunctions() {
+ AggregateFunctionSet entropy("entropy");
+ entropy.AddFunction(AggregateFunction({LogicalTypeId::ANY}, LogicalType::DOUBLE, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, BindEntropyAggregate));
+ return entropy;
+}
+
} // namespace duckdb
diff --git a/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp b/src/duckdb/extension/core_functions/aggregate/holistic/quantile.cpp
similarity index 91%
rename from src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp
rename to src/duckdb/extension/core_functions/aggregate/holistic/quantile.cpp
index 779ce4de..f8f668af 100644
--- a/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp
+++ b/src/duckdb/extension/core_functions/aggregate/holistic/quantile.cpp
@@ -1,15 +1,15 @@
#include "duckdb/execution/expression_executor.hpp"
-#include "duckdb/core_functions/aggregate/holistic_functions.hpp"
-#include "duckdb/core_functions/aggregate/quantile_enum.hpp"
+#include "core_functions/aggregate/holistic_functions.hpp"
+#include "duckdb/common/enums/quantile_enum.hpp"
#include "duckdb/planner/expression.hpp"
#include "duckdb/common/operator/cast_operators.hpp"
#include "duckdb/common/operator/abs.hpp"
-#include "duckdb/core_functions/aggregate/quantile_state.hpp"
+#include "core_functions/aggregate/quantile_state.hpp"
#include "duckdb/common/types/timestamp.hpp"
#include "duckdb/common/queue.hpp"
#include "duckdb/common/serializer/serializer.hpp"
#include "duckdb/common/serializer/deserializer.hpp"
-#include "duckdb/core_functions/aggregate/sort_key_helpers.hpp"
+#include "duckdb/function/aggregate/sort_key_helpers.hpp"
namespace duckdb {
@@ -208,10 +208,16 @@ struct QuantileScalarOperation : public QuantileOperation {
}
template
- static void Window(const INPUT_TYPE *data, const ValidityMask &fmask, const ValidityMask &dmask,
- AggregateInputData &aggr_input_data, STATE &state, const SubFrames &frames, Vector &result,
- idx_t ridx, const STATE *gstate) {
- QuantileIncluded included(fmask, dmask);
+ static void Window(AggregateInputData &aggr_input_data, const WindowPartitionInput &partition,
+ const_data_ptr_t g_state, data_ptr_t l_state, const SubFrames &frames, Vector &result,
+ idx_t ridx) {
+ auto &state = *reinterpret_cast(l_state);
+ auto gstate = reinterpret_cast(g_state);
+
+ auto &data = state.GetOrCreateWindowCursor(partition);
+ const auto &fmask = partition.filter_mask;
+
+ QuantileIncluded included(fmask, data);
const auto n = FrameSize(included, frames);
D_ASSERT(aggr_input_data.bind_data);
@@ -305,13 +311,19 @@ struct QuantileListOperation : QuantileOperation {
}
template
- static void Window(const INPUT_TYPE *data, const ValidityMask &fmask, const ValidityMask &dmask,
- AggregateInputData &aggr_input_data, STATE &state, const SubFrames &frames, Vector &list,
- idx_t lidx, const STATE *gstate) {
+ static void Window(AggregateInputData &aggr_input_data, const WindowPartitionInput &partition,
+ const_data_ptr_t g_state, data_ptr_t l_state, const SubFrames &frames, Vector &list,
+ idx_t lidx) {
+ auto &state = *reinterpret_cast(l_state);
+ auto gstate = reinterpret_cast(g_state);
+
+ auto &data = state.GetOrCreateWindowCursor(partition);
+ const auto &fmask = partition.filter_mask;
+
D_ASSERT(aggr_input_data.bind_data);
auto &bind_data = aggr_input_data.bind_data->Cast();
- QuantileIncluded included(fmask, dmask);
+ QuantileIncluded included(fmask, data);
const auto n = FrameSize(included, frames);
// Result is a constant LIST with a fixed length
@@ -378,6 +390,7 @@ struct QuantileListFallback : QuantileOperation {
template
AggregateFunction GetDiscreteQuantileTemplated(const LogicalType &type) {
switch (type.InternalType()) {
+#ifndef DUCKDB_SMALLER_BINARY
case PhysicalType::INT8:
return OP::template GetFunction(type);
case PhysicalType::INT16:
@@ -396,6 +409,7 @@ AggregateFunction GetDiscreteQuantileTemplated(const LogicalType &type) {
return OP::template GetFunction(type);
case PhysicalType::VARCHAR:
return OP::template GetFunction(type);
+#endif
default:
return OP::GetFallback(type);
}
@@ -406,9 +420,12 @@ struct ScalarDiscreteQuantile {
static AggregateFunction GetFunction(const LogicalType &type) {
using STATE = QuantileState;
using OP = QuantileScalarOperation;
- auto fun = AggregateFunction::UnaryAggregateDestructor(type, type);
- fun.window = AggregateFunction::UnaryWindow;
+ auto fun = AggregateFunction::UnaryAggregateDestructor(type, type);
+#ifndef DUCKDB_SMALLER_BINARY
+ fun.window = OP::Window;
fun.window_init = OP::WindowInit;
+#endif
return fun;
}
@@ -416,11 +433,12 @@ struct ScalarDiscreteQuantile {
using STATE = QuantileState;
using OP = QuantileScalarFallback;
- AggregateFunction fun(
- {type}, type, AggregateFunction::StateSize, AggregateFunction::StateInitialize,
- AggregateSortKeyHelpers::UnaryUpdate, AggregateFunction::StateCombine,
- AggregateFunction::StateVoidFinalize, nullptr, nullptr,
- AggregateFunction::StateDestroy);
+ AggregateFunction fun({type}, type, AggregateFunction::StateSize,
+ AggregateFunction::StateInitialize,
+ AggregateSortKeyHelpers::UnaryUpdate,
+ AggregateFunction::StateCombine,
+ AggregateFunction::StateVoidFinalize, nullptr, nullptr,
+ AggregateFunction::StateDestroy);
return fun;
}
};
@@ -429,7 +447,8 @@ template