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 src/duckdb/extension/json/include/json_executors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct JSONExecutors {
for (idx_t i = 0; i < vals.size(); i++) {
auto &val = vals[i];
D_ASSERT(val != nullptr); // Wildcard extract shouldn't give back nullptrs
child_vals[current_size + i] = fun(val, alc, result, child_validity, current_size + i);
child_vals[current_size + i] = fun(val, alc, child_entry, child_validity, current_size + i);
}

ListVector::SetListSize(result, new_size);
Expand Down
6 changes: 5 additions & 1 deletion src/duckdb/extension/json/include/json_reader_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ struct DateFormatMap {
auto &formats = candidate_formats[type];
formats.emplace_back();
formats.back().format_specifier = format_string;
StrpTimeFormat::ParseFormatSpecifier(formats.back().format_specifier, formats.back());
const auto error = StrpTimeFormat::ParseFormatSpecifier(formats.back().format_specifier, formats.back());
if (!error.empty()) {
formats.pop_back();
throw InvalidInputException(error);
}
}

static bool HasFormats(const type_id_map_t<vector<StrpTimeFormat>> &candidate_formats, LogicalTypeId type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "json_deserializer.hpp"
#include "json_functions.hpp"
#include "json_serializer.hpp"
#include "duckdb/parser/parsed_expression_iterator.hpp"

namespace duckdb {

Expand Down Expand Up @@ -214,6 +215,11 @@ static vector<unique_ptr<SelectStatement>> DeserializeSelectStatement(string_t i
if (!stmt->node) {
throw ParserException("Error parsing json: no select node found in json");
}
ParsedExpressionIterator::EnumerateQueryNodeChildren(*stmt->node, [](unique_ptr<ParsedExpression> &child) {
if (!child) {
throw ParserException("Error parsing json: null expression found in json");
}
});
result.push_back(std::move(stmt));
}

Expand Down
3 changes: 3 additions & 0 deletions src/duckdb/extension/json/json_functions/json_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,9 @@ static double CalculateTypeSimilarity(const LogicalType &merged, const LogicalTy
}
case LogicalTypeId::LIST: {
// Only lists can be merged into a list
if (type.id() != LogicalTypeId::LIST) {
return -1;
}
D_ASSERT(type.id() == LogicalTypeId::LIST);
const auto &merged_child_type = ListType::GetChildType(merged);
const auto &type_child_type = ListType::GetChildType(type);
Expand Down
2 changes: 1 addition & 1 deletion src/duckdb/src/common/arrow/arrow_type_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ struct ArrowGeometry {

duckdb_yyjson::yyjson_doc_free(projjson_doc);
} else {
duckdb_yyjson::yyjson_mut_doc_free(doc);
throw SerializationException("Could not parse PROJJSON CRS for GeoArrow metadata");
}
} break;
Expand Down Expand Up @@ -523,6 +522,7 @@ struct ArrowGeometry {
duckdb_yyjson::yyjson_mut_doc_free(doc);
free(json_text);
} else {
duckdb_yyjson::yyjson_mut_doc_free(doc);
schema_metadata.AddOption(ArrowSchemaMetadata::ARROW_METADATA_KEY, "{}");
}

Expand Down
5 changes: 4 additions & 1 deletion src/duckdb/src/common/printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@ idx_t Printer::TerminalWidth() {
rows = csbi.srWindow.Right - csbi.srWindow.Left + 1;
return rows;
#else
struct winsize w;
struct winsize w = {};
ioctl(0, TIOCGWINSZ, &w);
if (w.ws_col == 0) {
return 120;
}
return w.ws_col;
#endif
#else
Expand Down
18 changes: 18 additions & 0 deletions src/duckdb/src/common/types/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,24 @@ string Value::ToSQLString() const {
ret += "]";
return ret;
}
case LogicalTypeId::MAP: {
// A bare `MAP {...}` literal infers its element types from the entries
// (and `MAP {}` infers MAP(INTEGER, INTEGER)), so it does not faithfully
// round-trip on its own. Append an explicit cast to the real type
auto &entries = MapValue::GetChildren(*this);
string ret = "MAP {";
for (idx_t i = 0; i < entries.size(); i++) {
auto &kv = StructValue::GetChildren(entries[i]);
if (i > 0) {
ret += ", ";
}
ret += kv[0].ToSQLString();
ret += ": ";
ret += kv[1].ToSQLString();
}
ret += "}::" + type_.ToString();
return ret;
}
case LogicalTypeId::UNION: {
string ret = "union_value(";
auto union_tag = UnionValue::GetTag(*this);
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 "3"
#define DUCKDB_PATCH_VERSION "4-dev41"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 5
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.5.3"
#define DUCKDB_VERSION "v1.5.4-dev41"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "14eca11bd9"
#define DUCKDB_SOURCE_ID "0bf2a03cb1"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "duckdb/common/unordered_set.hpp"
#include "duckdb/common/exception/parser_exception.hpp"
#include "duckdb/execution/operator/csv_scanner/csv_reader_options.hpp"
#include "duckdb/storage/table/per_column_metadata_blocks.hpp"

namespace duckdb {

Expand Down Expand Up @@ -528,6 +529,12 @@ class Deserializer {
return idx == DConstants::INVALID_INDEX ? optional_idx() : optional_idx(idx);
}

// Deserialize a ProjectionIndex
template <typename T = void>
inline typename std::enable_if<std::is_same<T, PerColumnMetadataBlock>::value, T>::type Read() {
return PerColumnMetadataBlock::Unpack(ReadUnsignedInt64());
}

protected:
// Hooks for subclasses to override to implement custom behavior
virtual void OnPropertyBegin(const field_id_t field_id, const char *tag) = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "duckdb/execution/operator/csv_scanner/csv_option.hpp"
#include "duckdb/main/config.hpp"
#include "duckdb/common/insertion_order_preserving_map.hpp"
#include "duckdb/storage/table/per_column_metadata_blocks.hpp"

namespace duckdb {

Expand Down Expand Up @@ -374,6 +375,9 @@ class Serializer {
void WriteValue(optional_idx value) {
WriteValue(value.IsValid() ? value.GetIndex() : DConstants::INVALID_INDEX);
}
void WriteValue(PerColumnMetadataBlock value) {
WriteValue(value.GetPacked());
}
};

// We need to special case vector<bool> because elements of vector<bool> cannot be referenced
Expand Down
Loading
Loading