Commit bd6fb72
[fix](fe) Fix INSERT INTO local TVF ignoring backend_id during scheduling (#61732)
### What problem does this PR solve?
Followup #60719
Problem Summary: When using `INSERT INTO local("backend_id" = "X" ...)`,
the data should only be written to the BE node specified by
`backend_id`. However, the Coordinator schedules the sink fragment to an
arbitrary backend because the fragment uses `UNPARTITIONED` partition,
which causes `SimpleScheduler.getHost()` to pick any available BE. This
results in file creation failures when the target directory only exists
on the intended BE.
**Root Cause:**
- The read path (`SELECT FROM local(...)`) correctly handles this via
`TVFScanNode.initBackendPolicy()`, restricting the scan to the specified
backend.
- The write path (`INSERT INTO local(...)`) had no equivalent logic.
`PhysicalPlanTranslator.visitPhysicalTVFTableSink()` creates the
fragment as `UNPARTITIONED`, and `Coordinator.computeFragmentHosts()`
assigns it to a random BE.
**Fix:**
Added backend_id-aware scheduling in
`Coordinator.computeFragmentHosts()` for local `TVFTableSink`, forcing
the sink fragment to execute on the designated backend. This is
consistent with the existing `DictionarySink` pattern that also
overrides fragment scheduling for specific sink types.
**Changes:**
1. `TVFTableSink.java` - Added `getTvfName()` and `getBackendId()`
accessor methods
2. `Coordinator.java` - Added check before UNPARTITIONED scheduling: if
the sink is a local TVFTableSink with a specific backend_id, force the
fragment onto that backend1 parent 0dd1473 commit bd6fb72
File tree
2 files changed
+35
-0
lines changed- fe/fe-core/src/main/java/org/apache/doris
- planner
- qe
2 files changed
+35
-0
lines changedLines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
63 | 79 | | |
64 | 80 | | |
65 | 81 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
1767 | 1768 | | |
1768 | 1769 | | |
1769 | 1770 | | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
1770 | 1789 | | |
1771 | 1790 | | |
1772 | 1791 | | |
| |||
0 commit comments