Skip to content

Commit

Permalink
Update vendored sources to duckdb/duckdb@3c695d7
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Nov 14, 2023
1 parent 090fa72 commit ac8e21c
Show file tree
Hide file tree
Showing 114 changed files with 1,688 additions and 787 deletions.
4 changes: 2 additions & 2 deletions src/duckdb/extension/parquet/parquet_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,8 @@ static void GetFieldIDs(const Value &field_ids_value, ChildFieldIDs &field_ids,
}
}

unique_ptr<FunctionData> ParquetWriteBind(ClientContext &context, CopyInfo &info, vector<string> &names,
vector<LogicalType> &sql_types) {
unique_ptr<FunctionData> ParquetWriteBind(ClientContext &context, const CopyInfo &info, const vector<string> &names,
const vector<LogicalType> &sql_types) {
D_ASSERT(names.size() == sql_types.size());
bool row_group_size_bytes_set = false;
auto bind_data = make_uniq<ParquetWriteBindData>();
Expand Down
18 changes: 6 additions & 12 deletions src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ unique_ptr<CreateInfo> ViewCatalogEntry::GetInfo() const {
result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
result->aliases = aliases;
result->types = types;
result->temporary = temporary;
return std::move(result);
}

Expand All @@ -58,23 +59,16 @@ string ViewCatalogEntry::ToSQL() const {
//! Return empty sql with view name so pragma view_tables don't complain
return sql;
}
return sql + "\n;";
auto info = GetInfo();
auto result = info->ToString();
return result + ";\n";
}

unique_ptr<CatalogEntry> ViewCatalogEntry::Copy(ClientContext &context) const {
D_ASSERT(!internal);
CreateViewInfo create_info(schema, name);
create_info.query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
for (idx_t i = 0; i < aliases.size(); i++) {
create_info.aliases.push_back(aliases[i]);
}
for (idx_t i = 0; i < types.size(); i++) {
create_info.types.push_back(types[i]);
}
create_info.temporary = temporary;
create_info.sql = sql;
auto create_info = GetInfo();

return make_uniq<ViewCatalogEntry>(catalog, schema, create_info);
return make_uniq<ViewCatalogEntry>(catalog, schema, create_info->Cast<CreateViewInfo>());
}

} // namespace duckdb
7 changes: 3 additions & 4 deletions src/duckdb/src/catalog/catalog_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ bool CatalogSet::AlterOwnership(CatalogTransaction transaction, ChangeOwnershipI
bool CatalogSet::AlterEntry(CatalogTransaction transaction, const string &name, AlterInfo &alter_info) {
// lock the catalog for writing
lock_guard<mutex> write_lock(catalog.GetWriteLock());
// lock this catalog set to disallow reading
lock_guard<mutex> read_lock(catalog_lock);

// first check if the entry exists in the unordered set
EntryIndex entry_index;
Expand All @@ -210,9 +212,6 @@ bool CatalogSet::AlterEntry(CatalogTransaction transaction, const string &name,
throw CatalogException("Cannot alter entry \"%s\" because it is an internal system entry", entry->name);
}

// lock this catalog set to disallow reading
lock_guard<mutex> read_lock(catalog_lock);

// create a new entry and replace the currently stored one
// set the timestamp to the timestamp of the current transaction
// and point it to the updated table node
Expand Down Expand Up @@ -316,6 +315,7 @@ void CatalogSet::DropEntryInternal(CatalogTransaction transaction, EntryIndex en
bool CatalogSet::DropEntry(CatalogTransaction transaction, const string &name, bool cascade, bool allow_drop_internal) {
// lock the catalog for writing
lock_guard<mutex> write_lock(catalog.GetWriteLock());
lock_guard<mutex> read_lock(catalog_lock);
// we can only delete an entry that exists
EntryIndex entry_index;
auto entry = GetEntryInternal(transaction, name, &entry_index);
Expand All @@ -326,7 +326,6 @@ bool CatalogSet::DropEntry(CatalogTransaction transaction, const string &name, b
throw CatalogException("Cannot drop entry \"%s\" because it is an internal system entry", entry->name);
}

lock_guard<mutex> read_lock(catalog_lock);
DropEntryInternal(transaction, std::move(entry_index), *entry, cascade);
return true;
}
Expand Down
78 changes: 0 additions & 78 deletions src/duckdb/src/common/arrow/appender/list_data.cpp

This file was deleted.

91 changes: 0 additions & 91 deletions src/duckdb/src/common/arrow/appender/map_data.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion src/duckdb/src/common/arrow/appender/union_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void ArrowUnionData::Append(ArrowAppendData &append_data, Vector &input, idx_t f

duckdb::vector<Vector> child_vectors;
for (const auto &child : UnionType::CopyMemberTypes(input.GetType())) {
child_vectors.emplace_back(child.second);
child_vectors.emplace_back(child.second, size);
}

for (idx_t input_idx = from; input_idx < to; input_idx++) {
Expand Down
25 changes: 17 additions & 8 deletions src/duckdb/src/common/arrow/arrow_appender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,26 +193,26 @@ static void InitializeFunctionPointers(ArrowAppendData &append_data, const Logic
if (append_data.options.arrow_offset_size == ArrowOffsetSize::LARGE) {
InitializeAppenderForType<ArrowVarcharData<string_t>>(append_data);
} else {
InitializeAppenderForType<ArrowVarcharData<string_t, ArrowVarcharConverter, uint32_t>>(append_data);
InitializeAppenderForType<ArrowVarcharData<string_t, ArrowVarcharConverter, int32_t>>(append_data);
}
break;
case LogicalTypeId::UUID:
if (append_data.options.arrow_offset_size == ArrowOffsetSize::LARGE) {
InitializeAppenderForType<ArrowVarcharData<hugeint_t, ArrowUUIDConverter>>(append_data);
} else {
InitializeAppenderForType<ArrowVarcharData<hugeint_t, ArrowUUIDConverter, uint32_t>>(append_data);
InitializeAppenderForType<ArrowVarcharData<hugeint_t, ArrowUUIDConverter, int32_t>>(append_data);
}
break;
case LogicalTypeId::ENUM:
switch (type.InternalType()) {
case PhysicalType::UINT8:
InitializeAppenderForType<ArrowEnumData<uint8_t>>(append_data);
InitializeAppenderForType<ArrowEnumData<int8_t>>(append_data);
break;
case PhysicalType::UINT16:
InitializeAppenderForType<ArrowEnumData<uint16_t>>(append_data);
InitializeAppenderForType<ArrowEnumData<int16_t>>(append_data);
break;
case PhysicalType::UINT32:
InitializeAppenderForType<ArrowEnumData<uint32_t>>(append_data);
InitializeAppenderForType<ArrowEnumData<int32_t>>(append_data);
break;
default:
throw InternalException("Unsupported internal enum type");
Expand All @@ -227,11 +227,20 @@ static void InitializeFunctionPointers(ArrowAppendData &append_data, const Logic
case LogicalTypeId::STRUCT:
InitializeAppenderForType<ArrowStructData>(append_data);
break;
case LogicalTypeId::LIST:
InitializeAppenderForType<ArrowListData>(append_data);
case LogicalTypeId::LIST: {
if (append_data.options.arrow_offset_size == ArrowOffsetSize::LARGE) {
InitializeAppenderForType<ArrowListData<int64_t>>(append_data);
} else {
InitializeAppenderForType<ArrowListData<int32_t>>(append_data);
}
break;
}
case LogicalTypeId::MAP:
InitializeAppenderForType<ArrowMapData>(append_data);
if (append_data.options.arrow_offset_size == ArrowOffsetSize::LARGE) {
InitializeAppenderForType<ArrowMapData<int64_t>>(append_data);
} else {
InitializeAppenderForType<ArrowMapData<int32_t>>(append_data);
}
break;
default:
throw NotImplementedException("Unsupported type in DuckDB -> Arrow Conversion: %s\n", type.ToString());
Expand Down
6 changes: 5 additions & 1 deletion src/duckdb/src/common/arrow/arrow_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
break;
}
case LogicalTypeId::LIST: {
child.format = "+l";
if (options.arrow_offset_size == ArrowOffsetSize::LARGE) {
child.format = "+L";
} else {
child.format = "+l";
}
child.n_children = 1;
root_holder.nested_children.emplace_back();
root_holder.nested_children.back().resize(1);
Expand Down
Loading

0 comments on commit ac8e21c

Please sign in to comment.