Description
In the following plan, o_col4 is not needed:
2018-02-11T11:35:14,501 DEBUG [0fda1a20-c7f1-489e-b287-65f35fda9848 main] calcite.sql2rel: Plan after trimming unused fields
HiveProject(download_volume_bytes=[$0], ri_date=[$1], end_cell_id=[$2], environment=[$3])
HiveSortLimit(sort0=[$2], dir0=[ASC-nulls-first], fetch=[100])
HiveProject(download_volume_bytes=[$4], ri_date=[$3], end_cell_id=[$1], environment=[$2], _o__col4=[$0])
HiveAggregate(group=[{0, 1, 2, 3}], agg#0=[sum($4)])
HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f3=[$0], $f4=[$4])
HiveProject(ri_date=[$0], imsi=[$1], end_cell_id=[$2], environment=[$3], s1_u_download_data_volume=[$4])
HiveTableScan(table=[[default.lsr094]], table:alias=[a])
o_col4 should be removed by the FieldTrimmer. Otherwise, this may prevent MV rewriting to be triggered on some queries containing order by/limit clauses.