Skip to content

Commit

Permalink
Update vendored DuckDB sources to 9785b5d
Browse files Browse the repository at this point in the history
  • Loading branch information
duckdblabs-bot committed Sep 26, 2024
1 parent 9785b5d commit 3c5cab5
Show file tree
Hide file tree
Showing 19 changed files with 129 additions and 176 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt

Large diffs are not rendered by default.

45 changes: 1 addition & 44 deletions src/duckdb/src/common/extra_type_info.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#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 @@ -220,50 +221,6 @@ 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: 0 additions & 1 deletion src/duckdb/src/core_functions/function_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ 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 @@ -41,7 +41,7 @@ void MatchAndReplace(CSVOption<T> &original, CSVOption<T> &sniffed, const string
// We verify that the user input matches the sniffed value
if (original != sniffed) {
error += "CSV Sniffer: Sniffer detected value different than the user input for the " + name;
error += " options \n Set: " + original.FormatValue() + " Sniffed: " + sniffed.FormatValue() + "\n";
error += " options \n Set: " + original.FormatValue() + ", Sniffed: " + sniffed.FormatValue() + "\n";
}
} else {
// We replace the value of original with the sniffed value
Expand Down Expand Up @@ -228,8 +228,8 @@ SnifferResult CSVSniffer::SniffCSV(bool force_match) {
if (set_names.size() == names.size()) {
for (idx_t i = 0; i < set_columns.Size(); i++) {
if (set_names[i] != names[i]) {
header_error += "Column at position: " + to_string(i) + " Set name: " + set_names[i] +
" Sniffed Name: " + names[i] + "\n";
header_error += "Column at position: " + to_string(i) + ", Set name: " + set_names[i] +
", Sniffed Name: " + names[i] + "\n";
match = false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ bool CSVSniffer::DetectHeaderWithSetColumn(ClientContext &context, vector<Header
return false;
}
if (best_header_row[i].value != (*set_columns.names)[i]) {
error << "Header Mismatch at position:" << i << "\n";
error << "Expected Name: \"" << (*set_columns.names)[i] << "\".";
error << "Actual Name: \"" << best_header_row[i].value << "\"."
error << "Header mismatch at position: " << i << "\n";
error << "Expected name: \"" << (*set_columns.names)[i] << "\", ";
error << "Actual name: \"" << best_header_row[i].value << "\"."
<< "\n";
has_header = false;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ string CSVReaderOptions::ToString(const string &current_file_path) const {
auto &skip_rows = dialect_options.skip_rows;

auto &header = dialect_options.header;
string error = " file=" + current_file_path + "\n ";
string error = " file = " + current_file_path + "\n ";
// Let's first print options that can either be set by the user or by the sniffer
// delimiter
error += FormatOptionLine("delimiter", delimiter);
Expand All @@ -427,13 +427,13 @@ string CSVReaderOptions::ToString(const string &current_file_path) const {

// Now we do options that can only be set by the user, that might hold some general significance
// null padding
error += "null_padding=" + std::to_string(null_padding) + "\n ";
error += "null_padding = " + std::to_string(null_padding) + "\n ";
// sample_size
error += "sample_size=" + std::to_string(sample_size_chunks * STANDARD_VECTOR_SIZE) + "\n ";
error += "sample_size = " + std::to_string(sample_size_chunks * STANDARD_VECTOR_SIZE) + "\n ";
// ignore_errors
error += "ignore_errors=" + ignore_errors.FormatValue() + "\n ";
error += "ignore_errors = " + ignore_errors.FormatValue() + "\n ";
// all_varchar
error += "all_varchar=" + std::to_string(all_varchar) + "\n";
error += "all_varchar = " + std::to_string(all_varchar) + "\n";

// Add information regarding sniffer mismatches (if any)
error += sniffer_user_mismatch_error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ 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 "1"
#define DUCKDB_PATCH_VERSION "2-dev38"
#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.1"
#define DUCKDB_VERSION "v1.1.2-dev38"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "af39bd0dcf"
#define DUCKDB_SOURCE_ID "45559f5eeb"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
7 changes: 3 additions & 4 deletions src/duckdb/src/include/duckdb/common/bitpacking.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,15 @@ 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);
}

// Input was not aligned to BITPACKING_ALGORITHM_GROUP_SIZE, we need a copy
// The input is not aligned to BITPACKING_ALGORITHM_GROUP_SIZE.
// Copy the unaligned count into a zero-initialized temporary group, and pack it.
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,12 +330,6 @@ 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,7 +26,6 @@ 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
2 changes: 2 additions & 0 deletions src/duckdb/src/include/duckdb/parser/transformer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ class Transformer {
//! Transform a range var into a (schema) qualified name
QualifiedName TransformQualifiedName(duckdb_libpgquery::PGRangeVar &root);

//! Transform a Postgres TypeName string into a LogicalType (non-LIST types)
LogicalType TransformTypeNameInternal(duckdb_libpgquery::PGTypeName &name);
//! Transform a Postgres TypeName string into a LogicalType
LogicalType TransformTypeName(duckdb_libpgquery::PGTypeName &name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ 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
Loading

0 comments on commit 3c5cab5

Please sign in to comment.