Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vendor: Update vendored sources to duckdb/duckdb@0e844786417d80226851f5fc375060b47d3b65e0 #1044

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
12 changes: 6 additions & 6 deletions src/duckdb/src/catalog/catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ CatalogException Catalog::CreateMissingEntryException(CatalogEntryRetriever &ret
// however, if there is an exact match in another schema, we will always show it
static constexpr const double UNSEEN_PENALTY = 0.2;
auto unseen_entries = SimilarEntriesInSchemas(context, entry_name, type, unseen_schemas);
set<string> suggestions;
vector<string> suggestions;
if (!unseen_entries.empty() && (unseen_entries[0].score == 1.0 || unseen_entries[0].score - UNSEEN_PENALTY >
(entries.empty() ? 0.0 : entries[0].score))) {
// the closest matching entry requires qualification as it is not in the default search path
Expand All @@ -703,19 +703,19 @@ CatalogException Catalog::CreateMissingEntryException(CatalogEntryRetriever &ret
bool qualify_database;
bool qualify_schema;
FindMinimalQualification(retriever, catalog_name, schema_name, qualify_database, qualify_schema);
auto qualified_name = unseen_entry.GetQualifiedName(qualify_database, qualify_schema);
suggestions.insert(qualified_name);
suggestions.push_back(unseen_entry.GetQualifiedName(qualify_database, qualify_schema));
}
} else if (!entries.empty()) {
for (auto &entry : entries) {
suggestions.insert(entry.name);
suggestions.push_back(entry.name);
}
}

string did_you_mean;
std::sort(suggestions.begin(), suggestions.end());
if (suggestions.size() > 2) {
string last = *suggestions.rbegin();
suggestions.erase(last);
auto last = suggestions.back();
suggestions.pop_back();
did_you_mean = StringUtil::Join(suggestions, ", ") + ", or " + last;
} else {
did_you_mean = StringUtil::Join(suggestions, " or ");
Expand Down
8 changes: 4 additions & 4 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "0"
#define DUCKDB_PATCH_VERSION "4-dev5208"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 2
#define DUCKDB_MINOR_VERSION 1
#endif
#ifndef DUCKDB_MAJOR_VERSION
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.2.0"
#define DUCKDB_VERSION "v1.1.4-dev5208"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "5f5512b827"
#define DUCKDB_SOURCE_ID "0e84478641"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
2 changes: 0 additions & 2 deletions src/duckdb/src/include/duckdb/main/extension_entries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = {
{"skewness", "core_functions", CatalogType::AGGREGATE_FUNCTION_ENTRY},
{"sql_auto_complete", "autocomplete", CatalogType::TABLE_FUNCTION_ENTRY},
{"sqlite_attach", "sqlite_scanner", CatalogType::TABLE_FUNCTION_ENTRY},
{"sqlite_query", "sqlite_scanner", CatalogType::TABLE_FUNCTION_ENTRY},
{"sqlite_scan", "sqlite_scanner", CatalogType::TABLE_FUNCTION_ENTRY},
{"sqlsmith", "sqlsmith", CatalogType::TABLE_FUNCTION_ENTRY},
{"sqrt", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY},
Expand Down Expand Up @@ -981,7 +980,6 @@ static constexpr ExtensionEntry EXTENSION_SETTINGS[] = {
{"s3_url_style", "httpfs"},
{"s3_use_ssl", "httpfs"},
{"sqlite_all_varchar", "sqlite_scanner"},
{"sqlite_debug_show_queries", "sqlite_scanner"},
{"timezone", "icu"},
{"unsafe_enable_version_guessing", "iceberg"},
}; // END_OF_EXTENSION_SETTINGS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ struct CreateViewInfo : public CreateInfo {
//! Gets a bound CreateViewInfo object from a SELECT statement and a view name, schema name, etc
DUCKDB_API static unique_ptr<CreateViewInfo> FromSelect(ClientContext &context, unique_ptr<CreateViewInfo> info);
//! Gets a bound CreateViewInfo object from a CREATE VIEW statement
DUCKDB_API static unique_ptr<CreateViewInfo> FromCreateView(ClientContext &context, SchemaCatalogEntry &schema,
const string &sql);
DUCKDB_API static unique_ptr<CreateViewInfo> FromCreateView(ClientContext &context, const string &sql);
//! Parse a SELECT statement from a SQL string
DUCKDB_API static unique_ptr<SelectStatement> ParseSelect(const string &sql);

Expand Down
2 changes: 0 additions & 2 deletions src/duckdb/src/include/duckdb/planner/binder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,6 @@ class Binder : public enable_shared_from_this<Binder> {
const string BindCatalog(string &catalog_name);
SchemaCatalogEntry &BindCreateSchema(CreateInfo &info);

vector<CatalogSearchEntry> GetSearchPath(Catalog &catalog, const string &schema_name);

LogicalType BindLogicalTypeInternal(const LogicalType &type, optional_ptr<Catalog> catalog, const string &schema);

unique_ptr<BoundQueryNode> BindSelectNode(SelectNode &statement, unique_ptr<BoundTableRef> from_table);
Expand Down
9 changes: 3 additions & 6 deletions src/duckdb/src/parser/parsed_data/create_view_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ unique_ptr<CreateViewInfo> CreateViewInfo::FromSelect(ClientContext &context, un
return info;
}

unique_ptr<CreateViewInfo> CreateViewInfo::FromCreateView(ClientContext &context, SchemaCatalogEntry &schema,
const string &sql) {
unique_ptr<CreateViewInfo> CreateViewInfo::FromCreateView(ClientContext &context, const string &sql) {
D_ASSERT(!sql.empty());

// parse the SQL statement
Expand All @@ -102,11 +101,9 @@ unique_ptr<CreateViewInfo> CreateViewInfo::FromCreateView(ClientContext &context
}

auto result = unique_ptr_cast<CreateInfo, CreateViewInfo>(std::move(create_statement.info));
result->catalog = schema.ParentCatalog().GetName();
result->schema = schema.name;

auto view_binder = Binder::CreateBinder(context);
view_binder->BindCreateViewInfo(*result);
auto binder = Binder::CreateBinder(context);
binder->BindCreateViewInfo(*result);

return result;
}
Expand Down
3 changes: 0 additions & 3 deletions src/duckdb/src/planner/binder/statement/bind_create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,6 @@ void Binder::BindCreateViewInfo(CreateViewInfo &base) {
}
view_binder->can_contain_nulls = true;

auto view_search_path = GetSearchPath(catalog, base.schema);
view_binder->entry_retriever.SetSearchPath(std::move(view_search_path));

auto copy = base.query->Copy();
auto query_node = view_binder->Bind(*base.query);
base.query = unique_ptr_cast<SQLStatement, SelectStatement>(std::move(copy));
Expand Down
22 changes: 7 additions & 15 deletions src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,6 @@ unique_ptr<BoundTableRef> Binder::BindWithReplacementScan(ClientContext &context
return nullptr;
}

vector<CatalogSearchEntry> Binder::GetSearchPath(Catalog &catalog, const string &schema_name) {
vector<CatalogSearchEntry> view_search_path;
auto &catalog_name = catalog.GetName();
if (!schema_name.empty()) {
view_search_path.emplace_back(catalog_name, schema_name);
}
auto default_schema = catalog.GetDefaultSchema();
if (schema_name.empty() && schema_name != default_schema) {
view_search_path.emplace_back(catalog.GetName(), default_schema);
}
return view_search_path;
}

unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
QueryErrorContext error_context(ref.query_location);
// CTEs and views are also referred to using BaseTableRefs, hence need to distinguish here
Expand Down Expand Up @@ -291,8 +278,13 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
subquery.column_name_alias = BindContext::AliasColumnNames(ref.table_name, view_names, ref.column_name_alias);

// when binding a view, we always look into the catalog/schema where the view is stored first
auto view_search_path =
GetSearchPath(view_catalog_entry.ParentCatalog(), view_catalog_entry.ParentSchema().name);
vector<CatalogSearchEntry> view_search_path;
auto &catalog_name = view_catalog_entry.ParentCatalog().GetName();
auto &schema_name = view_catalog_entry.ParentSchema().name;
view_search_path.emplace_back(catalog_name, schema_name);
if (schema_name != DEFAULT_SCHEMA) {
view_search_path.emplace_back(view_catalog_entry.ParentCatalog().GetName(), DEFAULT_SCHEMA);
}
view_binder->entry_retriever.SetSearchPath(std::move(view_search_path));
// bind the child subquery
view_binder->AddBoundView(view_catalog_entry);
Expand Down
Loading