From 4cf8108e0746bbe6d6cf5ea95a6a5276580e0dde Mon Sep 17 00:00:00 2001 From: Arttu Date: Wed, 3 Jul 2024 19:50:15 +0200 Subject: [PATCH] feat: allow naming/aliasing relations (#649) Same goal as in #648 - to support what Spark's and DataFusion's SubqueryAlias relation does. As Substrait mostly only referes to columns by their index, there is no inherent need for table name/qualifiers within Substrait. However, some consumers, e.g. DataFusion, require column names to be either unique or qualified for joins, which is troublesome w/o the possibility to qualify relations. Also, for debugging failed plans and for roundtrip testing of X -> Substrait -> X conversions, it would be convenient to have proper, human-readable names to refer to. Closes #571 --- proto/substrait/algebra.proto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proto/substrait/algebra.proto b/proto/substrait/algebra.proto index ae9725b0a..355e4322e 100644 --- a/proto/substrait/algebra.proto +++ b/proto/substrait/algebra.proto @@ -37,6 +37,11 @@ message RelCommon { message Hint { Stats stats = 1; RuntimeConstraint constraint = 2; + + // Name (alias) for this relation. Can be used for e.g. qualifying the relation (see e.g. + // Spark's SubqueryAlias), or debugging. + string alias = 3; + substrait.extensions.AdvancedExtension advanced_extension = 10; // The statistics related to a hint (physical properties of records)