From 954bcbc1a3eeabb696e7dc10721b85e1f475ecfd Mon Sep 17 00:00:00 2001 From: anshuldata Date: Mon, 7 Oct 2024 09:10:46 +0530 Subject: [PATCH] feat: enhance VirtualTable to have expression as value (#711) * This enables expressing Virtual table having values as expression * Example query: `select * from (values (1+2, 'Hello'||'World'))` * Mark existing literal field "values" as deprecated --- proto/substrait/algebra.proto | 5 +++-- site/docs/relations/logical_relations.md | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/proto/substrait/algebra.proto b/proto/substrait/algebra.proto index c5795fd68..6c68f19dd 100644 --- a/proto/substrait/algebra.proto +++ b/proto/substrait/algebra.proto @@ -86,9 +86,10 @@ message ReadRel { substrait.extensions.AdvancedExtension advanced_extension = 10; } - // A table composed of literals. + // A table composed of expressions. message VirtualTable { - repeated Expression.Literal.Struct values = 1; + repeated Expression.Literal.Struct values = 1 [deprecated = true]; + repeated Expression expressions = 2; } // A stub type that can be used to extend/introduce new table types outside diff --git a/site/docs/relations/logical_relations.md b/site/docs/relations/logical_relations.md index 9e9d1b753..86e68c9e0 100644 --- a/site/docs/relations/logical_relations.md +++ b/site/docs/relations/logical_relations.md @@ -51,12 +51,15 @@ Read definition types (like the rest of the features in Substrait) are built by #### Virtual Table A virtual table is a table whose contents are embedded in the plan itself. The table data -is encoded as records consisting of literal values. +is encoded as records consisting of literal values or expressions that can be resolved without referencing any input data. +For example, a literal, a function call involving literals, or any other expression that does +not require input. | Property | Description | Required | | -------- | ----------- | -------- | | Data | Required | Required | + #### Named Table A named table is a reference to data defined elsewhere. For example, there may be a catalog