[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Order of fields in select statement


I'm trying out Calcite and realized that Calcite does not support aliases
in select statement as well as it should be. Please let me know if I'm
missing something here.

Here is the scenario:

Let's say I have a destination with the following schema: { name: "field0",
type: "INTEGER" } , { name: "field1", type: "VARCHAR" }
and source with schema: { name: "field0", type: "INTEGER" } , { name:
"field1", type: "VARCHAR" }, { name: "field2", type: "BOOL" }

I have the following simple query: "INSERT INTO myDestination SELECT
s.field1 as field1, s.field0 as field0 FROM mySource as s"

Planner validation fails with "Cannot assign to target field 'field0' of
type INTEGER from source field 'field1' of type VARCHAR". It works if I
reverse the order of fields in the select statement. So, it looks like the
order of fields specified in the select statement should match the order of
fields in the output schema even if I use aliases. Is that true ?