I don't think a "select *......." query is guaranteed to maintain order.
A similar scenario : https://issues.apache.org/jira/browse/DRILL-1259 On Tue, Feb 7, 2017 at 8:36 AM, Khurram Faraaz <kfar...@mapr.com> wrote: > Can someone please look at this. Is this a bug ? > > > Thanks, > > Khurram > > ________________________________ > From: Khurram Faraaz <kfar...@mapr.com> > Sent: Monday, February 6, 2017 2:52:25 PM > To: dev@drill.apache.org > Subject: Column ordering is incorrect when ORDER BY is used with LIMIT > clause in query over parquet data > > All, > > > This looks incorrect. > > > Query with order by + limit clause, the ordering of the columns returned > in the query results is NOT the same as the column ordering in the parquet > file. > > > {noformat} > > 0: jdbc:drill:schema=dfs.tmp> SELECT * FROM typeall_l ORDER BY col_int > limit 1; > +----------+----------+-------------+------------+---------- > +-----------------+----------------+-----------+------------ > ------------+----------------+-------------+ > | col_bln | col_chr | col_dt | col_flt | col_int | > col_intrvl_day | col_intrvl_yr | col_tim | col_tmstmp | > col_vrchr1 | col_vrchr2 | > +----------+----------+-------------+------------+---------- > +-----------------+----------------+-----------+------------ > ------------+----------------+-------------+ > | false | MI | 1967-05-01 | 32.901897 | 0 | P12DT20775S > | P196M | 19:50:17 | 2004-10-15 17:49:36.0 | Felecia Gourd | > NLBQMg9 | > +----------+----------+-------------+------------+---------- > +-----------------+----------------+-----------+------------ > ------------+----------------+-------------+ > 1 row selected (0.279 seconds) > > {noformat} > > Without the ORDER BY clause the columns are returned in correct order, > same as the ordering in the parquet file. > > {noformat} > 0: jdbc:drill:schema=dfs.tmp> SELECT * FROM typeall_l limit 1; > +----------+----------+----------------+-------------------- > ------------------------------------------------------------ > -------------------------------------+-------------+-------- > ---+------------------------+------------+----------------+- > ----------------+----------+ > | col_int | col_chr | col_vrchr1 | > col_vrchr2 > | col_dt | col_tim | col_tmstmp | col_flt | > col_intrvl_yr | col_intrvl_day | col_bln | > +----------+----------+----------------+-------------------- > ------------------------------------------------------------ > -------------------------------------+-------------+-------- > ---+------------------------+------------+----------------+- > ----------------+----------+ > | 45436 | WV | John Mcginity | Rhbf6VFLJguvH9ejrWNkY1CDO8Qqum > TZAGjwa9cHfjBnLmNIWvo9YfcGObxbeXwa1NkemW9ULxsq5293wEA2v5FFCduwt03D7ysI3RlH8b4B0XAPKY > | 2011-11-04 | 18:02:26 | 1988-09-23 16:58:42.0 | 10.193293 | P314M > | P26DT27386S | false | > +----------+----------+----------------+-------------------- > ------------------------------------------------------------ > -------------------------------------+-------------+-------- > ---+------------------------+------------+----------------+- > ----------------+----------+ > 1 row selected (0.22 seconds) > > > {noformat} > > > Thanks, > > Khurram >