Skip to content

Commit

Permalink
Merge branch 'duckdb:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
meztez authored Jan 9, 2025
2 parents eac5dfa + d732c12 commit 2277771
Show file tree
Hide file tree
Showing 97 changed files with 1,510 additions and 658 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: duckdb
Title: DBI Package for the DuckDB Database Management System
Version: 1.1.3.9033
Version: 1.1.3.9035
Authors@R: c(
person("Hannes", "Mühleisen", , "[email protected]", role = "aut",
comment = c(ORCID = "0000-0001-8552-0029")),
Expand Down
44 changes: 44 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
<!-- NEWS.md is maintained by https://fledge.cynkra.com, contributors should not edit this file -->

# duckdb 1.1.3.9035

## vendor

- Update vendored sources to duckdb/duckdb@dcb9627543af52e4322de464003259a6b0e7fdb4 (#980).

- Update vendored sources to duckdb/duckdb@69dff93d1a956c68eb9dc603d24d06719e57749d (#979).

- Update vendored sources to duckdb/duckdb@ce33de966a521d1a6e86ec9579e133ff2b2534f4 (#978).

- Update vendored sources to duckdb/duckdb@c8fa9aee7858909c625b5c3abcc3a257c5d9d934 (#977).


# duckdb 1.1.3.9034

## vendor

- Update vendored sources to duckdb/duckdb@acdbf60889033d2701a5fef360a19963cafea471 (#974).

- Update vendored sources to duckdb/duckdb@2edfde3071cdc3ccc6047773e8229fb80238443d (#973).

- Update vendored sources to duckdb/duckdb@3c0db29b2bf182105c1537ddf2fa8b12d186941d (#972).

- Update vendored sources to duckdb/duckdb@5705d13dbf1d4f3db3e4f36d3194f669aaf99bc0 (#971).

- Update vendored sources to duckdb/duckdb@41d13ad1612b3e91ff7a9a5c17edd6fdf51073f1 (#970).

- Update vendored sources to duckdb/duckdb@52032a5b00d4f11376f4ba106753629aea87c0a8 (#969).

- Update vendored sources to duckdb/duckdb@add512094d022fec50354208f908c3d60f3755a5 (#968).

- Update vendored sources to duckdb/duckdb@d42c34cbd62061e5088fc1b81ced0c1008fa58ea (#967).

- Update vendored sources to duckdb/duckdb@35bf611cc4832ceb2f20ec70a2597d0765618610 (duckdb/duckdb#15526, #966).

- Update vendored sources to duckdb/duckdb@22de1ef5310136803f2caab0c9cc063b4fad52e5 (#965).

- Update vendored sources to duckdb/duckdb@a3636bdd6203f4e4c47c5191264b9209e4f2a516 (#964).

- Update vendored sources to duckdb/duckdb@50de06cec8de9c8da1b6fd9fcec3f514694a9b6a (#963).

- Update vendored sources to duckdb/duckdb@4b163ff7c8cb9693fafe4d822dff54b31cfd2adf (#962).


# duckdb 1.1.3.9033

## vendor
Expand Down
2 changes: 1 addition & 1 deletion src/duckdb/extension/core_functions/scalar/date/epoch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct EpochSecOperator {
static RESULT_TYPE Operation(INPUT_TYPE sec) {
int64_t result;
if (!TryCast::Operation(sec * Interval::MICROS_PER_SEC, result)) {
throw ConversionException("Could not convert epoch seconds to TIMESTAMP WITH TIME ZONE");
throw ConversionException("Epoch seconds out of range for TIMESTAMP WITH TIME ZONE");
}
return timestamp_t(result);
}
Expand Down
4 changes: 4 additions & 0 deletions src/duckdb/extension/core_functions/scalar/date/make_date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ struct MakeTimestampOperator {

template <typename T, typename RESULT_TYPE>
static RESULT_TYPE Operation(T value) {
const auto result = RESULT_TYPE(value);
if (!Timestamp::IsFinite(result)) {
throw ConversionException("Timestamp microseconds out of range: %ld", value);
}
return RESULT_TYPE(value);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static bool ExecuteReduce(idx_t loops, ReduceExecuteInfo &execute_info, LambdaFu
}

// create the index vector
Vector index_vector(Value::BIGINT(UnsafeNumericCast<int64_t>(loops + 1)));
Vector index_vector(Value::BIGINT(UnsafeNumericCast<int64_t>(loops + 2)));

// slice the left and right slice
execute_info.left_slice->Slice(*execute_info.left_slice, execute_info.left_sel, reduced_row_idx);
Expand Down
8 changes: 8 additions & 0 deletions src/duckdb/extension/parquet/column_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ const SchemaElement &ColumnReader::Schema() const {
return schema;
}

optional_ptr<const SchemaElement> ColumnReader::GetParentSchema() const {
return parent_schema;
}

void ColumnReader::SetParentSchema(const SchemaElement &parent_schema_p) {
parent_schema = &parent_schema_p;
}

idx_t ColumnReader::FileIdx() const {
return file_idx;
}
Expand Down
4 changes: 4 additions & 0 deletions src/duckdb/extension/parquet/include/column_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class ColumnReader {
ParquetReader &Reader();
const LogicalType &Type() const;
const SchemaElement &Schema() const;
optional_ptr<const SchemaElement> GetParentSchema() const;
void SetParentSchema(const SchemaElement &parent_schema);

idx_t FileIdx() const;
idx_t MaxDefine() const;
idx_t MaxRepeat() const;
Expand Down Expand Up @@ -140,6 +143,7 @@ class ColumnReader {

protected:
const SchemaElement &schema;
optional_ptr<const SchemaElement> parent_schema;

idx_t file_idx;
idx_t max_define;
Expand Down
8 changes: 7 additions & 1 deletion src/duckdb/extension/parquet/parquet_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,15 @@ static void InitializeParquetReader(ParquetReader &reader, const ParquetReadBind
unordered_map<uint32_t, idx_t> field_id_to_column_index;
auto &column_readers = reader.root_reader->Cast<StructColumnReader>().child_readers;
for (idx_t column_index = 0; column_index < column_readers.size(); column_index++) {
auto &column_schema = column_readers[column_index]->Schema();
auto &column_reader = *column_readers[column_index];
auto &column_schema = column_reader.Schema();
if (column_schema.__isset.field_id) {
field_id_to_column_index[column_schema.field_id] = column_index;
} else if (column_reader.GetParentSchema()) {
auto &parent_column_schema = *column_reader.GetParentSchema();
if (parent_column_schema.__isset.field_id) {
field_id_to_column_index[parent_column_schema.field_id] = column_index;
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/duckdb/extension/parquet/parquet_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,10 @@ unique_ptr<ColumnReader> ParquetReader::CreateReaderRecursive(ClientContext &con
}
if (is_repeated) {
result_type = LogicalType::LIST(result_type);
return make_uniq<ListColumnReader>(*this, result_type, s_ele, this_idx, max_define, max_repeat,
std::move(result));
result = make_uniq<ListColumnReader>(*this, result_type, s_ele, this_idx, max_define, max_repeat,
std::move(result));
}
result->SetParentSchema(s_ele);
return result;
} else { // leaf node
if (!s_ele.__isset.type) {
Expand Down
51 changes: 46 additions & 5 deletions src/duckdb/src/common/enum_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#include "duckdb/common/types/column/column_data_scan_states.hpp"
#include "duckdb/common/types/column/partitioned_column_data.hpp"
#include "duckdb/common/types/conflict_manager.hpp"
#include "duckdb/common/types/date.hpp"
#include "duckdb/common/types/hyperloglog.hpp"
#include "duckdb/common/types/row/partitioned_tuple_data.hpp"
#include "duckdb/common/types/row/tuple_data_states.hpp"
Expand All @@ -86,6 +87,7 @@
#include "duckdb/execution/operator/csv_scanner/quote_rules.hpp"
#include "duckdb/execution/reservoir_sample.hpp"
#include "duckdb/function/aggregate_state.hpp"
#include "duckdb/function/compression_function.hpp"
#include "duckdb/function/copy_function.hpp"
#include "duckdb/function/function.hpp"
#include "duckdb/function/macro_function.hpp"
Expand Down Expand Up @@ -859,19 +861,38 @@ const StringUtil::EnumStringLiteral *GetCompressionTypeValues() {
{ static_cast<uint32_t>(CompressionType::COMPRESSION_ALPRD), "COMPRESSION_ALPRD" },
{ static_cast<uint32_t>(CompressionType::COMPRESSION_ZSTD), "COMPRESSION_ZSTD" },
{ static_cast<uint32_t>(CompressionType::COMPRESSION_ROARING), "COMPRESSION_ROARING" },
{ static_cast<uint32_t>(CompressionType::COMPRESSION_EMPTY), "COMPRESSION_EMPTY" },
{ static_cast<uint32_t>(CompressionType::COMPRESSION_COUNT), "COMPRESSION_COUNT" }
};
return values;
}

template<>
const char* EnumUtil::ToChars<CompressionType>(CompressionType value) {
return StringUtil::EnumToString(GetCompressionTypeValues(), 15, "CompressionType", static_cast<uint32_t>(value));
return StringUtil::EnumToString(GetCompressionTypeValues(), 16, "CompressionType", static_cast<uint32_t>(value));
}

template<>
CompressionType EnumUtil::FromString<CompressionType>(const char *value) {
return static_cast<CompressionType>(StringUtil::StringToEnum(GetCompressionTypeValues(), 15, "CompressionType", value));
return static_cast<CompressionType>(StringUtil::StringToEnum(GetCompressionTypeValues(), 16, "CompressionType", value));
}

const StringUtil::EnumStringLiteral *GetCompressionValidityValues() {
static constexpr StringUtil::EnumStringLiteral values[] {
{ static_cast<uint32_t>(CompressionValidity::REQUIRES_VALIDITY), "REQUIRES_VALIDITY" },
{ static_cast<uint32_t>(CompressionValidity::NO_VALIDITY_REQUIRED), "NO_VALIDITY_REQUIRED" }
};
return values;
}

template<>
const char* EnumUtil::ToChars<CompressionValidity>(CompressionValidity value) {
return StringUtil::EnumToString(GetCompressionValidityValues(), 2, "CompressionValidity", static_cast<uint32_t>(value));
}

template<>
CompressionValidity EnumUtil::FromString<CompressionValidity>(const char *value) {
return static_cast<CompressionValidity>(StringUtil::StringToEnum(GetCompressionValidityValues(), 2, "CompressionValidity", value));
}

const StringUtil::EnumStringLiteral *GetConflictManagerModeValues() {
Expand Down Expand Up @@ -989,6 +1010,25 @@ DataFileType EnumUtil::FromString<DataFileType>(const char *value) {
return static_cast<DataFileType>(StringUtil::StringToEnum(GetDataFileTypeValues(), 4, "DataFileType", value));
}

const StringUtil::EnumStringLiteral *GetDateCastResultValues() {
static constexpr StringUtil::EnumStringLiteral values[] {
{ static_cast<uint32_t>(DateCastResult::SUCCESS), "SUCCESS" },
{ static_cast<uint32_t>(DateCastResult::ERROR_INCORRECT_FORMAT), "ERROR_INCORRECT_FORMAT" },
{ static_cast<uint32_t>(DateCastResult::ERROR_RANGE), "ERROR_RANGE" }
};
return values;
}

template<>
const char* EnumUtil::ToChars<DateCastResult>(DateCastResult value) {
return StringUtil::EnumToString(GetDateCastResultValues(), 3, "DateCastResult", static_cast<uint32_t>(value));
}

template<>
DateCastResult EnumUtil::FromString<DateCastResult>(const char *value) {
return static_cast<DateCastResult>(StringUtil::StringToEnum(GetDateCastResultValues(), 3, "DateCastResult", value));
}

const StringUtil::EnumStringLiteral *GetDatePartSpecifierValues() {
static constexpr StringUtil::EnumStringLiteral values[] {
{ static_cast<uint32_t>(DatePartSpecifier::YEAR), "YEAR" },
Expand Down Expand Up @@ -3860,19 +3900,20 @@ const StringUtil::EnumStringLiteral *GetTimestampCastResultValues() {
static constexpr StringUtil::EnumStringLiteral values[] {
{ static_cast<uint32_t>(TimestampCastResult::SUCCESS), "SUCCESS" },
{ static_cast<uint32_t>(TimestampCastResult::ERROR_INCORRECT_FORMAT), "ERROR_INCORRECT_FORMAT" },
{ static_cast<uint32_t>(TimestampCastResult::ERROR_NON_UTC_TIMEZONE), "ERROR_NON_UTC_TIMEZONE" }
{ static_cast<uint32_t>(TimestampCastResult::ERROR_NON_UTC_TIMEZONE), "ERROR_NON_UTC_TIMEZONE" },
{ static_cast<uint32_t>(TimestampCastResult::ERROR_RANGE), "ERROR_RANGE" }
};
return values;
}

template<>
const char* EnumUtil::ToChars<TimestampCastResult>(TimestampCastResult value) {
return StringUtil::EnumToString(GetTimestampCastResultValues(), 3, "TimestampCastResult", static_cast<uint32_t>(value));
return StringUtil::EnumToString(GetTimestampCastResultValues(), 4, "TimestampCastResult", static_cast<uint32_t>(value));
}

template<>
TimestampCastResult EnumUtil::FromString<TimestampCastResult>(const char *value) {
return static_cast<TimestampCastResult>(StringUtil::StringToEnum(GetTimestampCastResultValues(), 3, "TimestampCastResult", value));
return static_cast<TimestampCastResult>(StringUtil::StringToEnum(GetTimestampCastResultValues(), 4, "TimestampCastResult", value));
}

const StringUtil::EnumStringLiteral *GetTransactionModifierTypeValues() {
Expand Down
4 changes: 4 additions & 0 deletions src/duckdb/src/common/enums/compression_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ bool CompressionTypeIsDeprecated(CompressionType compression_type) {

CompressionType CompressionTypeFromString(const string &str) {
auto compression = StringUtil::Lower(str);
//! NOTE: this explicitly does not include 'constant' and 'empty validity', these are internal compression functions
//! not general purpose
if (compression == "uncompressed") {
return CompressionType::COMPRESSION_UNCOMPRESSED;
} else if (compression == "rle") {
Expand Down Expand Up @@ -83,6 +85,8 @@ string CompressionTypeToString(CompressionType type) {
return "ALPRD";
case CompressionType::COMPRESSION_ROARING:
return "Roaring";
case CompressionType::COMPRESSION_EMPTY:
return "Empty Validity";
default:
throw InternalException("Unrecognized compression type!");
}
Expand Down
8 changes: 6 additions & 2 deletions src/duckdb/src/common/file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ string FileSystem::GetEnvVariable(const string &name) {

bool FileSystem::IsPathAbsolute(const string &path) {
auto path_separator = PathSeparator(path);
return PathMatched(path, path_separator);
return PathMatched(path, path_separator) || StringUtil::StartsWith(path, "file:/");
}

string FileSystem::PathSeparator(const string &path) {
Expand Down Expand Up @@ -237,7 +237,11 @@ string FileSystem::NormalizeAbsolutePath(const string &path) {
}

string FileSystem::PathSeparator(const string &path) {
return "\\";
if (StringUtil::StartsWith(path, "file:")) {
return "/";
} else {
return "\\";
}
}

void FileSystem::SetWorkingDirectory(const string &path) {
Expand Down
Loading

0 comments on commit 2277771

Please sign in to comment.