Skip to content

Commit ed38d77

Browse files
authored
Merge pull request #152 from Mytherin/bumpsqlite
Apply patches and bump to latest DuckDB version
2 parents 60cb134 + e0a94f1 commit ed38d77

16 files changed

+101
-97
lines changed

.github/workflows/MainDistributionPipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
name: Build extension binaries
1717
uses: duckdb/extension-ci-tools/.github/workflows/[email protected]
1818
with:
19-
duckdb_version: v1.2.2
19+
duckdb_version: main
2020
extension_name: sqlite_scanner
2121
ci_tools_version: v1.2.2
2222

@@ -26,7 +26,7 @@ jobs:
2626
uses: duckdb/extension-ci-tools/.github/workflows/[email protected]
2727
secrets: inherit
2828
with:
29-
duckdb_version: v1.2.2
29+
duckdb_version: main
3030
extension_name: sqlite_scanner
3131
ci_tools_version: v1.2.2
3232
deploy_latest: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' }}

duckdb

Submodule duckdb updated 2309 files

src/include/sqlite_db.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class SQLiteDB {
5050
vector<IndexInfo> GetIndexInfo(const string &table_name);
5151

5252
static void DebugSetPrintQueries(bool print);
53-
53+
5454
bool IsOpen();
5555
void Close();
5656
};

src/include/storage/sqlite_catalog.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ class SQLiteCatalog : public Catalog {
3333

3434
void ScanSchemas(ClientContext &context, std::function<void(SchemaCatalogEntry &)> callback) override;
3535

36-
optional_ptr<SchemaCatalogEntry> GetSchema(CatalogTransaction transaction, const string &schema_name,
37-
OnEntryNotFound if_not_found,
38-
QueryErrorContext error_context = QueryErrorContext()) override;
36+
optional_ptr<SchemaCatalogEntry> LookupSchema(CatalogTransaction transaction, const EntryLookupInfo &schema_lookup,
37+
OnEntryNotFound if_not_found) override;
3938

4039
SQLiteSchemaEntry &GetMainSchema() {
4140
return *main_schema;
4241
}
4342

44-
unique_ptr<PhysicalOperator> PlanInsert(ClientContext &context, LogicalInsert &op,
45-
unique_ptr<PhysicalOperator> plan) override;
46-
unique_ptr<PhysicalOperator> PlanCreateTableAs(ClientContext &context, LogicalCreateTable &op,
47-
unique_ptr<PhysicalOperator> plan) override;
48-
unique_ptr<PhysicalOperator> PlanDelete(ClientContext &context, LogicalDelete &op,
49-
unique_ptr<PhysicalOperator> plan) override;
50-
unique_ptr<PhysicalOperator> PlanUpdate(ClientContext &context, LogicalUpdate &op,
51-
unique_ptr<PhysicalOperator> plan) override;
43+
PhysicalOperator &PlanCreateTableAs(ClientContext &context, PhysicalPlanGenerator &planner, LogicalCreateTable &op,
44+
PhysicalOperator &plan) override;
45+
PhysicalOperator &PlanInsert(ClientContext &context, PhysicalPlanGenerator &planner, LogicalInsert &op,
46+
optional_ptr<PhysicalOperator> plan) override;
47+
PhysicalOperator &PlanDelete(ClientContext &context, PhysicalPlanGenerator &planner, LogicalDelete &op,
48+
PhysicalOperator &plan) override;
49+
PhysicalOperator &PlanUpdate(ClientContext &context, PhysicalPlanGenerator &planner, LogicalUpdate &op,
50+
PhysicalOperator &plan) override;
51+
5252
unique_ptr<LogicalOperator> BindCreateIndex(Binder &binder, CreateStatement &stmt, TableCatalogEntry &table,
5353
unique_ptr<LogicalOperator> plan) override;
5454

src/include/storage/sqlite_schema_entry.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SQLiteSchemaEntry : public SchemaCatalogEntry {
3636
void Scan(ClientContext &context, CatalogType type, const std::function<void(CatalogEntry &)> &callback) override;
3737
void Scan(CatalogType type, const std::function<void(CatalogEntry &)> &callback) override;
3838
void DropEntry(ClientContext &context, DropInfo &info) override;
39-
optional_ptr<CatalogEntry> GetEntry(CatalogTransaction transaction, CatalogType type, const string &name) override;
39+
optional_ptr<CatalogEntry> LookupEntry(CatalogTransaction transaction, const EntryLookupInfo &lookup_info) override;
4040

4141
private:
4242
void AlterTable(SQLiteTransaction &transaction, RenameTableInfo &info);

src/sqlite_db.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ void SQLiteDB::Close() {
114114

115115
vector<string> SQLiteDB::GetEntries(string entry_type) {
116116
vector<string> result;
117-
SQLiteStatement stmt = Prepare("SELECT name FROM sqlite_master WHERE length(sql) > 0 AND type='" + entry_type + "'");
117+
SQLiteStatement stmt =
118+
Prepare("SELECT name FROM sqlite_master WHERE length(sql) > 0 AND type='" + entry_type + "'");
118119
while (stmt.Step()) {
119120
auto table_name = stmt.GetValue<string>(0);
120121
result.push_back(std::move(table_name));

src/sqlite_scanner.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,14 @@ static void SqliteInitInternal(ClientContext &context, const SqliteBindData &bin
102102
string sql;
103103
if (bind_data.sql.empty()) {
104104
auto col_names = StringUtil::Join(
105-
local_state.column_ids.data(), local_state.column_ids.size(), ", ", [&](const idx_t column_id) {
106-
return column_id == (column_t)-1 ? "ROWID"
107-
: '"' + SQLiteUtils::SanitizeIdentifier(bind_data.names[column_id]) + '"';
108-
});
109-
110-
sql =
111-
StringUtil::Format("SELECT %s FROM \"%s\"", col_names, SQLiteUtils::SanitizeIdentifier(bind_data.table_name));
105+
local_state.column_ids.data(), local_state.column_ids.size(), ", ", [&](const idx_t column_id) {
106+
return column_id == (column_t)-1
107+
? "ROWID"
108+
: '"' + SQLiteUtils::SanitizeIdentifier(bind_data.names[column_id]) + '"';
109+
});
110+
111+
sql = StringUtil::Format("SELECT %s FROM \"%s\"", col_names,
112+
SQLiteUtils::SanitizeIdentifier(bind_data.table_name));
112113
if (bind_data.rows_per_group.IsValid()) {
113114
// we are scanning a subset of the rows - generate a WHERE clause based on
114115
// the rowid

src/storage/sqlite_catalog.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ void SQLiteCatalog::ScanSchemas(ClientContext &context, std::function<void(Schem
3131
callback(*main_schema);
3232
}
3333

34-
optional_ptr<SchemaCatalogEntry> SQLiteCatalog::GetSchema(CatalogTransaction transaction, const string &schema_name,
35-
OnEntryNotFound if_not_found,
36-
QueryErrorContext error_context) {
34+
optional_ptr<SchemaCatalogEntry> SQLiteCatalog::LookupSchema(CatalogTransaction transaction,
35+
const EntryLookupInfo &schema_lookup,
36+
OnEntryNotFound if_not_found) {
37+
auto &schema_name = schema_lookup.GetEntryName();
3738
if (schema_name == DEFAULT_SCHEMA || schema_name == INVALID_SCHEMA) {
3839
return main_schema.get();
3940
}

src/storage/sqlite_delete.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ InsertionOrderPreservingMap<string> SQLiteDelete::ParamsToString() const {
8787
//===--------------------------------------------------------------------===//
8888
// Plan
8989
//===--------------------------------------------------------------------===//
90-
unique_ptr<PhysicalOperator> SQLiteCatalog::PlanDelete(ClientContext &context, LogicalDelete &op,
91-
unique_ptr<PhysicalOperator> plan) {
90+
PhysicalOperator &SQLiteCatalog::PlanDelete(ClientContext &context, PhysicalPlanGenerator &planner, LogicalDelete &op,
91+
PhysicalOperator &plan) {
9292
if (op.return_chunk) {
9393
throw BinderException("RETURNING clause not yet supported for deletion of a SQLite table");
9494
}
9595
auto &bound_ref = op.expressions[0]->Cast<BoundReferenceExpression>();
96-
auto insert = make_uniq<SQLiteDelete>(op, op.table, bound_ref.index);
97-
insert->children.push_back(std::move(plan));
98-
return std::move(insert);
96+
auto &delete_op = planner.Make<SQLiteDelete>(op, op.table, bound_ref.index);
97+
delete_op.children.push_back(plan);
98+
return delete_op;
9999
}
100100

101101
} // namespace duckdb

0 commit comments

Comments
 (0)