Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt

Large diffs are not rendered by default.

45 changes: 44 additions & 1 deletion src/duckdb/src/common/extra_type_info.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "duckdb/common/extra_type_info.hpp"
#include "duckdb/common/extra_type_info/enum_type_info.hpp"
#include "duckdb/common/serializer/deserializer.hpp"
#include "duckdb/common/enum_util.hpp"
#include "duckdb/common/numeric_utils.hpp"
Expand Down Expand Up @@ -221,6 +220,50 @@ PhysicalType EnumTypeInfo::DictType(idx_t size) {
}
}

template <class T>
struct EnumTypeInfoTemplated : public EnumTypeInfo {
explicit EnumTypeInfoTemplated(Vector &values_insert_order_p, idx_t size_p)
: EnumTypeInfo(values_insert_order_p, size_p) {
D_ASSERT(values_insert_order_p.GetType().InternalType() == PhysicalType::VARCHAR);

UnifiedVectorFormat vdata;
values_insert_order.ToUnifiedFormat(size_p, vdata);

auto data = UnifiedVectorFormat::GetData<string_t>(vdata);
for (idx_t i = 0; i < size_p; i++) {
auto idx = vdata.sel->get_index(i);
if (!vdata.validity.RowIsValid(idx)) {
throw InternalException("Attempted to create ENUM type with NULL value");
}
if (values.count(data[idx]) > 0) {
throw InvalidInputException("Attempted to create ENUM type with duplicate value %s",
data[idx].GetString());
}
values[data[idx]] = UnsafeNumericCast<T>(i);
}
}

static shared_ptr<EnumTypeInfoTemplated> Deserialize(Deserializer &deserializer, uint32_t size) {
Vector values_insert_order(LogicalType::VARCHAR, size);
auto strings = FlatVector::GetData<string_t>(values_insert_order);

deserializer.ReadList(201, "values", [&](Deserializer::List &list, idx_t i) {
strings[i] = StringVector::AddStringOrBlob(values_insert_order, list.ReadElement<string>());
});
return make_shared_ptr<EnumTypeInfoTemplated>(values_insert_order, size);
}

const string_map_t<T> &GetValues() const {
return values;
}

EnumTypeInfoTemplated(const EnumTypeInfoTemplated &) = delete;
EnumTypeInfoTemplated &operator=(const EnumTypeInfoTemplated &) = delete;

private:
string_map_t<T> values;
};

EnumTypeInfo::EnumTypeInfo(Vector &values_insert_order_p, idx_t dict_size_p)
: ExtraTypeInfo(ExtraTypeInfoType::ENUM_TYPE_INFO), values_insert_order(values_insert_order_p),
dict_type(EnumDictType::VECTOR_DICT), dict_size(dict_size_p) {
Expand Down
1 change: 1 addition & 0 deletions src/duckdb/src/core_functions/function_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static const StaticFunctionDefinition internal_functions[] = {
DUCKDB_SCALAR_FUNCTION_SET(BitwiseAndFun),
DUCKDB_SCALAR_FUNCTION_ALIAS(ListHasAnyFunAlias),
DUCKDB_SCALAR_FUNCTION(PowOperatorFun),
DUCKDB_SCALAR_FUNCTION_SET_ALIAS(ListNegativeInnerProductFunAlias),
DUCKDB_SCALAR_FUNCTION_SET_ALIAS(ListDistanceFunAlias),
DUCKDB_SCALAR_FUNCTION_SET(LeftShiftFun),
DUCKDB_SCALAR_FUNCTION_SET_ALIAS(ListCosineDistanceFunAlias),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ void CheckForPerfectJoinOpt(LogicalComparisonJoin &op, PerfectHashJoinStats &joi
if (join_state.build_range > MAX_BUILD_SIZE) {
return;
}
if (NumericStats::Min(stats_build) <= NumericStats::Min(stats_probe) &&
NumericStats::Max(stats_probe) <= NumericStats::Max(stats_build)) {
join_state.is_probe_in_domain = true;
}
join_state.is_build_small = true;
return;
}
Expand Down
6 changes: 3 additions & 3 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "2-dev27"
#define DUCKDB_PATCH_VERSION "1"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 1
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.1.2-dev27"
#define DUCKDB_VERSION "v1.1.1"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "12e9777cf6"
#define DUCKDB_SOURCE_ID "af39bd0dcf"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
7 changes: 4 additions & 3 deletions src/duckdb/src/include/duckdb/common/bitpacking.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ class BitpackingPrimitives {
}
} else {
idx_t misaligned_count = count % BITPACKING_ALGORITHM_GROUP_SIZE;
T tmp_buffer[BITPACKING_ALGORITHM_GROUP_SIZE]; // TODO maybe faster on the heap?

count -= misaligned_count;

for (idx_t i = 0; i < count; i += BITPACKING_ALGORITHM_GROUP_SIZE) {
PackGroup<T>(dst + (i * width) / 8, src + i, width);
}

// The input is not aligned to BITPACKING_ALGORITHM_GROUP_SIZE.
// Copy the unaligned count into a zero-initialized temporary group, and pack it.
// Input was not aligned to BITPACKING_ALGORITHM_GROUP_SIZE, we need a copy
if (misaligned_count) {
T tmp_buffer[BITPACKING_ALGORITHM_GROUP_SIZE] = {0};
memcpy(tmp_buffer, src + count, misaligned_count * sizeof(T));
PackGroup<T>(dst + (count * width) / 8, tmp_buffer, width);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,12 @@ struct ListNegativeDotProductFun {
static constexpr const char *Name = "list_negative_dot_product";
};

struct ListNegativeInnerProductFunAlias {
using ALIAS = ListNegativeInnerProductFun;

static constexpr const char *Name = "<#>";
};

struct UnpivotListFun {
static constexpr const char *Name = "unpivot_list";
static constexpr const char *Parameters = "any,...";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct PerfectHashJoinStats {
Value probe_max;
bool is_build_small = false;
bool is_build_dense = false;
bool is_probe_in_domain = false;
idx_t build_range = 0;
idx_t estimated_cardinality = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ class SegmentTree {
}
SegmentNode<T> node;
segment->index = nodes.size();
segment->next = nullptr;
node.row_start = segment->start;
node.node = std::move(segment);
nodes.push_back(std::move(node));
Expand Down
4 changes: 2 additions & 2 deletions src/duckdb/src/planner/table_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ DynamicTableFilterSet::GetFinalTableFilters(const PhysicalTableScan &scan,
auto result = make_uniq<TableFilterSet>();
if (existing_filters) {
for (auto &entry : existing_filters->filters) {
result->PushFilter(entry.first, entry.second->Copy());
result->filters[entry.first] = entry.second->Copy();
}
}
for (auto &entry : filters) {
Expand All @@ -66,7 +66,7 @@ DynamicTableFilterSet::GetFinalTableFilters(const PhysicalTableScan &scan,
// skip row id filters
continue;
}
result->PushFilter(filter.first, filter.second->Copy());
result->filters[filter.first] = filter.second->Copy();
}
}
if (result->filters.empty()) {
Expand Down
10 changes: 3 additions & 7 deletions src/duckdb/src/storage/compression/bitpacking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,10 @@ struct BitpackingState {
delta_required_bitwidth, static_cast<T>(minimum_delta), delta_offset,
compression_buffer, compression_buffer_idx, data_ptr);

// FOR (frame of reference).
total_size += sizeof(T);
// Aligned bitpacking width.
total_size += AlignValue(sizeof(bitpacking_width_t));
// Delta offset.
total_size += sizeof(T);
// Compressed data size.
total_size += BitpackingPrimitives::GetRequiredSize(compression_buffer_idx, delta_required_bitwidth);
total_size += sizeof(T); // FOR value
total_size += sizeof(T); // Delta offset value
total_size += AlignValue(sizeof(bitpacking_width_t)); // FOR value

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/duckdb/src/storage/table/row_group_collection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,8 @@ unique_ptr<CheckpointTask> RowGroupCollection::GetCheckpointTask(CollectionCheck
}

void RowGroupCollection::Checkpoint(TableDataWriter &writer, TableStatistics &global_stats) {
auto segments = row_groups->MoveSegments();
auto l = row_groups->Lock();
auto segments = row_groups->MoveSegments(l);

CollectionCheckpointState checkpoint_state(*this, writer, segments, global_stats);

Expand Down
12 changes: 6 additions & 6 deletions src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,17 +348,17 @@

#include "extension/icu/third_party/icu/i18n/wintzimpl.cpp"

#include "extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.cpp"

#include "extension/icu/third_party/icu/i18n/double-conversion-cached-powers.cpp"

#include "extension/icu/third_party/icu/i18n/double-conversion-strtod.cpp"

#include "extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp"

#include "extension/icu/third_party/icu/i18n/double-conversion-bignum-dtoa.cpp"

#include "extension/icu/third_party/icu/i18n/double-conversion-bignum.cpp"

#include "extension/icu/third_party/icu/i18n/double-conversion-cached-powers.cpp"

#include "extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp"

#include "extension/icu/third_party/icu/i18n/double-conversion-string-to-double.cpp"

#include "extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.cpp"

Loading