319157 {
319158 if (op.type == LogicalOperatorType::LOGICAL_CTE_REF) {
319159 auto &cte_ref = op.Cast<LogicalCTERef>();
319160 if (cte_ref.cte_index != cte_index) {
319161 return;
319162 }
319163
319164
319165 vector<LogicalType> types;
319166
319167
319168 idx_t skipped = 0;
319169 for (
idx_t i = 0; i < cte_ref.chunk_types.size(); i++) {
319170 if (referenced_columns.find(i) != referenced_columns.end()) {
319171
319172
319173 types.push_back(cte_ref.chunk_types[i]);
319174 if (skipped > 0) {
319175 binding_replacements.push_back(ReplacementBinding(ColumnBinding(cte_ref.table_index, i),
319176 ColumnBinding(cte_ref.table_index, i - skipped)));
319177 }
319178 } else {
319179 skipped++;
319180 }
319181 }
319182 cte_ref.types = std::move(types);
319183 cte_ref.chunk_types = cte_ref.types;
319184 }
319185 LogicalOperatorVisitor::VisitOperator(op);
319186}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237