Files
greptimedb/src
discord9 981e84caef feat(promql): reserve __name__ as the metric name at the PromQL boundary
A table whose own schema carries a column spelled __name__ cannot be
interpreted as PromQL input: the semantic metric name is the table's
identity, so a second, ordinary business column of that name would be
ambiguous. setup_context() now refuses such tables with
ReservedMetricNameColumn (InvalidArguments) at the single selector entry,
before any context is filled; legitimately rewritten names from
label_join/label_replace/count_values are produced above the selector and
never pass through it.

With the reserved-name contract, an unmarked physical __name__ column can
no longer reach the Prometheus HTTP serializer, so the exported_name
auto-rename branch in ColumnLayout::infer is removed and tag names are
emitted verbatim.

Also narrow column_reference_is_constant to an explicit whitelist of
value-preserving plan nodes instead of any single-input passthrough, so a
future extension cannot silently waive the dropped-name uniqueness check.

Tests that constructed a physical __name__ tag as legal input now assert
the entry refusal; the internal __promql_metric_name collision tests are
unaffected.

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-10-12 11:14:05 +08:00
..