mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-28 13:44:03 +00:00
`or` inferred the qualifier of an operand plan from its first field (`schema.qualified_field(0)`). A binary operation with an explicit matching modifier derives its result labels from the left operand when the match reduces the label set, so its projected plan carries two qualifiers: the labels are `lhs.<label>` while the time index keeps the context table's qualifier (`rhs.<greptime_timestamp>`). Prefixing the time index with the first field's qualifier then referenced a column that does not exist, and planning failed with Internal error during building DataFusion plan: No field named lhs.greptime_timestamp. Did you mean 'rhs.greptime_timestamp'? for e.g. `sum by (l) (f(a) / ignoring(x) group_left() f(b))` used as the right operand of `or on (l)`. `f(a) / ignoring(x) f(b)` triggers it as well, so this is not specific to a group modifier. Without a matching modifier every projected column takes the right operand's qualifier, which is why plain `a / b` never hit this. Resolve the time index against the actual operand schema: keep the preferred qualifier when it really holds the column (uniform schemas, so no plan changes), otherwise take the qualifier of the column found by name and let DataFusion report ambiguity instead of guessing. Signed-off-by: discord9 <discord9@163.com>