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/06/23 17:23:45 UTC

Merging files

When have a small query writing smaller data (like aggregate tables for
faster aggregates for Dashboards etc).  It appears to write a ton of small
files.  Not sure why, maybe its just how the join worked out etc. I have a
"day" that is 1.5M in total size, but 400 files total. This seems
excessive.

While I don't have the "small files" issues because I run MapR-FS, having
400 files that make 1.5 mb of total date kills me on the planning phase.
 How can I get Drill, when doing a CTAS to go through a round of
consolidation on the parquet files?

Thanks

John

Re: Merging files

Posted by Ted Dunning <te...@gmail.com>.
On Thu, Jun 23, 2016 at 10:41 AM, John Omernik <jo...@omernik.com> wrote:

> First of all, I feel like that as a "perhaps knows just enough to be
> dangerous" power/intermediate user, it barely registered that I should, for
> optimal performance, do something about 400 files.  I saw them and almost
> moved on before remembering an issue I've had with this in the past.  Thus,
> even bringing it up, and looking for a way to reduce files almost slipped
> by.
>

There really ought to be a section of the web-site for something like
"Things to Watch For" or "Drill Gotchas" or "Drill Surprises" or "Drill may
not work the way you thought". Maybe even "What you should know about how
Drill isn't what you thought".

I don't know what to call it. I would just hope that people beginning to
get serious or who have a performance issue might be attracted to that
section.

If somebody can suggest where to put content like this, I would be happy to
contribute some text on a few cases.

Re: Merging files

Posted by John Omernik <jo...@omernik.com>.
This worked perfectly. Thanks Jason.  (It also made my small 1.5m per day
table into 600K per day... so double win)

So, I like this approach and will use it. It makes sense how it works, but
obviously this is something I had to come to the Drill User group for, and
you, being an expert on Drill internals had a solid answer.  Turn around
time on this was awesome, so, thus, when I am looking to "improve" on your
answer, please note that I appreciate your fast response, and am not trying
to take away from.

First of all, I feel like that as a "perhaps knows just enough to be
dangerous" power/intermediate user, it barely registered that I should, for
optimal performance, do something about 400 files.  I saw them and almost
moved on before remembering an issue I've had with this in the past.  Thus,
even bringing it up, and looking for a way to reduce files almost slipped
by.

Second, the issue of many files isn't just an issue for performance on
planning like in my case, it's a very serious issues for folks running HDFS
clusters. Perhaps a call out in documentation would be handy here in the
CTAS page. Identifying how files are created, and that if you want to
reduce, a simple hack could be to run it through and ORDER BY.  This could
be beneficial for HDFS users, normal users, and the drill project, because
people using the docs will do that, realizing better performance.

Third: Could we/should be provide an sys.options flag that defaults to
false (for backwards compatibility and no surprises) that when set to try
in a query "mimics" the effect of a Order by?  store.parquet.merge.files
 or something like to ask the process to go through a single stream if
possible at the end regardless of order by? While this may not add
performance, it would be a handy way to document this. (Perhaps not single
stream? Perhaps we could say if > 0 (0 being the default, thus not adding a
merging step) it would add a step to merge the data into N streams based on
the value. (so in my case, I could set it 1, but others may have needs to
set it higher).

I'd be curious on the thoughts here.


John


On Thu, Jun 23, 2016 at 12:26 PM, Jason Altekruse <ja...@dremio.com> wrote:

> Apply a sort in your CTAS, this will force the data down to a single stream
> before writing.
>
> Jason Altekruse
> Software Engineer at Dremio
> Apache Drill Committer
>
> On Thu, Jun 23, 2016 at 10:23 AM, John Omernik <jo...@omernik.com> wrote:
>
> > When have a small query writing smaller data (like aggregate tables for
> > faster aggregates for Dashboards etc).  It appears to write a ton of
> small
> > files.  Not sure why, maybe its just how the join worked out etc. I have
> a
> > "day" that is 1.5M in total size, but 400 files total. This seems
> > excessive.
> >
> > While I don't have the "small files" issues because I run MapR-FS, having
> > 400 files that make 1.5 mb of total date kills me on the planning phase.
> >  How can I get Drill, when doing a CTAS to go through a round of
> > consolidation on the parquet files?
> >
> > Thanks
> >
> > John
> >
>

Re: Merging files

Posted by John Omernik <jo...@omernik.com>.
Ah, yes, I am not using the Partition by, I am using directory partitions
because I have ongoing days to load (and inter day loads)

Thanks


On Fri, Jun 24, 2016 at 12:57 AM, Jinfeng Ni <ji...@gmail.com> wrote:

> This hash_distribute option should only matter when you have CTAS
> "partition by".  If you do not do partition in CTAS,  there should be
> no impact at all (in theory). Essentially, this option is to
> re-distribute the data according to the partition key, before Drill
> writes to target tables.  See DRILL-3381 [1].
>
>
> [1] https://issues.apache.org/jira/browse/DRILL-3381
>
>
> On Thu, Jun 23, 2016 at 11:59 AM, John Omernik <jo...@omernik.com> wrote:
> > It's basically a two level grouping that has a LEFT JOIN
> >
> > so
> >
> > select a.field1, a.field2, sum(b.somefield) as new_thing
> > from table1 a LEFT JOIN table2 b on a.id = b.id
> > where a.field1 = '2015-05-05'
> > group by a.field1, b.field2
> >
> > It's not a very complicated query, but it doesn't like the
> hash_distribute
> > :)
> >
> > On Thu, Jun 23, 2016 at 1:46 PM, Jinfeng Ni <ji...@gmail.com>
> wrote:
> >
> >> I looked at the code. 1. Drill did log this long CanNotPlan msg in
> >> error level. 2) It was replaced with a much shorter version msg only
> >> when CanNotPlan was caused by cartesian join.
> >>
> >> I guess your query probably did not have cartesian join, and
> >> CanNotPlan was caused by other reasons. Either way, I think Drill
> >> should not display such verbose error msg (which is essentially the
> >> planner internal state).
> >>
> >> I actually do not need the error message. The query itself would be
> >> good enough in many cases. If the query has sensitive information in
> >> column names, you can replace sensitive column names with arbitrary
> >> names and still would hit the same issue, if your data is from
> >> schema-on-read source (parquet / csv etc).  Drill's planner does not
> >> have schema infor; changing column name across the query would not
> >> impact planner's behavior.
> >>
> >> btw: the long error change was part of DRILL-2958 [1]
> >>
> >>
> >> [1] https://issues.apache.org/jira/browse/DRILL-2958
> >>
> >>
> >>
> >> On Thu, Jun 23, 2016 at 11:13 AM, John Omernik <jo...@omernik.com>
> wrote:
> >> > Unfortunatly, the 14 mb error message contains to much proprietary
> >> > information for me to post to a Jira, the query itself may also be a
> bit
> >> to
> >> > revealing.This is Drill 1.6, so maybe the issue isn't fixed in my
> >> version?
> >> > do you know the original JIRA for the really long error?
> >> >
> >> > On Thu, Jun 23, 2016 at 12:56 PM, Jinfeng Ni <ji...@gmail.com>
> >> wrote:
> >> >
> >> >> This "CannotPlanException" definitely is a bug in query planner. I
> >> >> thought we had put code to show that extremely long error msg "only"
> >> >> in debug mode. Looks like it's not that case.
> >> >>
> >> >> Could you please open a JIRA and post your query, if possible? thx.
> >> >>
> >> >> On Thu, Jun 23, 2016 at 10:45 AM, John Omernik <jo...@omernik.com>
> >> wrote:
> >> >> > Jinfeng -
> >> >> >
> >> >> > I wrote my item prior to reading yours. Just an FYI, when I ran
> with
> >> that
> >> >> > settting, I got a "CannotPlanException" (with an error that is
> easily
> >> the
> >> >> > longest "non-verbose"( heck this beats all the verbose errors I've
> >> had)
> >> >> > I've ever seen. I'd post it here, but I am not unsure if my Google
> has
> >> >> > enough storage to handle this message....
> >> >> >
> >> >> > (kidding... sorta)
> >> >> >
> >> >> > John
> >> >> >
> >> >> >
> >> >> >
> >> >> > On Thu, Jun 23, 2016 at 12:37 PM, Jinfeng Ni <
> jinfengni99@gmail.com>
> >> >> wrote:
> >> >> >
> >> >> >> Do you partition by day in your CTAS? If that's the case, CTAS
> will
> >> >> >> produce at least one parquet file for each value of "day".  If you
> >> >> >> have 100 days, then you will end up at least 100 files. However,
> in
> >> >> >> case the query is executed in distributed mode, there could be
> more
> >> >> >> than one file per value.
> >> >> >>
> >> >> >> In order to get one and only one parquet file for each partition
> >> >> >> value, turn on this option:
> >> >> >>
> >> >> >> alter session set `store.partition.hash_distribute` = true;
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> On Thu, Jun 23, 2016 at 10:26 AM, Jason Altekruse <
> jason@dremio.com>
> >> >> >> wrote:
> >> >> >> > Apply a sort in your CTAS, this will force the data down to a
> >> single
> >> >> >> stream
> >> >> >> > before writing.
> >> >> >> >
> >> >> >> > Jason Altekruse
> >> >> >> > Software Engineer at Dremio
> >> >> >> > Apache Drill Committer
> >> >> >> >
> >> >> >> > On Thu, Jun 23, 2016 at 10:23 AM, John Omernik <
> john@omernik.com>
> >> >> wrote:
> >> >> >> >
> >> >> >> >> When have a small query writing smaller data (like aggregate
> >> tables
> >> >> for
> >> >> >> >> faster aggregates for Dashboards etc).  It appears to write a
> ton
> >> of
> >> >> >> small
> >> >> >> >> files.  Not sure why, maybe its just how the join worked out
> etc.
> >> I
> >> >> >> have a
> >> >> >> >> "day" that is 1.5M in total size, but 400 files total. This
> seems
> >> >> >> >> excessive.
> >> >> >> >>
> >> >> >> >> While I don't have the "small files" issues because I run
> MapR-FS,
> >> >> >> having
> >> >> >> >> 400 files that make 1.5 mb of total date kills me on the
> planning
> >> >> phase.
> >> >> >> >>  How can I get Drill, when doing a CTAS to go through a round
> of
> >> >> >> >> consolidation on the parquet files?
> >> >> >> >>
> >> >> >> >> Thanks
> >> >> >> >>
> >> >> >> >> John
> >> >> >> >>
> >> >> >>
> >> >>
> >>
>

Re: Merging files

Posted by Jinfeng Ni <ji...@gmail.com>.
This hash_distribute option should only matter when you have CTAS
"partition by".  If you do not do partition in CTAS,  there should be
no impact at all (in theory). Essentially, this option is to
re-distribute the data according to the partition key, before Drill
writes to target tables.  See DRILL-3381 [1].


[1] https://issues.apache.org/jira/browse/DRILL-3381


On Thu, Jun 23, 2016 at 11:59 AM, John Omernik <jo...@omernik.com> wrote:
> It's basically a two level grouping that has a LEFT JOIN
>
> so
>
> select a.field1, a.field2, sum(b.somefield) as new_thing
> from table1 a LEFT JOIN table2 b on a.id = b.id
> where a.field1 = '2015-05-05'
> group by a.field1, b.field2
>
> It's not a very complicated query, but it doesn't like the hash_distribute
> :)
>
> On Thu, Jun 23, 2016 at 1:46 PM, Jinfeng Ni <ji...@gmail.com> wrote:
>
>> I looked at the code. 1. Drill did log this long CanNotPlan msg in
>> error level. 2) It was replaced with a much shorter version msg only
>> when CanNotPlan was caused by cartesian join.
>>
>> I guess your query probably did not have cartesian join, and
>> CanNotPlan was caused by other reasons. Either way, I think Drill
>> should not display such verbose error msg (which is essentially the
>> planner internal state).
>>
>> I actually do not need the error message. The query itself would be
>> good enough in many cases. If the query has sensitive information in
>> column names, you can replace sensitive column names with arbitrary
>> names and still would hit the same issue, if your data is from
>> schema-on-read source (parquet / csv etc).  Drill's planner does not
>> have schema infor; changing column name across the query would not
>> impact planner's behavior.
>>
>> btw: the long error change was part of DRILL-2958 [1]
>>
>>
>> [1] https://issues.apache.org/jira/browse/DRILL-2958
>>
>>
>>
>> On Thu, Jun 23, 2016 at 11:13 AM, John Omernik <jo...@omernik.com> wrote:
>> > Unfortunatly, the 14 mb error message contains to much proprietary
>> > information for me to post to a Jira, the query itself may also be a bit
>> to
>> > revealing.This is Drill 1.6, so maybe the issue isn't fixed in my
>> version?
>> > do you know the original JIRA for the really long error?
>> >
>> > On Thu, Jun 23, 2016 at 12:56 PM, Jinfeng Ni <ji...@gmail.com>
>> wrote:
>> >
>> >> This "CannotPlanException" definitely is a bug in query planner. I
>> >> thought we had put code to show that extremely long error msg "only"
>> >> in debug mode. Looks like it's not that case.
>> >>
>> >> Could you please open a JIRA and post your query, if possible? thx.
>> >>
>> >> On Thu, Jun 23, 2016 at 10:45 AM, John Omernik <jo...@omernik.com>
>> wrote:
>> >> > Jinfeng -
>> >> >
>> >> > I wrote my item prior to reading yours. Just an FYI, when I ran with
>> that
>> >> > settting, I got a "CannotPlanException" (with an error that is easily
>> the
>> >> > longest "non-verbose"( heck this beats all the verbose errors I've
>> had)
>> >> > I've ever seen. I'd post it here, but I am not unsure if my Google has
>> >> > enough storage to handle this message....
>> >> >
>> >> > (kidding... sorta)
>> >> >
>> >> > John
>> >> >
>> >> >
>> >> >
>> >> > On Thu, Jun 23, 2016 at 12:37 PM, Jinfeng Ni <ji...@gmail.com>
>> >> wrote:
>> >> >
>> >> >> Do you partition by day in your CTAS? If that's the case, CTAS will
>> >> >> produce at least one parquet file for each value of "day".  If you
>> >> >> have 100 days, then you will end up at least 100 files. However, in
>> >> >> case the query is executed in distributed mode, there could be more
>> >> >> than one file per value.
>> >> >>
>> >> >> In order to get one and only one parquet file for each partition
>> >> >> value, turn on this option:
>> >> >>
>> >> >> alter session set `store.partition.hash_distribute` = true;
>> >> >>
>> >> >>
>> >> >>
>> >> >> On Thu, Jun 23, 2016 at 10:26 AM, Jason Altekruse <ja...@dremio.com>
>> >> >> wrote:
>> >> >> > Apply a sort in your CTAS, this will force the data down to a
>> single
>> >> >> stream
>> >> >> > before writing.
>> >> >> >
>> >> >> > Jason Altekruse
>> >> >> > Software Engineer at Dremio
>> >> >> > Apache Drill Committer
>> >> >> >
>> >> >> > On Thu, Jun 23, 2016 at 10:23 AM, John Omernik <jo...@omernik.com>
>> >> wrote:
>> >> >> >
>> >> >> >> When have a small query writing smaller data (like aggregate
>> tables
>> >> for
>> >> >> >> faster aggregates for Dashboards etc).  It appears to write a ton
>> of
>> >> >> small
>> >> >> >> files.  Not sure why, maybe its just how the join worked out etc.
>> I
>> >> >> have a
>> >> >> >> "day" that is 1.5M in total size, but 400 files total. This seems
>> >> >> >> excessive.
>> >> >> >>
>> >> >> >> While I don't have the "small files" issues because I run MapR-FS,
>> >> >> having
>> >> >> >> 400 files that make 1.5 mb of total date kills me on the planning
>> >> phase.
>> >> >> >>  How can I get Drill, when doing a CTAS to go through a round of
>> >> >> >> consolidation on the parquet files?
>> >> >> >>
>> >> >> >> Thanks
>> >> >> >>
>> >> >> >> John
>> >> >> >>
>> >> >>
>> >>
>>

Re: Merging files

Posted by John Omernik <jo...@omernik.com>.
It's basically a two level grouping that has a LEFT JOIN

so

select a.field1, a.field2, sum(b.somefield) as new_thing
from table1 a LEFT JOIN table2 b on a.id = b.id
where a.field1 = '2015-05-05'
group by a.field1, b.field2

It's not a very complicated query, but it doesn't like the hash_distribute
:)

On Thu, Jun 23, 2016 at 1:46 PM, Jinfeng Ni <ji...@gmail.com> wrote:

> I looked at the code. 1. Drill did log this long CanNotPlan msg in
> error level. 2) It was replaced with a much shorter version msg only
> when CanNotPlan was caused by cartesian join.
>
> I guess your query probably did not have cartesian join, and
> CanNotPlan was caused by other reasons. Either way, I think Drill
> should not display such verbose error msg (which is essentially the
> planner internal state).
>
> I actually do not need the error message. The query itself would be
> good enough in many cases. If the query has sensitive information in
> column names, you can replace sensitive column names with arbitrary
> names and still would hit the same issue, if your data is from
> schema-on-read source (parquet / csv etc).  Drill's planner does not
> have schema infor; changing column name across the query would not
> impact planner's behavior.
>
> btw: the long error change was part of DRILL-2958 [1]
>
>
> [1] https://issues.apache.org/jira/browse/DRILL-2958
>
>
>
> On Thu, Jun 23, 2016 at 11:13 AM, John Omernik <jo...@omernik.com> wrote:
> > Unfortunatly, the 14 mb error message contains to much proprietary
> > information for me to post to a Jira, the query itself may also be a bit
> to
> > revealing.This is Drill 1.6, so maybe the issue isn't fixed in my
> version?
> > do you know the original JIRA for the really long error?
> >
> > On Thu, Jun 23, 2016 at 12:56 PM, Jinfeng Ni <ji...@gmail.com>
> wrote:
> >
> >> This "CannotPlanException" definitely is a bug in query planner. I
> >> thought we had put code to show that extremely long error msg "only"
> >> in debug mode. Looks like it's not that case.
> >>
> >> Could you please open a JIRA and post your query, if possible? thx.
> >>
> >> On Thu, Jun 23, 2016 at 10:45 AM, John Omernik <jo...@omernik.com>
> wrote:
> >> > Jinfeng -
> >> >
> >> > I wrote my item prior to reading yours. Just an FYI, when I ran with
> that
> >> > settting, I got a "CannotPlanException" (with an error that is easily
> the
> >> > longest "non-verbose"( heck this beats all the verbose errors I've
> had)
> >> > I've ever seen. I'd post it here, but I am not unsure if my Google has
> >> > enough storage to handle this message....
> >> >
> >> > (kidding... sorta)
> >> >
> >> > John
> >> >
> >> >
> >> >
> >> > On Thu, Jun 23, 2016 at 12:37 PM, Jinfeng Ni <ji...@gmail.com>
> >> wrote:
> >> >
> >> >> Do you partition by day in your CTAS? If that's the case, CTAS will
> >> >> produce at least one parquet file for each value of "day".  If you
> >> >> have 100 days, then you will end up at least 100 files. However, in
> >> >> case the query is executed in distributed mode, there could be more
> >> >> than one file per value.
> >> >>
> >> >> In order to get one and only one parquet file for each partition
> >> >> value, turn on this option:
> >> >>
> >> >> alter session set `store.partition.hash_distribute` = true;
> >> >>
> >> >>
> >> >>
> >> >> On Thu, Jun 23, 2016 at 10:26 AM, Jason Altekruse <ja...@dremio.com>
> >> >> wrote:
> >> >> > Apply a sort in your CTAS, this will force the data down to a
> single
> >> >> stream
> >> >> > before writing.
> >> >> >
> >> >> > Jason Altekruse
> >> >> > Software Engineer at Dremio
> >> >> > Apache Drill Committer
> >> >> >
> >> >> > On Thu, Jun 23, 2016 at 10:23 AM, John Omernik <jo...@omernik.com>
> >> wrote:
> >> >> >
> >> >> >> When have a small query writing smaller data (like aggregate
> tables
> >> for
> >> >> >> faster aggregates for Dashboards etc).  It appears to write a ton
> of
> >> >> small
> >> >> >> files.  Not sure why, maybe its just how the join worked out etc.
> I
> >> >> have a
> >> >> >> "day" that is 1.5M in total size, but 400 files total. This seems
> >> >> >> excessive.
> >> >> >>
> >> >> >> While I don't have the "small files" issues because I run MapR-FS,
> >> >> having
> >> >> >> 400 files that make 1.5 mb of total date kills me on the planning
> >> phase.
> >> >> >>  How can I get Drill, when doing a CTAS to go through a round of
> >> >> >> consolidation on the parquet files?
> >> >> >>
> >> >> >> Thanks
> >> >> >>
> >> >> >> John
> >> >> >>
> >> >>
> >>
>

Re: Merging files

Posted by Jinfeng Ni <ji...@gmail.com>.
I looked at the code. 1. Drill did log this long CanNotPlan msg in
error level. 2) It was replaced with a much shorter version msg only
when CanNotPlan was caused by cartesian join.

I guess your query probably did not have cartesian join, and
CanNotPlan was caused by other reasons. Either way, I think Drill
should not display such verbose error msg (which is essentially the
planner internal state).

I actually do not need the error message. The query itself would be
good enough in many cases. If the query has sensitive information in
column names, you can replace sensitive column names with arbitrary
names and still would hit the same issue, if your data is from
schema-on-read source (parquet / csv etc).  Drill's planner does not
have schema infor; changing column name across the query would not
impact planner's behavior.

btw: the long error change was part of DRILL-2958 [1]


[1] https://issues.apache.org/jira/browse/DRILL-2958



On Thu, Jun 23, 2016 at 11:13 AM, John Omernik <jo...@omernik.com> wrote:
> Unfortunatly, the 14 mb error message contains to much proprietary
> information for me to post to a Jira, the query itself may also be a bit to
> revealing.This is Drill 1.6, so maybe the issue isn't fixed in my version?
> do you know the original JIRA for the really long error?
>
> On Thu, Jun 23, 2016 at 12:56 PM, Jinfeng Ni <ji...@gmail.com> wrote:
>
>> This "CannotPlanException" definitely is a bug in query planner. I
>> thought we had put code to show that extremely long error msg "only"
>> in debug mode. Looks like it's not that case.
>>
>> Could you please open a JIRA and post your query, if possible? thx.
>>
>> On Thu, Jun 23, 2016 at 10:45 AM, John Omernik <jo...@omernik.com> wrote:
>> > Jinfeng -
>> >
>> > I wrote my item prior to reading yours. Just an FYI, when I ran with that
>> > settting, I got a "CannotPlanException" (with an error that is easily the
>> > longest "non-verbose"( heck this beats all the verbose errors I've had)
>> > I've ever seen. I'd post it here, but I am not unsure if my Google has
>> > enough storage to handle this message....
>> >
>> > (kidding... sorta)
>> >
>> > John
>> >
>> >
>> >
>> > On Thu, Jun 23, 2016 at 12:37 PM, Jinfeng Ni <ji...@gmail.com>
>> wrote:
>> >
>> >> Do you partition by day in your CTAS? If that's the case, CTAS will
>> >> produce at least one parquet file for each value of "day".  If you
>> >> have 100 days, then you will end up at least 100 files. However, in
>> >> case the query is executed in distributed mode, there could be more
>> >> than one file per value.
>> >>
>> >> In order to get one and only one parquet file for each partition
>> >> value, turn on this option:
>> >>
>> >> alter session set `store.partition.hash_distribute` = true;
>> >>
>> >>
>> >>
>> >> On Thu, Jun 23, 2016 at 10:26 AM, Jason Altekruse <ja...@dremio.com>
>> >> wrote:
>> >> > Apply a sort in your CTAS, this will force the data down to a single
>> >> stream
>> >> > before writing.
>> >> >
>> >> > Jason Altekruse
>> >> > Software Engineer at Dremio
>> >> > Apache Drill Committer
>> >> >
>> >> > On Thu, Jun 23, 2016 at 10:23 AM, John Omernik <jo...@omernik.com>
>> wrote:
>> >> >
>> >> >> When have a small query writing smaller data (like aggregate tables
>> for
>> >> >> faster aggregates for Dashboards etc).  It appears to write a ton of
>> >> small
>> >> >> files.  Not sure why, maybe its just how the join worked out etc. I
>> >> have a
>> >> >> "day" that is 1.5M in total size, but 400 files total. This seems
>> >> >> excessive.
>> >> >>
>> >> >> While I don't have the "small files" issues because I run MapR-FS,
>> >> having
>> >> >> 400 files that make 1.5 mb of total date kills me on the planning
>> phase.
>> >> >>  How can I get Drill, when doing a CTAS to go through a round of
>> >> >> consolidation on the parquet files?
>> >> >>
>> >> >> Thanks
>> >> >>
>> >> >> John
>> >> >>
>> >>
>>

Re: Merging files

Posted by John Omernik <jo...@omernik.com>.
Unfortunatly, the 14 mb error message contains to much proprietary
information for me to post to a Jira, the query itself may also be a bit to
revealing.This is Drill 1.6, so maybe the issue isn't fixed in my version?
do you know the original JIRA for the really long error?

On Thu, Jun 23, 2016 at 12:56 PM, Jinfeng Ni <ji...@gmail.com> wrote:

> This "CannotPlanException" definitely is a bug in query planner. I
> thought we had put code to show that extremely long error msg "only"
> in debug mode. Looks like it's not that case.
>
> Could you please open a JIRA and post your query, if possible? thx.
>
> On Thu, Jun 23, 2016 at 10:45 AM, John Omernik <jo...@omernik.com> wrote:
> > Jinfeng -
> >
> > I wrote my item prior to reading yours. Just an FYI, when I ran with that
> > settting, I got a "CannotPlanException" (with an error that is easily the
> > longest "non-verbose"( heck this beats all the verbose errors I've had)
> > I've ever seen. I'd post it here, but I am not unsure if my Google has
> > enough storage to handle this message....
> >
> > (kidding... sorta)
> >
> > John
> >
> >
> >
> > On Thu, Jun 23, 2016 at 12:37 PM, Jinfeng Ni <ji...@gmail.com>
> wrote:
> >
> >> Do you partition by day in your CTAS? If that's the case, CTAS will
> >> produce at least one parquet file for each value of "day".  If you
> >> have 100 days, then you will end up at least 100 files. However, in
> >> case the query is executed in distributed mode, there could be more
> >> than one file per value.
> >>
> >> In order to get one and only one parquet file for each partition
> >> value, turn on this option:
> >>
> >> alter session set `store.partition.hash_distribute` = true;
> >>
> >>
> >>
> >> On Thu, Jun 23, 2016 at 10:26 AM, Jason Altekruse <ja...@dremio.com>
> >> wrote:
> >> > Apply a sort in your CTAS, this will force the data down to a single
> >> stream
> >> > before writing.
> >> >
> >> > Jason Altekruse
> >> > Software Engineer at Dremio
> >> > Apache Drill Committer
> >> >
> >> > On Thu, Jun 23, 2016 at 10:23 AM, John Omernik <jo...@omernik.com>
> wrote:
> >> >
> >> >> When have a small query writing smaller data (like aggregate tables
> for
> >> >> faster aggregates for Dashboards etc).  It appears to write a ton of
> >> small
> >> >> files.  Not sure why, maybe its just how the join worked out etc. I
> >> have a
> >> >> "day" that is 1.5M in total size, but 400 files total. This seems
> >> >> excessive.
> >> >>
> >> >> While I don't have the "small files" issues because I run MapR-FS,
> >> having
> >> >> 400 files that make 1.5 mb of total date kills me on the planning
> phase.
> >> >>  How can I get Drill, when doing a CTAS to go through a round of
> >> >> consolidation on the parquet files?
> >> >>
> >> >> Thanks
> >> >>
> >> >> John
> >> >>
> >>
>

Re: Merging files

Posted by Jinfeng Ni <ji...@gmail.com>.
This "CannotPlanException" definitely is a bug in query planner. I
thought we had put code to show that extremely long error msg "only"
in debug mode. Looks like it's not that case.

Could you please open a JIRA and post your query, if possible? thx.

On Thu, Jun 23, 2016 at 10:45 AM, John Omernik <jo...@omernik.com> wrote:
> Jinfeng -
>
> I wrote my item prior to reading yours. Just an FYI, when I ran with that
> settting, I got a "CannotPlanException" (with an error that is easily the
> longest "non-verbose"( heck this beats all the verbose errors I've had)
> I've ever seen. I'd post it here, but I am not unsure if my Google has
> enough storage to handle this message....
>
> (kidding... sorta)
>
> John
>
>
>
> On Thu, Jun 23, 2016 at 12:37 PM, Jinfeng Ni <ji...@gmail.com> wrote:
>
>> Do you partition by day in your CTAS? If that's the case, CTAS will
>> produce at least one parquet file for each value of "day".  If you
>> have 100 days, then you will end up at least 100 files. However, in
>> case the query is executed in distributed mode, there could be more
>> than one file per value.
>>
>> In order to get one and only one parquet file for each partition
>> value, turn on this option:
>>
>> alter session set `store.partition.hash_distribute` = true;
>>
>>
>>
>> On Thu, Jun 23, 2016 at 10:26 AM, Jason Altekruse <ja...@dremio.com>
>> wrote:
>> > Apply a sort in your CTAS, this will force the data down to a single
>> stream
>> > before writing.
>> >
>> > Jason Altekruse
>> > Software Engineer at Dremio
>> > Apache Drill Committer
>> >
>> > On Thu, Jun 23, 2016 at 10:23 AM, John Omernik <jo...@omernik.com> wrote:
>> >
>> >> When have a small query writing smaller data (like aggregate tables for
>> >> faster aggregates for Dashboards etc).  It appears to write a ton of
>> small
>> >> files.  Not sure why, maybe its just how the join worked out etc. I
>> have a
>> >> "day" that is 1.5M in total size, but 400 files total. This seems
>> >> excessive.
>> >>
>> >> While I don't have the "small files" issues because I run MapR-FS,
>> having
>> >> 400 files that make 1.5 mb of total date kills me on the planning phase.
>> >>  How can I get Drill, when doing a CTAS to go through a round of
>> >> consolidation on the parquet files?
>> >>
>> >> Thanks
>> >>
>> >> John
>> >>
>>

Re: Merging files

Posted by John Omernik <jo...@omernik.com>.
Jinfeng -

I wrote my item prior to reading yours. Just an FYI, when I ran with that
settting, I got a "CannotPlanException" (with an error that is easily the
longest "non-verbose"( heck this beats all the verbose errors I've had)
I've ever seen. I'd post it here, but I am not unsure if my Google has
enough storage to handle this message....

(kidding... sorta)

John



On Thu, Jun 23, 2016 at 12:37 PM, Jinfeng Ni <ji...@gmail.com> wrote:

> Do you partition by day in your CTAS? If that's the case, CTAS will
> produce at least one parquet file for each value of "day".  If you
> have 100 days, then you will end up at least 100 files. However, in
> case the query is executed in distributed mode, there could be more
> than one file per value.
>
> In order to get one and only one parquet file for each partition
> value, turn on this option:
>
> alter session set `store.partition.hash_distribute` = true;
>
>
>
> On Thu, Jun 23, 2016 at 10:26 AM, Jason Altekruse <ja...@dremio.com>
> wrote:
> > Apply a sort in your CTAS, this will force the data down to a single
> stream
> > before writing.
> >
> > Jason Altekruse
> > Software Engineer at Dremio
> > Apache Drill Committer
> >
> > On Thu, Jun 23, 2016 at 10:23 AM, John Omernik <jo...@omernik.com> wrote:
> >
> >> When have a small query writing smaller data (like aggregate tables for
> >> faster aggregates for Dashboards etc).  It appears to write a ton of
> small
> >> files.  Not sure why, maybe its just how the join worked out etc. I
> have a
> >> "day" that is 1.5M in total size, but 400 files total. This seems
> >> excessive.
> >>
> >> While I don't have the "small files" issues because I run MapR-FS,
> having
> >> 400 files that make 1.5 mb of total date kills me on the planning phase.
> >>  How can I get Drill, when doing a CTAS to go through a round of
> >> consolidation on the parquet files?
> >>
> >> Thanks
> >>
> >> John
> >>
>

Re: Merging files

Posted by Jinfeng Ni <ji...@gmail.com>.
Do you partition by day in your CTAS? If that's the case, CTAS will
produce at least one parquet file for each value of "day".  If you
have 100 days, then you will end up at least 100 files. However, in
case the query is executed in distributed mode, there could be more
than one file per value.

In order to get one and only one parquet file for each partition
value, turn on this option:

alter session set `store.partition.hash_distribute` = true;



On Thu, Jun 23, 2016 at 10:26 AM, Jason Altekruse <ja...@dremio.com> wrote:
> Apply a sort in your CTAS, this will force the data down to a single stream
> before writing.
>
> Jason Altekruse
> Software Engineer at Dremio
> Apache Drill Committer
>
> On Thu, Jun 23, 2016 at 10:23 AM, John Omernik <jo...@omernik.com> wrote:
>
>> When have a small query writing smaller data (like aggregate tables for
>> faster aggregates for Dashboards etc).  It appears to write a ton of small
>> files.  Not sure why, maybe its just how the join worked out etc. I have a
>> "day" that is 1.5M in total size, but 400 files total. This seems
>> excessive.
>>
>> While I don't have the "small files" issues because I run MapR-FS, having
>> 400 files that make 1.5 mb of total date kills me on the planning phase.
>>  How can I get Drill, when doing a CTAS to go through a round of
>> consolidation on the parquet files?
>>
>> Thanks
>>
>> John
>>

Re: Merging files

Posted by Jason Altekruse <ja...@dremio.com>.
Apply a sort in your CTAS, this will force the data down to a single stream
before writing.

Jason Altekruse
Software Engineer at Dremio
Apache Drill Committer

On Thu, Jun 23, 2016 at 10:23 AM, John Omernik <jo...@omernik.com> wrote:

> When have a small query writing smaller data (like aggregate tables for
> faster aggregates for Dashboards etc).  It appears to write a ton of small
> files.  Not sure why, maybe its just how the join worked out etc. I have a
> "day" that is 1.5M in total size, but 400 files total. This seems
> excessive.
>
> While I don't have the "small files" issues because I run MapR-FS, having
> 400 files that make 1.5 mb of total date kills me on the planning phase.
>  How can I get Drill, when doing a CTAS to go through a round of
> consolidation on the parquet files?
>
> Thanks
>
> John
>