Re: New Copy Formats - avro/orc/parquet

From: Andres Freund <andres(at)anarazel(dot)de>
To: Nicolas Paris <niparisco(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: New Copy Formats - avro/orc/parquet
Date: 2018-02-11 21:12:35
Message-ID: 20180211211235.5x3jywe5z3lkgcsr@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2018-02-10 16:13:04 +0100, Nicolas Paris wrote:
> Hello
>
> I d'found useful to be able to import/export from postgres to those modern data
> formats:
> - avro (c writer=https://avro.apache.org/docs/1.8.2/api/c/index.html)
> - parquet (c++ writer=https://github.com/apache/parquet-cpp)
> - orc (all writers=https://github.com/apache/orc)
>
> Something like :
> COPY table TO STDOUT ORC;
>
> Would be lovely.
>
> This would greatly enhance how postgres integrates in big-data ecosystem.
>
> Any thought ?

So, I think making COPY extensible would be quite beneficial. I'm
however quite doubtful that we want to add core code to handle all of
the above. I think we should make the COPY input/output formatting
extensible by extensions. I think we'd have something like
CREATE COPY HANDLER name HANDLER somefunction;
somefunction would have to be a function that returns type
pg_copy_handler, which in turn basically is a struct of function
pointers.
I imagine we'd have callbacks for
- start copy in / out
- output row, with a an array of values/nulls
- parse row, with a input buffer as argument, returning values / nulls arrays
- finish copy in / out

we'd also need to expose a few more utility functions from copy.c
externally.

I think this'd require a good bit of cleanup in copy.c...

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-02-11 21:19:31 Re: New Copy Formats - avro/orc/parquet
Previous Message Nicolas Paris 2018-02-11 20:57:35 Re: New Copy Formats - avro/orc/parquet