Skip to content

Commit 7f9a0f3

Browse files
committed
vendor: Update vendored sources to duckdb/duckdb@1c6ea28
TableCatalogEntry instead of DuckTableEntry in TableScanBindData (duckdb/duckdb#15668)
1 parent 39b8eb2 commit 7f9a0f3

16 files changed

+117
-98
lines changed

src/duckdb/src/catalog/catalog.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626
#include "duckdb/parser/parsed_data/create_type_info.hpp"
2727
#include "duckdb/parser/parsed_data/create_view_info.hpp"
2828
#include "duckdb/parser/parsed_data/drop_info.hpp"
29+
#include "duckdb/parser/statement/create_statement.hpp"
2930
#include "duckdb/planner/parsed_data/bound_create_table_info.hpp"
3031
#include "duckdb/planner/binder.hpp"
32+
#include "duckdb/planner/expression_binder/index_binder.hpp"
3133
#include "duckdb/catalog/default/default_types.hpp"
3234
#include "duckdb/main/extension_entries.hpp"
3335
#include "duckdb/main/extension/generated_extension_loader.hpp"
@@ -304,6 +306,14 @@ optional_ptr<CatalogEntry> Catalog::CreateIndex(ClientContext &context, CreateIn
304306
return CreateIndex(GetCatalogTransaction(context), info);
305307
}
306308

309+
unique_ptr<LogicalOperator> Catalog::BindCreateIndex(Binder &binder, CreateStatement &stmt, TableCatalogEntry &table,
310+
unique_ptr<LogicalOperator> plan) {
311+
D_ASSERT(plan->type == LogicalOperatorType::LOGICAL_GET);
312+
auto create_index_info = unique_ptr_cast<CreateInfo, CreateIndexInfo>(std::move(stmt.info));
313+
IndexBinder index_binder(binder, binder.context);
314+
return index_binder.BindCreateIndex(binder.context, std::move(create_index_info), table, std::move(plan), nullptr);
315+
}
316+
307317
unique_ptr<LogicalOperator> Catalog::BindAlterAddIndex(Binder &binder, TableCatalogEntry &table_entry,
308318
unique_ptr<LogicalOperator> plan,
309319
unique_ptr<CreateIndexInfo> create_info,

src/duckdb/src/function/table/table_scan.cpp

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "duckdb/main/client_config.hpp"
1212
#include "duckdb/optimizer/matcher/expression_matcher.hpp"
1313
#include "duckdb/planner/expression/bound_between_expression.hpp"
14-
#include "duckdb/planner/expression_iterator.hpp"
1514
#include "duckdb/planner/operator/logical_get.hpp"
1615
#include "duckdb/storage/data_table.hpp"
1716
#include "duckdb/storage/table/scan_state.hpp"
@@ -71,7 +70,8 @@ class TableScanGlobalState : public GlobalTableFunctionState {
7170
TableScanGlobalState(ClientContext &context, const FunctionData *bind_data_p) {
7271
D_ASSERT(bind_data_p);
7372
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
74-
max_threads = bind_data.table.GetStorage().MaxThreads(context);
73+
auto &duck_table = bind_data.table.Cast<DuckTableEntry>();
74+
max_threads = duck_table.GetStorage().MaxThreads(context);
7575
}
7676

7777
//! The maximum number of threads for this table scan.
@@ -130,8 +130,9 @@ class DuckIndexScanState : public TableScanGlobalState {
130130

131131
void TableScanFunc(ClientContext &context, TableFunctionInput &data_p, DataChunk &output) override {
132132
auto &bind_data = data_p.bind_data->Cast<TableScanBindData>();
133-
auto &tx = DuckTransaction::Get(context, bind_data.table.catalog);
134-
auto &storage = bind_data.table.GetStorage();
133+
auto &duck_table = bind_data.table.Cast<DuckTableEntry>();
134+
auto &tx = DuckTransaction::Get(context, duck_table.catalog);
135+
auto &storage = duck_table.GetStorage();
135136
auto &l_state = data_p.local_state->Cast<IndexScanLocalState>();
136137

137138
auto row_id_count = row_ids.size();
@@ -216,7 +217,8 @@ class DuckTableScanState : public TableScanGlobalState {
216217

217218
l_state->scan_state.Initialize(std::move(storage_ids), input.filters.get(), input.sample_options.get());
218219

219-
auto &storage = bind_data.table.GetStorage();
220+
auto &duck_table = bind_data.table.Cast<DuckTableEntry>();
221+
auto &storage = duck_table.GetStorage();
220222
storage.NextParallelScan(context.client, state, l_state->scan_state);
221223
if (input.CanRemoveFilterColumns()) {
222224
l_state->all_columns.Initialize(context.client, scanned_types);
@@ -228,8 +230,9 @@ class DuckTableScanState : public TableScanGlobalState {
228230

229231
void TableScanFunc(ClientContext &context, TableFunctionInput &data_p, DataChunk &output) override {
230232
auto &bind_data = data_p.bind_data->Cast<TableScanBindData>();
231-
auto &tx = DuckTransaction::Get(context, bind_data.table.catalog);
232-
auto &storage = bind_data.table.GetStorage();
233+
auto &duck_table = bind_data.table.Cast<DuckTableEntry>();
234+
auto &tx = DuckTransaction::Get(context, duck_table.catalog);
235+
auto &storage = duck_table.GetStorage();
233236

234237
auto &l_state = data_p.local_state->Cast<TableScanLocalState>();
235238
l_state.scan_state.options.force_fetch_row = ClientConfig::GetConfig(context).force_fetch_row;
@@ -258,7 +261,8 @@ class DuckTableScanState : public TableScanGlobalState {
258261

259262
double TableScanProgress(ClientContext &context, const FunctionData *bind_data_p) const override {
260263
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
261-
auto &storage = bind_data.table.GetStorage();
264+
auto &duck_table = bind_data.table.Cast<DuckTableEntry>();
265+
auto &storage = duck_table.GetStorage();
262266
auto total_rows = storage.GetTotalRows();
263267

264268
// The table is empty or smaller than the standard vector size.
@@ -306,7 +310,8 @@ unique_ptr<GlobalTableFunctionState> DuckTableScanInitGlobal(ClientContext &cont
306310
}
307311

308312
g_state->projection_ids = input.projection_ids;
309-
const auto &columns = bind_data.table.GetColumns();
313+
auto &duck_table = bind_data.table.Cast<DuckTableEntry>();
314+
const auto &columns = duck_table.GetColumns();
310315
for (const auto &col_idx : input.column_indexes) {
311316
if (col_idx.IsRowIdColumn()) {
312317
g_state->scanned_types.emplace_back(LogicalType::ROW_TYPE);
@@ -327,14 +332,15 @@ unique_ptr<GlobalTableFunctionState> DuckIndexScanInitGlobal(ClientContext &cont
327332
}
328333
g_state->finished = g_state->row_ids.empty() ? true : false;
329334

330-
auto &local_storage = LocalStorage::Get(context, bind_data.table.catalog);
335+
auto &duck_table = bind_data.table.Cast<DuckTableEntry>();
336+
auto &local_storage = LocalStorage::Get(context, duck_table.catalog);
331337
g_state->table_scan_state.options.force_fetch_row = ClientConfig::GetConfig(context).force_fetch_row;
332338

333339
if (input.CanRemoveFilterColumns()) {
334340
g_state->projection_ids = input.projection_ids;
335341
}
336342

337-
const auto &columns = bind_data.table.GetColumns();
343+
const auto &columns = duck_table.GetColumns();
338344
for (const auto &col_idx : input.column_indexes) {
339345
g_state->column_ids.push_back(GetStorageIndex(bind_data.table, col_idx));
340346
if (col_idx.IsRowIdColumn()) {
@@ -467,8 +473,8 @@ unique_ptr<GlobalTableFunctionState> TableScanInitGlobal(ClientContext &context,
467473
D_ASSERT(input.bind_data);
468474

469475
auto &bind_data = input.bind_data->Cast<TableScanBindData>();
470-
auto &table = bind_data.table;
471-
auto &storage = table.GetStorage();
476+
auto &duck_table = bind_data.table.Cast<DuckTableEntry>();
477+
auto &storage = duck_table.GetStorage();
472478

473479
// Can't index scan without filters.
474480
if (!input.filters) {
@@ -502,7 +508,7 @@ unique_ptr<GlobalTableFunctionState> TableScanInitGlobal(ClientContext &context,
502508
auto total_rows_from_percentage = LossyNumericCast<idx_t>(double(total_rows) * scan_percentage);
503509
auto max_count = MaxValue(scan_max_count, total_rows_from_percentage);
504510

505-
auto &column_list = table.GetColumns();
511+
auto &column_list = duck_table.GetColumns();
506512
bool index_scan = false;
507513
unsafe_vector<row_t> row_ids;
508514

@@ -520,13 +526,14 @@ unique_ptr<GlobalTableFunctionState> TableScanInitGlobal(ClientContext &context,
520526
static unique_ptr<BaseStatistics> TableScanStatistics(ClientContext &context, const FunctionData *bind_data_p,
521527
column_t column_id) {
522528
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
523-
auto &local_storage = LocalStorage::Get(context, bind_data.table.catalog);
529+
auto &duck_table = bind_data.table.Cast<DuckTableEntry>();
530+
auto &local_storage = LocalStorage::Get(context, duck_table.catalog);
524531

525532
// Don't emit statistics for tables with outstanding transaction-local data.
526-
if (local_storage.Find(bind_data.table.GetStorage())) {
533+
if (local_storage.Find(duck_table.GetStorage())) {
527534
return nullptr;
528535
}
529-
return bind_data.table.GetStatistics(context, column_id);
536+
return duck_table.GetStatistics(context, column_id);
530537
}
531538

532539
static void TableScanFunc(ClientContext &context, TableFunctionInput &data_p, DataChunk &output) {
@@ -552,7 +559,8 @@ OperatorPartitionData TableScanGetPartitionData(ClientContext &context, TableFun
552559
vector<PartitionStatistics> TableScanGetPartitionStats(ClientContext &context, GetPartitionStatsInput &input) {
553560
auto &bind_data = input.bind_data->Cast<TableScanBindData>();
554561
vector<PartitionStatistics> result;
555-
auto &storage = bind_data.table.GetStorage();
562+
auto &duck_table = bind_data.table.Cast<DuckTableEntry>();
563+
auto &storage = duck_table.GetStorage();
556564
return storage.GetPartitionStats(context);
557565
}
558566

@@ -568,10 +576,11 @@ void TableScanDependency(LogicalDependencyList &entries, const FunctionData *bin
568576

569577
unique_ptr<NodeStatistics> TableScanCardinality(ClientContext &context, const FunctionData *bind_data_p) {
570578
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
571-
auto &local_storage = LocalStorage::Get(context, bind_data.table.catalog);
572-
auto &storage = bind_data.table.GetStorage();
579+
auto &duck_table = bind_data.table.Cast<DuckTableEntry>();
580+
auto &local_storage = LocalStorage::Get(context, duck_table.catalog);
581+
auto &storage = duck_table.GetStorage();
573582
idx_t table_rows = storage.GetTotalRows();
574-
idx_t estimated_cardinality = table_rows + local_storage.AddedRows(bind_data.table.GetStorage());
583+
idx_t estimated_cardinality = table_rows + local_storage.AddedRows(duck_table.GetStorage());
575584
return make_uniq<NodeStatistics>(table_rows, estimated_cardinality);
576585
}
577586

src/duckdb/src/function/table/version/pragma_version.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef DUCKDB_PATCH_VERSION
2-
#define DUCKDB_PATCH_VERSION "4-dev4481"
2+
#define DUCKDB_PATCH_VERSION "4-dev4483"
33
#endif
44
#ifndef DUCKDB_MINOR_VERSION
55
#define DUCKDB_MINOR_VERSION 1
@@ -8,10 +8,10 @@
88
#define DUCKDB_MAJOR_VERSION 1
99
#endif
1010
#ifndef DUCKDB_VERSION
11-
#define DUCKDB_VERSION "v1.1.4-dev4481"
11+
#define DUCKDB_VERSION "v1.1.4-dev4483"
1212
#endif
1313
#ifndef DUCKDB_SOURCE_ID
14-
#define DUCKDB_SOURCE_ID "16d1d6445d"
14+
#define DUCKDB_SOURCE_ID "1c6ea28bdc"
1515
#endif
1616
#include "duckdb/function/table/system_functions.hpp"
1717
#include "duckdb/main/database.hpp"

src/duckdb/src/include/duckdb/catalog/catalog.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class Catalog {
298298
virtual unique_ptr<PhysicalOperator> PlanUpdate(ClientContext &context, LogicalUpdate &op,
299299
unique_ptr<PhysicalOperator> plan) = 0;
300300
virtual unique_ptr<LogicalOperator> BindCreateIndex(Binder &binder, CreateStatement &stmt, TableCatalogEntry &table,
301-
unique_ptr<LogicalOperator> plan) = 0;
301+
unique_ptr<LogicalOperator> plan);
302302
virtual unique_ptr<LogicalOperator> BindAlterAddIndex(Binder &binder, TableCatalogEntry &table_entry,
303303
unique_ptr<LogicalOperator> plan,
304304
unique_ptr<CreateIndexInfo> create_info,

src/duckdb/src/include/duckdb/function/table/table_scan.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ class DuckTableEntry;
1717
class TableCatalogEntry;
1818

1919
struct TableScanBindData : public TableFunctionData {
20-
explicit TableScanBindData(DuckTableEntry &table) : table(table), is_index_scan(false), is_create_index(false) {
20+
explicit TableScanBindData(TableCatalogEntry &table) : table(table), is_index_scan(false), is_create_index(false) {
2121
}
2222

2323
//! The table to scan.
24-
DuckTableEntry &table;
24+
TableCatalogEntry &table;
2525
//! The old purpose of this field has been deprecated.
2626
//! We now use it to express an index scan in the ANALYZE call.
2727
//! I.e., we const-cast the bind data and set this to true, if we opt for an index scan.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#include "extension/core_functions/aggregate/algebraic/stddev.cpp"
2-
31
#include "extension/core_functions/aggregate/algebraic/corr.cpp"
42

5-
#include "extension/core_functions/aggregate/algebraic/covar.cpp"
3+
#include "extension/core_functions/aggregate/algebraic/stddev.cpp"
64

75
#include "extension/core_functions/aggregate/algebraic/avg.cpp"
86

7+
#include "extension/core_functions/aggregate/algebraic/covar.cpp"
8+
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1+
#include "extension/core_functions/aggregate/distributive/kurtosis.cpp"
2+
3+
#include "extension/core_functions/aggregate/distributive/string_agg.cpp"
4+
15
#include "extension/core_functions/aggregate/distributive/sum.cpp"
26

37
#include "extension/core_functions/aggregate/distributive/arg_min_max.cpp"
48

5-
#include "extension/core_functions/aggregate/distributive/string_agg.cpp"
9+
#include "extension/core_functions/aggregate/distributive/approx_count.cpp"
610

7-
#include "extension/core_functions/aggregate/distributive/bool.cpp"
11+
#include "extension/core_functions/aggregate/distributive/skew.cpp"
812

9-
#include "extension/core_functions/aggregate/distributive/approx_count.cpp"
13+
#include "extension/core_functions/aggregate/distributive/bitagg.cpp"
1014

1115
#include "extension/core_functions/aggregate/distributive/bitstring_agg.cpp"
1216

1317
#include "extension/core_functions/aggregate/distributive/product.cpp"
1418

15-
#include "extension/core_functions/aggregate/distributive/bitagg.cpp"
16-
17-
#include "extension/core_functions/aggregate/distributive/skew.cpp"
18-
19-
#include "extension/core_functions/aggregate/distributive/kurtosis.cpp"
19+
#include "extension/core_functions/aggregate/distributive/bool.cpp"
2020

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#include "extension/core_functions/aggregate/holistic/quantile.cpp"
1+
#include "extension/core_functions/aggregate/holistic/approx_top_k.cpp"
22

3-
#include "extension/core_functions/aggregate/holistic/mode.cpp"
3+
#include "extension/core_functions/aggregate/holistic/quantile.cpp"
44

5-
#include "extension/core_functions/aggregate/holistic/approximate_quantile.cpp"
5+
#include "extension/core_functions/aggregate/holistic/reservoir_quantile.cpp"
66

77
#include "extension/core_functions/aggregate/holistic/mad.cpp"
88

9-
#include "extension/core_functions/aggregate/holistic/reservoir_quantile.cpp"
9+
#include "extension/core_functions/aggregate/holistic/approximate_quantile.cpp"
1010

11-
#include "extension/core_functions/aggregate/holistic/approx_top_k.cpp"
11+
#include "extension/core_functions/aggregate/holistic/mode.cpp"
1212

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "extension/core_functions/aggregate/nested/binned_histogram.cpp"
22

3-
#include "extension/core_functions/aggregate/nested/histogram.cpp"
4-
53
#include "extension/core_functions/aggregate/nested/list.cpp"
64

5+
#include "extension/core_functions/aggregate/nested/histogram.cpp"
6+
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#include "extension/core_functions/aggregate/regression/regr_sxy.cpp"
22

3-
#include "extension/core_functions/aggregate/regression/regr_avg.cpp"
3+
#include "extension/core_functions/aggregate/regression/regr_intercept.cpp"
44

55
#include "extension/core_functions/aggregate/regression/regr_count.cpp"
66

7-
#include "extension/core_functions/aggregate/regression/regr_slope.cpp"
7+
#include "extension/core_functions/aggregate/regression/regr_r2.cpp"
88

9-
#include "extension/core_functions/aggregate/regression/regr_sxx_syy.cpp"
9+
#include "extension/core_functions/aggregate/regression/regr_avg.cpp"
1010

11-
#include "extension/core_functions/aggregate/regression/regr_intercept.cpp"
11+
#include "extension/core_functions/aggregate/regression/regr_slope.cpp"
1212

13-
#include "extension/core_functions/aggregate/regression/regr_r2.cpp"
13+
#include "extension/core_functions/aggregate/regression/regr_sxx_syy.cpp"
1414

0 commit comments

Comments
 (0)