I notice that if I create inline values using:
RelBuilder.values(Iterable<? extends List<RexLiteral>> tupleList, RelDataType
rowType)
I lose the field names that I put in the RelDataType, and the fields are named
"EXPR$0”, “EXPR$1”, ...
This is also seen if I create a Rel from the SQL string "SELECT X.A FROM
(VALUES 1) AS X(A)” via Planner.parse, Planner.validate, then Planner.rel,
whose JSON representation winds up looking like:
{
"rels": [
{
"id": "0",
"relOp": "LogicalValues",
"type": [
{
"type": "INTEGER",
"nullable": false,
"name": "EXPR$0"
}
],
"tuples": [
[
1
]
],
"inputs": []
},
{
"id": "1",
"relOp": "LogicalProject"
}
]
}
However, in sqlline, I can perform the same query:
0: jdbc:calcite:model=inline:{"version":1.0,"> SELECT X.A FROM (VALUES 1) AS
X(A);
+------------+
| A |
+------------+
| 1 |
+------------+
1 row selected (0.02 seconds)
and the column name “A” is preserved.
Is there some mechanism for retaining the column name when using
RelBuilder.values() other than putting the column name in the RelDataType?