Skip to content

Commit

Permalink
feat: enhance VirtualTable to have expression as value (#711)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
anshuldata authored Oct 7, 2024
1 parent fcfdd10 commit 954bcbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions proto/substrait/algebra.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion site/docs/relations/logical_relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 954bcbc

Please sign in to comment.