You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by John Omernik <jo...@omernik.com> on 2016/12/08 15:23:50 UTC

SQL Line Formating

Hey all,

I have a puzzler (I think).

I have a directory with JSON, it's great, it queries well, it's well
formatted.

I created a view on that directory. Added some columns (like a timestamp
version of the EPOCH time field)

When I run a query in SQL Line of the view, I get a well formatted table:

select * from mytable limit 10;

+------------------+---------------------+--------------+-------------------------------------+
|         col1        |          col2          |     col3      |
           col 4                |

Even though the data appears in different sizes, it takes the results and
pads them if it can and makes it look good.

However, when I run select col1, min(col2), count(distinct col3) as
num_col3 from mytable group by col1 order by num_col3 DESC limit 100;

Then all the columns are squished with no padding.

I guess, why does SQL Line output the data from the select * from mytable
limit 100 by sending the result set through something that determine
min/max columns by not for select col1, agg(col2) from mytable group by
col1 order by agg(col2) desc limit 100?

 Also interesting: If I remove the order by, the formatting is much
better... why is this the case?

Thanks