Uwe - I don't want to sound out of left field on this, but I have a
personal philosophy to never use Mongo DB for a data store, especially for
event data.  I love that Mongo is fast and easy for small things, and that
with Drill I can query it; however, I don't want to use Mongo as a system
of record for event data that could grow to be in excess of 2GB per day.
Mongo clustering and growth has bit me too many times in the past for me to
really trust it, and thus, if others use Mongo and want me to read it, I
will happily use the storage plugin there, but not for me to put stuff in.

I am eagerly looking forward to using OJAI from MapR on MapRDB. Similar to
MongoDB in that's a document store, but it's based on MapRDB so it scales
oh so easily AND has snapshots and replication as part of the backing
filesystem. I do believe MapR is looking to do a Drill plugin for this
based on this page:
https://www.mapr.com/developer-preview/mapr-db-document-database

It looks very promising.  Once again, I am not trying to be dismissive, I
like Mongo in certain cases, just not for an event datastore.

On Wed, Nov 4, 2015 at 4:11 PM, Geercken, Uwe <[email protected]>
wrote:

> John,
>
> I maybe naiv question. If parquet is not giving you all the functionality
> and your are doing phyton etl work anyway, why don't you use for example
> mongodb for your data. you avoid the limitations of parquet and have a
> flexible document store which also scales if necessary. it's easy to setup
> and easy to learn. still you can use drill.
>
> rgds,
>
> uwe
> ________________________________________
> From: John Omernik [[email protected]]
> Sent: Wednesday, November 04, 2015 5:18 PM
> To: user
> Subject: Re: Drill ETL: Views are Less than impressive
>
> Because I like sharing stories on list to the end result of becoming
> un-hireable due to me showing when I am missing the obvious answers, I
> share an option I just came up with to address my issues. (Other options
> and discussions would also be welcome!)
>
> Andries E showed that files prefixed with . are ignored... I thought...what
> if it's a directory? Sure enough my testing showed that drill will ignore
> directories that are prefixed by a .   Ok cool... but would drill let me
> load data into a directory prefixed by a dot?
>
> The answer is yes.
>
> So
> CREATE TABLE parquetfinal/.2015-11-04  as select * from jsondir where
> dir0='2015-11-04'
>
> Works great (with the alter session command)
>
> Then when that completes, I have a script to simply issue a mv command
>
> If parquetfinal/2015-11-04 exists then
> mv parquetfinal/2015-11-04 parquetfinal/.tmp_2015-11-04
> mv parquetfinal/.2015-11-04 parquetfinal/2015-11-04
> rm -rf parquetfinal/.tmp_2015-11-04
>
> Mv commands on the same volume are instant so that works for me.
>
> This is a little bit "hacky" but I think it works. Ideally I'd love for the
> create table to be able to do this exact thing for me.  Basically CREATE OR
> REPLACE table where the REPLACE did exactly what I laid out here... loaded
> it to a hidden tmp location (in the same directory but prefixed by a dot),
> if successful, mv rename the directories and call it good, if not
> successful, then leave the original in place.  (Note I did try CREATE or
> REPLACE table and got a "PARSE ERROR: Encountered "TABLE" at line 1, column
> 19" so I will assume this functionality is not in Drill at this time.
> Before I create a JIRA for this, does anyone see why this would not be a
> good way to handle these situations?
>
>
>
>
>
> On Wed, Nov 4, 2015 at 10:00 AM, John Omernik <[email protected]> wrote:
>
> > I am trying to manage ETL of some data.  Many of my questions over the
> > last few days revolve around this data set, so here I am trying to put a
> > manifesto post together. (Manifesto may be too strong of a word, but I
> have
> > a feeling it will be a large post :)
> >
> > So here some points:
> >
> > 1. I am pulling data from an Amazon SQS queue using python and writing
> > files to a MapRFS file location. This is working well, including writing
> > files to filenames prefaced by a . until full loaded so drill ignores
> them.
> > (thanks Andries E for the tip there!)
> >
> > 2. I CAN directly query the JSON  if I issue Alter Session
> set`store.json.all_text_mode`
> > = true.  This is because there are some array fields that use JSON nulls,
> > and I've accepted that I have to read them as strings. (Note my questions
> > on list about setting this in a view rather than for the system (all
> > queries, all users) or for the session (all queries for that user)
> >
> > 3.  My initial idea was to take data for a day, and then load it into a
> > parquet table with directory based partitions.  i.e. I'd take the json
> from
> > a complete day of data
> >
> > ALTER SESSION SET `store.json.all_text_mode` = true;
> > CREATE table `parquetfinal/2015-11-03` as
> > select field1, field2, field3, field4 from `streaminglocation` where dir0
> > = '2015-11-03'
> >
> > This works great, I have all my data for the previous day going back in
> > time in a efficient storage format that does not require my users to set
> > the store.json.all_text_mode setting in order to query it.  Mission
> > accomplished on day -1 and older data.
> >
> > 4. I then needed a way to "join" that data (yesterday and going
> backwards)
> > with the current data.  My initial thought was to use a view to just
> union
> > the parquet table to the json table.  The  json table has the same date
> > format in directories (i.e. dir0 = '2015-11-04')   However, we ran into a
> > snag because I really don't want to have my users run the alter session
> > command.
> >
> > I know this is a small point, but if a user is running a query and gets
> an
> > error, thats a situation where my user either has to know about alter
> > session or they call the helpdesk, or they just give up and say "well
> this
> > isn't ready" and don't use the data.  Not all my users will live in the
> > Drill docs and do so happily.  Yet, I don't want to set that at a system
> > level or even by default at a session level due to unforeseen
> consequences
> > of having that setting set and querying a different data set and getting
> > inconsistent results.   So just joining the two as is wouldn't work.
> >
> > 5. My next ideas was to have a parquet backed incremental load table.
> > Basically it takes around 20 seconds to load the json to parquet. I'd
> > create a temp location outside the final parquet location. Load a whole
> > days worth of data every 10 minutes into a new uniquely named directory
> and
> > update a view.  Then I would create another view that would take the
> > "final" location backed parquet table and UNION ALL it with the
> > "incremental_load" parquet table (that has only one day).  This worked,
> but
> > I am getting no optimizations.  A select count(*) on either of two parts
> of
> > the UNION ALL returns in 0.5 seconds, a select count(*) on
> > the unionized view returns in 20 seconds. That is rough.
> >
> > I thought about having the temp data sit directly in the parquet backed
> > final table, but I don't see a way to create my Parquet files and then
> > replace the partition that exists in the table with the new data. (This
> is
> > something I used to do in hive  with
> > INSERT OVERWRITE TABLE mytable (partition=2015-01-01)
> > select field1, field2,field3, field4, '11:40' as loadtime
> >  from mytable where partition = '2015-01-01'
> >
> > (Basically updating the partition with a new loadtime on every record in
> > this example)
> >
> > So I am now in a pickle, I want to be able to provide the streaming data
> > to my users in as timely of a manner as possible.  I have the issue with
> > ALTER SESSION statement and the law of unintended consequences from
> > changing a setting that will alter more than the table I am querying,
> and I
> > UNIONS are being optimized by drill causing slow queries.   I am
> interested
> > in feedback on how to address this ETL concern in the best way with
> Drill.
> >
> > And on the plus side, people can use my long email as a sleep aid... I'll
> > call that my contribution to the devs who had to much caffeine :)
> >
> > John
> >
> >
> >
> >
>

Reply via email to