We first need to update the current set of bindings and then visit operator expressions
We want to execute the normal path, but also add a dummy 'excluded' binding if there is a
147694 {
147695 switch (op.type) {
147696 case LogicalOperatorType::LOGICAL_ASOF_JOIN:
147697 case LogicalOperatorType::LOGICAL_COMPARISON_JOIN: {
147698
147699 auto &comp_join = op.Cast<LogicalComparisonJoin>();
147700
147702 for (auto &cond : comp_join.conditions) {
147703 VisitExpression(&cond.left);
147704 }
147705
147706 for (auto &expr : comp_join.duplicate_eliminated_columns) {
147707 VisitExpression(&expr);
147708 }
147709
147711 for (auto &cond : comp_join.conditions) {
147712 VisitExpression(&cond.right);
147713 }
147714
147715 bindings = op.GetColumnBindings();
147716 types = op.types;
147717
147718
147719 if (comp_join.predicate) {
147720 D_ASSERT(op.type == LogicalOperatorType::LOGICAL_ASOF_JOIN);
147721
147722
147723 if (comp_join.join_type == JoinType::SEMI || comp_join.join_type == JoinType::ANTI) {
147724 auto right_bindings = op.children[1]->GetColumnBindings();
147725 bindings.insert(bindings.end(), right_bindings.begin(), right_bindings.end());
147726 auto &right_types = op.children[1]->types;
147727 types.insert(types.end(), right_types.begin(), right_types.end());
147728 }
147729 VisitExpression(&comp_join.predicate);
147730 }
147731 return;
147732 }
147733 case LogicalOperatorType::LOGICAL_DELIM_JOIN: {
147734 auto &comp_join = op.Cast<LogicalComparisonJoin>();
147735
147736 auto &delim_side = comp_join.delim_flipped ? *comp_join.children[1] : *comp_join.children[0];
147738 for (auto &cond : comp_join.conditions) {
147739 auto &expr = comp_join.delim_flipped ? cond.right : cond.left;
147740 VisitExpression(&expr);
147741 }
147742
147743 for (auto &expr : comp_join.duplicate_eliminated_columns) {
147744 VisitExpression(&expr);
147745 }
147746
147747 auto &other_side = comp_join.delim_flipped ? *comp_join.children[0] : *comp_join.children[1];
147749 for (auto &cond : comp_join.conditions) {
147750 auto &expr = comp_join.delim_flipped ? cond.left : cond.right;
147751 VisitExpression(&expr);
147752 }
147753
147754 bindings = op.GetColumnBindings();
147755 types = op.types;
147756 return;
147757 }
147758 case LogicalOperatorType::LOGICAL_ANY_JOIN: {
147759
147760
147761
147763 bindings = op.GetColumnBindings();
147764 types = op.types;
147765 auto &any_join = op.Cast<LogicalAnyJoin>();
147766 if (any_join.join_type == JoinType::SEMI || any_join.join_type == JoinType::ANTI) {
147767 auto right_bindings = op.children[1]->GetColumnBindings();
147768 bindings.insert(bindings.end(), right_bindings.begin(), right_bindings.end());
147769 auto &right_types = op.children[1]->types;
147770 types.insert(types.end(), right_types.begin(), right_types.end());
147771 }
147772 if (any_join.join_type == JoinType::RIGHT_SEMI || any_join.join_type == JoinType::RIGHT_ANTI) {
147773 throw InternalException("RIGHT SEMI/ANTI any join not supported yet");
147774 }
147776 return;
147777 }
147778 case LogicalOperatorType::LOGICAL_CREATE_INDEX: {
147779
147780
147781 auto &create_index = op.Cast<LogicalCreateIndex>();
147782 bindings = LogicalOperator::GenerateColumnBindings(0, create_index.table.GetColumns().LogicalColumnCount());
147783
147784 types.clear();
147786 return;
147787 }
147788 case LogicalOperatorType::LOGICAL_GET: {
147790 bindings = op.GetColumnBindings();
147791 types = op.types;
147793 return;
147794 }
147795 case LogicalOperatorType::LOGICAL_INSERT: {
147797
147798 auto &insert_op = op.Cast<LogicalInsert>();
147799 if (insert_op.on_conflict_info.action_type != OnConflictAction::THROW) {
147800
147802 auto column_count = insert_op.table.GetColumns().PhysicalColumnCount();
147803 auto dummy_bindings =
147804 LogicalOperator::GenerateColumnBindings(insert_op.on_conflict_info.excluded_table_index, column_count);
147805
147806
147807 bindings.insert(bindings.begin(), dummy_bindings.begin(), dummy_bindings.end());
147808
147809 types.clear();
147810 if (insert_op.on_conflict_info.on_conflict_condition) {
147811 VisitExpression(&insert_op.on_conflict_info.on_conflict_condition);
147812 }
147813 if (insert_op.on_conflict_info.do_update_condition) {
147814 VisitExpression(&insert_op.on_conflict_info.do_update_condition);
147815 }
147817 bindings = op.GetColumnBindings();
147818 types = op.types;
147819 return;
147820 }
147821 break;
147822 }
147823 case LogicalOperatorType::LOGICAL_EXTENSION_OPERATOR: {
147824 auto &ext_op = op.Cast<LogicalExtensionOperator>();
147825
147826
147827 types.clear();
147828 ext_op.ResolveColumnBindings(*this, bindings);
147829 types.clear();
147830 return;
147831 }
147832 case LogicalOperatorType::LOGICAL_RECURSIVE_CTE: {
147833 auto &rec = op.Cast<LogicalRecursiveCTE>();
147835 bindings = op.GetColumnBindings();
147836 types = op.types;
147837 for (auto &expr : rec.key_targets) {
147838 VisitExpression(&expr);
147839 }
147840 return;
147841 }
147842 default:
147843 break;
147844 }
147845
147846
147847
147849
147851
147852 bindings = op.GetColumnBindings();
147853 types = op.types;
147854}
void VisitOperator(LogicalOperator &op) override
Definition duckdb.cpp:147694
void VisitOperatorExpressions(LogicalOperator &op)
Definition duckdb.cpp:381188
void VisitOperatorChildren(LogicalOperator &op)
Definition duckdb.cpp:380983