Hi all. In Github Issue #1144 [1], it's requested that alias should be keeped in result set if alias is used in query. And I am fixing this issue.
In query using alias in SELECT clause, alias is replaced by acutal sensor name before printing header of result set. For RawDataQuery and LastQuery, it's in optimizing the logical plan phase. For AlignByDeviceQuery, it's in generating physical plan phase. So it's difficult to keep the alias without a new data structure when printing the header. My plan is creating a flag recording if it's alias or not when replacing it by order. Or we record the alias array directly. Then print the correct header using it. Next the logic of mapping result set need to be changed too. As the final result set has different metadata with the query result set. For example, SQL: SELECT s1, speed from root.sg.d1; then the flag may be [false, true]. The header will be [Time, root.sg.d1.s1, root.sg.d1.speed]. What do you think? Welcome to any opinion. [1] https://github.com/apache/incubator-iotdb/issues/1144 -- Best, Xiangwei Wei