Skip to content

[Bug]: Airflow TaskInstance/DagRun eager JOIN fails planner column remapping with and without index hints (v4.2.5) #29907

Closed

Description

@dengn

Is there an existing issue for the same bug?

  • I searched exact error strings, failing syntax and affected native applications; no matching issue was identified. Related reports are distinguished below.

Application compatibility replay on official v4.2.5

Branch Name

Official stable release v4.2.5; current main has not been retested for this report.

Commit ID

1a44f3db3056e32975fde86ca0ab69a094996a3f (SELECT git_version() returns 1a44f3d).

Other Environment Information

Linux x86_64 standalone official binary, 4 CPUs, ~16 GiB container memory limit. SELECT VERSION() = 8.0.30-MatrixOne-v4.2.5. PyMySQL 1.2.3 client. Only fresh owned test schemas were used for SQL probes; the native Airflow diagnostic is a read-only SELECT against the retained test fixture.

Actual Behavior

Native application impact: Column remapping failed: dag_run_1.run_id;调度器退出。

SQL parser error: Column remapping failed: cannot find column reference
❌ Missing Column:
   Position: [RelPos=7, ColPos=0]
   Name: dag.dag_id

📍 Context:
   Step: 0
   Node ID: 8
   Node Type: JOIN
   Tip: OnList
   Expression Index: 1

🔧 Optimization History:
   - pushdownFilters:before (nodeID: 6, nodeType: PROJECT, filters: 0)
   - pushdownFilters:before (nodeID: 5, nodeType: FILTER, filters: 0)
   - pushdownFilters:before (nodeID: 4, nodeType: JOIN, filters: 3)
   - pushdownFilters:middle (nodeID: 4, JOIN, filters: 3, onList: 2)
   - pushdownFilters:before (nodeID: 2, nodeType: JOIN, filters: 0)
   - pushdownFilters:middle (nodeID: 2, JOIN, filters: 0, onList: 1)
   - pushdownFilters:before (nodeID: 0, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 0, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 0, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 0, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 0, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 0, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 2, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 3, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 3, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 3, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 2, nodeType: JOIN, filters: 3)
   - pushdownFilters:middle (nodeID: 2, JOIN, filters: 3, onList: 1)
   - pushdownFilters:before (nodeID: 0, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 0, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 0, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 0, nodeType: TABLE_SCAN, filters: 3)
   - pushdownFilters:middle (nodeID: 0, TABLE_SCAN, filters: 3)
   - pushdownFilters:after (nodeID: 0, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 2, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 3, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 3, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 3, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 4, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 5 -> 4, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 6, no change, cantPushdown: 0)
   - determineJoinOrder:middle (nodeID: 4, leaves: 3, conds: 3)
   - pushdownFilters:before (nodeID: 8, nodeType: JOIN, filters: 4)
   - pushdownFilters:middle (nodeID: 8, JOIN, filters: 4, onList: 0)
   - pushdownFilters:before (nodeID: 0, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 0, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 0, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 7, nodeType: JOIN, filters: 0)
   - pushdownFilters:middle (nodeID: 7, JOIN, filters: 0, onList: 0)
   - pushdownFilters:before (nodeID: 3, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 3, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 3, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 3, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 3, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 3, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 7, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 0, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 0, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 0, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 7, nodeType: JOIN, filters: 1)
   - pushdownFilters:middle (nodeID: 7, JOIN, filters: 1, onList: 0)
   - pushdownFilters:before (nodeID: 3, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 3, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 3, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 3, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 3, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 3, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 7, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 8, no change, cantPushdown: 0)
   - determineJoinOrder:after (nodeID: 4 -> 8, remainingConds: 0)
   - rule3: A=dag_run(stats:sel=1.0000,outcnt=241.00,tablecnt=241.00) B=dag(stats:sel=1.0000,outcnt=1.00,tablecnt=1.00) C=task_instance(stats:sel=0.0500,outcnt=24.10,tablecnt=482.00)

✅ Available Columns in Context:
   [RelPos=6, ColPos=0] -> task_instance.id
   [RelPos=6, ColPos=10] -> task_instance.max_tries
   [RelPos=6, ColPos=11] -> task_instance.hostname
   [RelPos=6, ColPos=12] -> task_instance.unixname
   [RelPos=6, ColPos=13] -> task_instance.pool
   [RelPos=6, ColPos=14] -> task_instance.pool_slots
   [RelPos=6, ColPos=15] -> task_instance.queue
   [RelPos=6, ColPos=16] -> task_instance.priority_weight
   [RelPos=6, ColPos=17] -> task_instance.operator
   [RelPos=6, ColPos=18] -> task_instance.custom_operator_name
   [RelPos=6, ColPos=19] -> task_instance.queued_dttm
   [RelPos=6, ColPos=1] -> task_instance.task_id
   [RelPos=6, ColPos=20] -> task_instance.scheduled_dttm
   [RelPos=6, ColPos=21] -> task_instance.queued_by_job_id
   [RelPos=6, ColPos=22] -> task_instance.last_heartbeat_at
   [RelPos=6, ColPos=23] -> task_instance.pid
   [RelPos=6, ColPos=24] -> task_instance.executor
   [RelPos=6, ColPos=25] -> task_instance.executor_config
   [RelPos=6, ColPos=26] -> task_instance.updated_at
   [RelPos=6, ColPos=27] -> task_instance.rendered_map_index
   [RelPos=6, ColPos=28] -> task_instance.context_carrier
   [RelPos=6, ColPos=29] -> task_instance.span_status
   [RelPos=6, ColPos=2] -> task_instance.dag_id
   [RelPos=6, ColPos=30] -> task_instance.external_executor_id
   [RelPos=6, ColPos=31] -> task_instance.trigger_id
   [RelPos=6, ColPos=32] -> task_instance.trigger_timeout
   [RelPos=6, ColPos=33] -> task_instance.next_method
   [RelPos=6, ColPos=34] -> task_instance.next_kwargs
   [RelPos=6, ColPos=35] -> task_instance.task_display_name
   [RelPos=6, ColPos=36] -> task_instance.dag_version_id
   [RelPos=6, ColPos=37] -> task_instance.retry_delay_override
   [RelPos=6, ColPos=38] -> task_instance.retry_reason
   [RelPos=6, ColPos=3] -> task_instance.run_id
   [RelPos=6, ColPos=4] -> task_instance.map_index
   [RelPos=6, ColPos=5] -> task_instance.start_date
   [RelPos=6, ColPos=6] -> task_instance.end_date
   [RelPos=6, ColPos=7] -> task_instance.duration
   [RelPos=6, ColPos=8] -> task_instance.state
   [RelPos=6, ColPos=9] -> task_instance.try_number
   [RelPos=8, ColPos=0] -> dag_run_1.id
   [RelPos=8, ColPos=10] -> dag_run_1.triggered_by
   [RelPos=8, ColPos=11] -> dag_run_1.triggering_user_name
   [RelPos=8, ColPos=12] -> dag_run_1.conf
   [RelPos=8, ColPos=13] -> dag_run_1.data_interval_start
   [RelPos=8, ColPos=14] -> dag_run_1.data_interval_end
   [RelPos=8, ColPos=15] -> dag_run_1.run_after
   [RelPos=8, ColPos=16] -> dag_run_1.last_scheduling_decision
   [RelPos=8, ColPos=17] -> dag_run_1.log_template_id
   [RelPos=8, ColPos=18] -> dag_run_1.created_at
   [RelPos=8, ColPos=19] -> dag_run_1.updated_at
   [RelPos=8, ColPos=1] -> dag_run_1.dag_id
   [RelPos=8, ColPos=20] -> dag_run_1.clear_number
   [RelPos=8, ColPos=21] -> dag_run_1.backfill_id
   [RelPos=8, ColPos=22] -> dag_run_1.bundle_version
   [RelPos=8, ColPos=23] -> dag_run_1.scheduled_by_job_id
   [RelPos=8, ColPos=24] -> dag_run_1.context_carrier
   [RelPos=8, ColPos=25] -> dag_run_1.span_status
   [RelPos=8, ColPos=26] -> dag_run_1.created_dag_version_id
   [RelPos=8, ColPos=27] -> dag_run_1.partition_key
   [RelPos=8, ColPos=28] -> dag_run_1.partition_date
   [RelPos=8, ColPos=2] -> dag_run_1.queued_at
   [RelPos=8, ColPos=3] -> dag_run_1.logical_date
   [RelPos=8, ColPos=4] -> dag_run_1.start_date
   [RelPos=8, ColPos=5] -> dag_run_1.end_date
   [RelPos=8, ColPos=6] -> dag_run_1.state
   [RelPos=8, ColPos=7] -> dag_run_1.run_id
   [RelPos=8, ColPos=8] -> dag_run_1.creating_job_id
   [RelPos=8, ColPos=9] -> dag_run_1.run_type


SQL parser error: Column remapping failed: cannot find column reference
❌ Missing Column:
   Position: [RelPos=7, ColPos=0]
   Name: dag.dag_id

📍 Context:
   Step: 0
   Node ID: 8
   Node Type: JOIN
   Tip: OnList
   Expression Index: 1

🔧 Optimization History:
   - pushdownFilters:before (nodeID: 6, nodeType: PROJECT, filters: 0)
   - pushdownFilters:before (nodeID: 5, nodeType: FILTER, filters: 0)
   - pushdownFilters:before (nodeID: 4, nodeType: JOIN, filters: 3)
   - pushdownFilters:middle (nodeID: 4, JOIN, filters: 3, onList: 2)
   - pushdownFilters:before (nodeID: 2, nodeType: JOIN, filters: 0)
   - pushdownFilters:middle (nodeID: 2, JOIN, filters: 0, onList: 1)
   - pushdownFilters:before (nodeID: 0, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 0, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 0, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 0, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 0, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 0, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 2, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 3, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 3, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 3, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 2, nodeType: JOIN, filters: 3)
   - pushdownFilters:middle (nodeID: 2, JOIN, filters: 3, onList: 1)
   - pushdownFilters:before (nodeID: 0, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 0, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 0, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 0, nodeType: TABLE_SCAN, filters: 3)
   - pushdownFilters:middle (nodeID: 0, TABLE_SCAN, filters: 3)
   - pushdownFilters:after (nodeID: 0, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 2, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 3, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 3, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 3, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 4, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 5 -> 4, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 6, no change, cantPushdown: 0)
   - determineJoinOrder:middle (nodeID: 4, leaves: 3, conds: 3)
   - pushdownFilters:before (nodeID: 8, nodeType: JOIN, filters: 4)
   - pushdownFilters:middle (nodeID: 8, JOIN, filters: 4, onList: 0)
   - pushdownFilters:before (nodeID: 0, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 0, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 0, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 7, nodeType: JOIN, filters: 0)
   - pushdownFilters:middle (nodeID: 7, JOIN, filters: 0, onList: 0)
   - pushdownFilters:before (nodeID: 3, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 3, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 3, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 3, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 3, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 3, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 7, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 0, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 0, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 0, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 7, nodeType: JOIN, filters: 1)
   - pushdownFilters:middle (nodeID: 7, JOIN, filters: 1, onList: 0)
   - pushdownFilters:before (nodeID: 3, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 3, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 3, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 3, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 3, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 3, no change, cantPushdown: 0)
   - pushdownFilters:before (nodeID: 1, nodeType: TABLE_SCAN, filters: 0)
   - pushdownFilters:middle (nodeID: 1, TABLE_SCAN, filters: 0)
   - pushdownFilters:after (nodeID: 1, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 7, no change, cantPushdown: 0)
   - pushdownFilters:after (nodeID: 8, no change, cantPushdown: 0)
   - determineJoinOrder:after (nodeID: 4 -> 8, remainingConds: 0)
   - rule3: A=dag_run(stats:sel=1.0000,outcnt=241.00,tablecnt=241.00) B=dag(stats:sel=1.0000,outcnt=1.00,tablecnt=1.00) C=task_instance(stats:sel=0.0500,outcnt=24.10,tablecnt=482.00)

✅ Available Columns in Context:
   [RelPos=6, ColPos=0] -> task_instance.id
   [RelPos=6, ColPos=10] -> task_instance.max_tries
   [RelPos=6, ColPos=11] -> task_instance.hostname
   [RelPos=6, ColPos=12] -> task_instance.unixname
   [RelPos=6, ColPos=13] -> task_instance.pool
   [RelPos=6, ColPos=14] -> task_instance.pool_slots
   [RelPos=6, ColPos=15] -> task_instance.queue
   [RelPos=6, ColPos=16] -> task_instance.priority_weight
   [RelPos=6, ColPos=17] -> task_instance.operator
   [RelPos=6, ColPos=18] -> task_instance.custom_operator_name
   [RelPos=6, ColPos=19] -> task_instance.queued_dttm
   [RelPos=6, ColPos=1] -> task_instance.task_id
   [RelPos=6, ColPos=20] -> task_instance.scheduled_dttm
   [RelPos=6, ColPos=21] -> task_instance.queued_by_job_id
   [RelPos=6, ColPos=22] -> task_instance.last_heartbeat_at
   [RelPos=6, ColPos=23] -> task_instance.pid
   [RelPos=6, ColPos=24] -> task_instance.executor
   [RelPos=6, ColPos=25] -> task_instance.executor_config
   [RelPos=6, ColPos=26] -> task_instance.updated_at
   [RelPos=6, ColPos=27] -> task_instance.rendered_map_index
   [RelPos=6, ColPos=28] -> task_instance.context_carrier
   [RelPos=6, ColPos=29] -> task_instance.span_status
   [RelPos=6, ColPos=2] -> task_instance.dag_id
   [RelPos=6, ColPos=30] -> task_instance.external_executor_id
   [RelPos=6, ColPos=31] -> task_instance.trigger_id
   [RelPos=6, ColPos=32] -> task_instance.trigger_timeout
   [RelPos=6, ColPos=33] -> task_instance.next_method
   [RelPos=6, ColPos=34] -> task_instance.next_kwargs
   [RelPos=6, ColPos=35] -> task_instance.task_display_name
   [RelPos=6, ColPos=36] -> task_instance.dag_version_id
   [RelPos=6, ColPos=37] -> task_instance.retry_delay_override
   [RelPos=6, ColPos=38] -> task_instance.retry_reason
   [RelPos=6, ColPos=3] -> task_instance.run_id
   [RelPos=6, ColPos=4] -> task_instance.map_index
   [RelPos=6, ColPos=5] -> task_instance.start_date
   [RelPos=6, ColPos=6] -> task_instance.end_date
   [RelPos=6, ColPos=7] -> task_instance.duration
   [RelPos=6, ColPos=8] -> task_instance.state
   [RelPos=6, ColPos=9] -> task_instance.try_number
   [RelPos=8, ColPos=0] -> dag_run_1.id
   [RelPos=8, ColPos=10] -> dag_run_1.triggered_by
   [RelPos=8, ColPos=11] -> dag_run_1.triggering_user_name
   [RelPos=8, ColPos=12] -> dag_run_1.conf
   [RelPos=8, ColPos=13] -> dag_run_1.data_interval_start
   [RelPos=8, ColPos=14] -> dag_run_1.data_interval_end
   [RelPos=8, ColPos=15] -> dag_run_1.run_after
   [RelPos=8, ColPos=16] -> dag_run_1.last_scheduling_decision
   [RelPos=8, ColPos=17] -> dag_run_1.log_template_id
   [RelPos=8, ColPos=18] -> dag_run_1.created_at
   [RelPos=8, ColPos=19] -> dag_run_1.updated_at
   [RelPos=8, ColPos=1] -> dag_run_1.dag_id
   [RelPos=8, ColPos=20] -> dag_run_1.clear_number
   [RelPos=8, ColPos=21] -> dag_run_1.backfill_id
   [RelPos=8, ColPos=22] -> dag_run_1.bundle_version
   [RelPos=8, ColPos=23] -> dag_run_1.scheduled_by_job_id
   [RelPos=8, ColPos=24] -> dag_run_1.context_carrier
   [RelPos=8, ColPos=25] -> dag_run_1.span_status
   [RelPos=8, ColPos=26] -> dag_run_1.created_dag_version_id
   [RelPos=8, ColPos=27] -> dag_run_1.partition_key
   [RelPos=8, ColPos=28] -> dag_run_1.partition_date
   [RelPos=8, ColPos=2] -> dag_run_1.queued_at
   [RelPos=8, ColPos=3] -> dag_run_1.logical_date
   [RelPos=8, ColPos=4] -> dag_run_1.start_date
   [RelPos=8, ColPos=5] -> dag_run_1.end_date
   [RelPos=8, ColPos=6] -> dag_run_1.state
   [RelPos=8, ColPos=7] -> dag_run_1.run_id
   [RelPos=8, ColPos=8] -> dag_run_1.creating_job_id
   [RelPos=8, ColPos=9] -> dag_run_1.run_type


Expected Behavior

Execute the valid SQLAlchemy eager-loading JOIN query, with or without the index hint, without a planner column-remapping error.

Steps to Reproduce

Native runtime reproduction: initialize official Airflow 3.3.2 using its normal migrations, seed a queued workflow with TaskInstances, and execute the full eager-loading SELECT below. This SELECT was re-executed read-only against the retained native fixture and failed both with and without USE INDEX. Complete standalone data minimization remains pending.

Use a dedicated fresh test schema (create one without DROP DATABASE), then run:

SELECT task_instance.id, task_instance.task_id, task_instance.dag_id, task_instance.run_id, task_instance.map_index, task_instance.start_date, task_instance.end_date, task_instance.duration, task_instance.state, task_instance.try_number, task_instance.max_tries, task_instance.hostname, task_instance.unixname, task_instance.pool, task_instance.pool_slots, task_instance.queue, task_instance.priority_weight, task_instance.operator, task_instance.custom_operator_name, task_instance.queued_dttm, task_instance.scheduled_dttm, task_instance.queued_by_job_id, task_instance.last_heartbeat_at, task_instance.pid, task_instance.executor, task_instance.executor_config, task_instance.updated_at, task_instance.rendered_map_index, task_instance.context_carrier, task_instance.span_status, task_instance.external_executor_id, task_instance.trigger_id, task_instance.trigger_timeout, task_instance.next_method, task_instance.next_kwargs, task_instance.task_display_name, task_instance.dag_version_id, task_instance.retry_delay_override, task_instance.retry_reason, dag_run_1.id AS id_1, dag_run_1.dag_id AS dag_id_1, dag_run_1.queued_at, dag_run_1.logical_date, dag_run_1.start_date AS start_date_1, dag_run_1.end_date AS end_date_1, dag_run_1.state AS state_1, dag_run_1.run_id AS run_id_1, dag_run_1.creating_job_id, dag_run_1.run_type, dag_run_1.triggered_by, dag_run_1.triggering_user_name, dag_run_1.conf, dag_run_1.data_interval_start, dag_run_1.data_interval_end, dag_run_1.run_after, dag_run_1.last_scheduling_decision, dag_run_1.log_template_id, dag_run_1.created_at, dag_run_1.updated_at AS updated_at_1, dag_run_1.clear_number, dag_run_1.backfill_id, dag_run_1.bundle_version, dag_run_1.scheduled_by_job_id, dag_run_1.context_carrier AS context_carrier_1, dag_run_1.span_status AS span_status_1, dag_run_1.created_dag_version_id, dag_run_1.partition_key, dag_run_1.partition_date 
FROM task_instance USE INDEX (ti_state) INNER JOIN dag ON task_instance.dag_id = dag.dag_id INNER JOIN dag_run AS dag_run_1 ON dag_run_1.dag_id = task_instance.dag_id AND dag_run_1.run_id = task_instance.run_id 
WHERE task_instance.state IN ('running', 'restarting') AND task_instance.last_heartbeat_at < '2026-10-11 10:00:26.268106' AND task_instance.queued_by_job_id = 8;

-- The same SELECT after removing USE INDEX(...) also fails.


-- Actual retained native schema (these DDLs have FK dependencies; this is not a self-contained minimal migration script):
CREATE TABLE `dag` (
  `dag_id` varchar(250) NOT NULL,
  `is_paused` bool NOT NULL,
  `is_stale` bool NOT NULL,
  `exceeds_max_non_backfill` bool NOT NULL DEFAULT '0',
  `last_parsed_time` timestamp(6) NULL DEFAULT NULL,
  `last_parse_duration` float DEFAULT NULL,
  `last_expired` timestamp(6) NULL DEFAULT NULL,
  `fileloc` varchar(2000) DEFAULT NULL,
  `relative_fileloc` varchar(2000) DEFAULT NULL,
  `bundle_name` varchar(250) NOT NULL,
  `bundle_version` varchar(200) DEFAULT NULL,
  `owners` varchar(2000) DEFAULT NULL,
  `dag_display_name` varchar(2000) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `timetable_type` varchar(255) NOT NULL,
  `timetable_summary` text DEFAULT NULL,
  `timetable_description` varchar(1000) DEFAULT NULL,
  `timetable_partitioned` bool NOT NULL DEFAULT '0',
  `timetable_periodic` bool NOT NULL DEFAULT '0',
  `partition_mapper_info` json NOT NULL,
  `asset_expression` json DEFAULT NULL,
  `deadline` json DEFAULT NULL,
  `max_active_tasks` int NOT NULL,
  `max_active_runs` int DEFAULT NULL,
  `max_consecutive_failed_dag_runs` int NOT NULL,
  `has_task_concurrency_limits` bool NOT NULL,
  `has_import_errors` bool DEFAULT '0',
  `fail_fast` bool NOT NULL DEFAULT '0',
  `allowed_run_types` json DEFAULT NULL,
  `next_dagrun` timestamp(6) NULL DEFAULT NULL,
  `next_dagrun_data_interval_start` timestamp(6) NULL DEFAULT NULL,
  `next_dagrun_data_interval_end` timestamp(6) NULL DEFAULT NULL,
  `next_dagrun_partition_key` varchar(255) DEFAULT NULL,
  `next_dagrun_partition_date` timestamp(6) NULL DEFAULT NULL,
  `next_dagrun_create_after` timestamp(6) NULL DEFAULT NULL,
  PRIMARY KEY (`dag_id`),
  KEY `idx_next_dagrun_create_after` (`next_dagrun_create_after`),
  CONSTRAINT `dag_bundle_name_fkey` FOREIGN KEY (`bundle_name`) REFERENCES `dag_bundle` (`name`) ON DELETE RESTRICT ON UPDATE RESTRICT
);

CREATE TABLE `dag_run` (
  `id` int NOT NULL AUTO_INCREMENT,
  `dag_id` varchar(250) NOT NULL,
  `queued_at` timestamp(6) NULL DEFAULT NULL,
  `logical_date` timestamp(6) NULL DEFAULT NULL,
  `start_date` timestamp(6) NULL DEFAULT NULL,
  `end_date` timestamp(6) NULL DEFAULT NULL,
  `state` varchar(50) DEFAULT NULL,
  `run_id` varchar(250) NOT NULL,
  `creating_job_id` int DEFAULT NULL,
  `run_type` varchar(50) NOT NULL,
  `triggered_by` varchar(50) DEFAULT NULL,
  `triggering_user_name` varchar(512) DEFAULT NULL,
  `conf` json DEFAULT NULL,
  `data_interval_start` timestamp(6) NULL DEFAULT NULL,
  `data_interval_end` timestamp(6) NULL DEFAULT NULL,
  `run_after` timestamp(6) NOT NULL,
  `last_scheduling_decision` timestamp(6) NULL DEFAULT NULL,
  `log_template_id` int DEFAULT NULL,
  `created_at` timestamp(6) NULL DEFAULT NULL,
  `updated_at` timestamp(6) NULL DEFAULT NULL,
  `clear_number` int NOT NULL DEFAULT '0',
  `backfill_id` int DEFAULT NULL,
  `bundle_version` varchar(250) DEFAULT NULL,
  `scheduled_by_job_id` int DEFAULT NULL,
  `context_carrier` json DEFAULT NULL,
  `span_status` varchar(250) NOT NULL DEFAULT 'not_started',
  `created_dag_version_id` char(32) DEFAULT NULL,
  `partition_key` varchar(250) DEFAULT NULL,
  `partition_date` timestamp(6) NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `dag_id` (`dag_id`,`run_id`),
  UNIQUE KEY `dag_id_2` (`dag_id`,`logical_date`),
  KEY `idx_dag_run_created_dag_version_id` (`created_dag_version_id`),
  KEY `dag_id_state` (`dag_id`,`state`),
  KEY `idx_dag_run_dag_id` (`dag_id`),
  KEY `idx_dag_run_queued_dags` (`state`,`dag_id`),
  KEY `idx_dag_run_run_after` (`run_after`),
  KEY `idx_dag_run_running_dags` (`state`,`dag_id`),
  CONSTRAINT `task_instance_log_template_id_fkey` FOREIGN KEY (`log_template_id`) REFERENCES `log_template` (`id`) ON DELETE NO ACTION ON UPDATE RESTRICT,
  CONSTRAINT `dag_run_backfill_id_fkey` FOREIGN KEY (`backfill_id`) REFERENCES `backfill` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `created_dag_version_id_fkey` FOREIGN KEY (`created_dag_version_id`) REFERENCES `dag_version` (`id`) ON DELETE SET NULL ON UPDATE RESTRICT
);

CREATE TABLE `task_instance` (
  `id` char(32) NOT NULL,
  `task_id` varchar(250) NOT NULL,
  `dag_id` varchar(250) NOT NULL,
  `run_id` varchar(250) NOT NULL,
  `map_index` int NOT NULL DEFAULT '-1',
  `start_date` timestamp(6) NULL DEFAULT NULL,
  `end_date` timestamp(6) NULL DEFAULT NULL,
  `duration` float DEFAULT NULL,
  `state` varchar(20) DEFAULT NULL,
  `try_number` int NOT NULL,
  `max_tries` int NOT NULL DEFAULT '-1',
  `hostname` varchar(1000) DEFAULT NULL,
  `unixname` varchar(1000) DEFAULT NULL,
  `pool` varchar(256) NOT NULL,
  `pool_slots` int NOT NULL,
  `queue` varchar(256) DEFAULT NULL,
  `priority_weight` int DEFAULT NULL,
  `operator` varchar(1000) DEFAULT NULL,
  `custom_operator_name` varchar(1000) DEFAULT NULL,
  `queued_dttm` timestamp(6) NULL DEFAULT NULL,
  `scheduled_dttm` timestamp(6) NULL DEFAULT NULL,
  `queued_by_job_id` int DEFAULT NULL,
  `last_heartbeat_at` timestamp(6) NULL DEFAULT NULL,
  `pid` int DEFAULT NULL,
  `executor` varchar(1000) DEFAULT NULL,
  `executor_config` blob DEFAULT NULL,
  `updated_at` timestamp(6) NULL DEFAULT NULL,
  `rendered_map_index` varchar(250) DEFAULT NULL,
  `context_carrier` json DEFAULT NULL,
  `span_status` varchar(250) NOT NULL DEFAULT 'not_started',
  `external_executor_id` text DEFAULT NULL,
  `trigger_id` int DEFAULT NULL,
  `trigger_timeout` timestamp(6) NULL DEFAULT NULL,
  `next_method` varchar(1000) DEFAULT NULL,
  `next_kwargs` json DEFAULT NULL,
  `task_display_name` varchar(2000) DEFAULT NULL,
  `dag_version_id` char(32) DEFAULT NULL,
  `retry_delay_override` float DEFAULT NULL,
  `retry_reason` varchar(500) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `dag_id` (`dag_id`,`task_id`,`run_id`,`map_index`),
  KEY `ti_pool` (`pool`,`state`,`priority_weight`),
  KEY `ti_dag_version_id` (`dag_version_id`),
  KEY `ti_trigger_id` (`trigger_id`),
  KEY `ti_state` (`state`),
  KEY `ti_state_lkp` (`dag_id`,`task_id`,`run_id`,`state`),
  KEY `ti_dag_run` (`dag_id`,`run_id`),
  KEY `ti_dag_state` (`dag_id`,`state`),
  KEY `ti_heartbeat` (`last_heartbeat_at`),
  CONSTRAINT `task_instance_trigger_id_fkey` FOREIGN KEY (`trigger_id`) REFERENCES `trigger` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT `task_instance_dag_run_fkey` FOREIGN KEY (`dag_id`,`run_id`) REFERENCES `dag_run` (`dag_id`,`run_id`) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT `task_instance_dag_version_id_fkey` FOREIGN KEY (`dag_version_id`) REFERENCES `dag_version` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
);

Additional information

  • Native applications: Airflow.
  • This is release v4.2.5 evidence, not a claim that the same failure remains on current main.
  • Observation family MO-OBS-019. App-side workarounds do not constitute an engine fix.
  • All disclosed values are owned synthetic fixtures; no passwords, tokens, application cookies or raw private logs are attached.

Activity

  1. added
    kind/bug
    on Oct 11, 2026
  2. Ariznawlll commented on Oct 14, 2026

    @Ariznawlll
    Collaborator

    补充当前 main 的复现与边界:

    • 固定源码 commit:2ce4e58af6f03b943ee288ffad81012766cf830a;本地 mo-service 的 Go build metadata 对应该 commit,MySQL 对照为 8.0.46。使用独立 schema,包含该 SQL 投影所需列、相关主键/唯一键,以及 ti_state、ti_dag_run、ti_heartbeat 索引;构造 482 条匹配数据并执行 ANALYZE TABLE task_instance。
    • issue 中完整宽 SELECT 在当前 main 上,带/不带 USE INDEX (ti_state) 均稳定 3/3 报 Column remapping failed,缺失列是 dag.dag_id;MySQL 两种形式都返回 482 行。SELECT 1 的三表最小投影也能复现,因此不依赖宽投影。
    • 边界:两表 JOIN 正常;三表链移除 last_heartbeat_at 谓词后正常;将 dag_run 置于 FROM 首位后正常;尾部改为 LEFT JOIN 后正常。CTE、派生表、CTAS 和已创建 View 的查询也触发同一列重映射错误(CREATE VIEW 本身成功)。带参数的 PREPARE/EXECUTE 可正常执行;复用同一 prepared statement,三个时间阈值返回 0/482/482,与 MySQL 一致。
    • USE INDEX 不改变错误;session hint joinOrdering=1 可使该三表查询正常,表明问题与 INNER JOIN 重排后的列重映射路径相关。未将这个内部 hint 作为用户侧修复建议。未执行产品代码修改或新增测试。

    注意:复现 schema 是独立最小 schema,不包含 Airflow 所有外键和无关索引;此结论是当前 main 对该查询形态的 planner 复现,原生 Airflow 完整迁移库仍需在当前 main 上重放。

  3. jiangxinmeng1 commented on Oct 16, 2026

    @jiangxinmeng1
    Contributor

    fixed by #30056

  4. Ariznawlll commented on Oct 19, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 官方 main:d0e7f9a552f90b28dd37c87a30c4c6dc83ae7423;测试后复核远端 main 仍为同一完整 SHA。
    • 修复 #30056 已 MERGED,merge commit fab7b5c0430a475bf64ad1619ce4d5249013a138;GitHub compare 确认该提交已进入本次测试 SHA。
    • 本地隔离 1 CN / 1 TN / 1 LogService,MySQL 协议直连;独立三表 schema,241 条 DagRun、482 条 TaskInstance,ANALYZE TABLE task_instance 实际报告 population_rows=482。未使用共享集群。

    原问题验证

    在独立 schema 中按 issue 的三表 JOIN 结构、关键列、ti_state / ti_dag_run / ti_heartbeat 索引和 482 行数据复现旧触发条件。执行 issue 正文中的完整宽 SELECT(投影全部原列),不带索引 hint 和带 USE INDEX (ti_state) 两版各连续 3 轮;每轮均成功返回 482 行,首尾 TaskInstance ID 为 1/482,没有 Column remapping failed。同轮的三表短投影返回相同的 482 行与首尾 JOIN ID (1,1)/(482,241)。

    Happy Path 覆盖

    • 原宽 SELECT 的两种 hint 形式各 3/3 成功,482/482 行。
    • 短投影三表 JOIN 同样各 3/3,实际首尾 JOIN ID 符合构造的 2 个 TaskInstance 对应 1 个 DagRun 关系。
    • 现有 TestIssue29907AirflowJoinColumnRemapping 覆盖原宽 SELECT 的有/无 hint 优化器路径,-count=3 PASS。

    Unhappy Path 覆盖

    将 1 行状态改为 restarting,另 1 行改为非匹配的 queued,再分别把 1 行心跳和 1 行 queued_by_job_id 置 NULL。两种 hint 形式各 3/3 返回 479 行 / 479 个不同 ID;restarting 行保留,非匹配状态和两个 NULL 行均排除。将心跳阈值改为比全部数据更早,两种形式各 3/3 执行成功并返回空结果。完成后删除专用数据库,information_schema 复查残留数为 0。

    白盒验证

    当前 main 现有 pkg/sql/plan/issue_29907_repro_test.go 建立三表列、索引、241/482 统计信息并分别优化原宽 SELECT 的有/无 hint 版本。本轮运行该 Go 定向测试 -count=3 PASS,并用真实 SQL 协议和实际结果行数补足非模拟验证。测试 schema 保留了原查询的全部投影列和关键索引,但没有迁移 Airflow 的所有无关表/外键;原生 Airflow 3.3.2 调度器整应用本轮未启动。

    回归测试

    已有 Go 回归 TestIssue29907AirflowJoinColumnRemapping 精确覆盖本 issue 的两种原宽 SQL 规划路径,并在当前 main 连续 3 次通过。按本轮“已有 Go 覆盖可不重复加 MOTR”的口径,未在 #247 再搬运一份相同查询。完整 Go suite、MOTR suite 和集成 CI 本次未运行。

    测试证据

    • 原宽 SELECT:无 hint 3/3、USE INDEX (ti_state) 3/3,均 482 行,首/尾 ID 1/482。
    • 过滤/NULL 边界:两版各 3/3 为 479 行且 479 个不同 ID;空阈值两版各 3/3 为 0 行。
    • Go 定向:ok github.com/matrixorigin/matrixone/pkg/sql/plan(-count=3)。
    • 本结论仅对应已测试的官方 main;历史 v4.2.5 发布镜像是否包含修复未在此声称。

    测试结论

    测试通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions