You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Xinli shang <sh...@uber.com.INVALID> on 2023/11/21 17:20:32 UTC

[DISCUSS] KIP-1008: ParKa - the Marriage of Parquet and Kafka

Hi, all

Can I ask for a discussion on the KIP just created KIP-1008: ParKa - the
Marriage of Parquet and Kafka
<https://cwiki.apache.org/confluence/display/KAFKA/KIP-1008%3A+ParKa+-+the+Marriage+of+Parquet+and+Kafka>
?

-- 
Xinli Shang

Re: [DISCUSS] KIP-1008: ParKa - the Marriage of Parquet and Kafka

Posted by Xinli shang <sh...@uber.com.INVALID>.
Hi Steven,

Thank you for your question! Firstly, the statistics such as min/max, null
count, exist inside the file (page and column index), or you can consider
it as inside the the Parquet segment. These statistics will be generated at
the Kafka producer in our proposal when the Parquet format is applied. It
is part of the Parquet format. Secondly, when the table format (like Delta,
Iceberg, Hudi) is applied during ingestion, those statistics inside the
file will be rolled up to the metadata of the table format.

The second part is out of the scope of this KIP because that is entirely
within the realm of ingestion. This KIP provides a byte buffer to the
ingestion application, and the data inside the byte buffer is in Parquet
format. Let me know if you have any questions.

Xinli

On Sun, Nov 26, 2023 at 9:42 AM Steven Wu <st...@gmail.com> wrote:

> >  if we can produce the segment with Parquet, which is the native format
> in a data lake, the consumer application (e.g., Spark jobs for ingestion)
> can directly dump the segments as raw byte buffer into the data lake
> without unwrapping each record individually and then writing to the Parquet
> file one by one with expensive steps of encoding and compression again.
>
> This sounds like an interesting idea. I have one concern though. Data
> Lake/table formats (like Delta Lake, Hudi, Iceberg) have column-level
> statistics, which are important for query performance. How would column
> stats be handled in this proposal?
>
> On Tue, Nov 21, 2023 at 9:21 AM Xinli shang <sh...@uber.com.invalid>
> wrote:
>
> > Hi, all
> >
> > Can I ask for a discussion on the KIP just created KIP-1008: ParKa - the
> > Marriage of Parquet and Kafka
> > <
> >
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1008%3A+ParKa+-+the+Marriage+of+Parquet+and+Kafka
> > >
> > ?
> >
> > --
> > Xinli Shang
> >
>


-- 
Xinli Shang

Re: [DISCUSS] KIP-1008: ParKa - the Marriage of Parquet and Kafka

Posted by Steven Wu <st...@gmail.com>.
>  if we can produce the segment with Parquet, which is the native format
in a data lake, the consumer application (e.g., Spark jobs for ingestion)
can directly dump the segments as raw byte buffer into the data lake
without unwrapping each record individually and then writing to the Parquet
file one by one with expensive steps of encoding and compression again.

This sounds like an interesting idea. I have one concern though. Data
Lake/table formats (like Delta Lake, Hudi, Iceberg) have column-level
statistics, which are important for query performance. How would column
stats be handled in this proposal?

On Tue, Nov 21, 2023 at 9:21 AM Xinli shang <sh...@uber.com.invalid> wrote:

> Hi, all
>
> Can I ask for a discussion on the KIP just created KIP-1008: ParKa - the
> Marriage of Parquet and Kafka
> <
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-1008%3A+ParKa+-+the+Marriage+of+Parquet+and+Kafka
> >
> ?
>
> --
> Xinli Shang
>

Re: [DISCUSS] KIP-1008: ParKa - the Marriage of Parquet and Kafka

Posted by Andrew Schofield <an...@outlook.com>.
Hi Xinli,
Thanks for the KIP. I see that the discussion thread has died down, which is often a tricky situation with a KIP.

I’ve been thinking about this KIP for a while and it was really good to be able to attend the Kafka Summit London
session to get a proper understanding of it. I think it’s a really interesting idea, but….

I’m afraid I think this is not a good approach to solving the problem. If I understand correctly, the fundamental
aim is to insert Parquet data from Kafka clients efficiently into a data lake. Part of the attraction is that Parquet
compression is extremely efficient for the truly massive batches (up to 100,000 records) that you described at
Kafka Summit. While this is an entirely sensible aim, I think there are better ways to do the same thing with
Kafka.

The KIP seems asymmetrical to me. The “rows” of your Parquet data are individual Kafka records, which are then
batched up and encoded into Parquet with an appropriate schema. But on the consumption side, you don’t
really want to treat them as individual records at all. Instead, the entire batch is intended to be received and copied into the
data lake as a unit. You also are relying on KIP-712, which is not an approved KIP.

I started wondering whether simply introducing Parquet as a new compression format for Kafka would be a neat
and generally useful way to proceed. Would it really be generally applicable in the way that say, zstd is?
Would it work with all of the parts of Kafka such as the log cleaner? I think the answer is that it would not. It’s an
effective encoding only for massive batches, and the requirement that the compressor needs to know the schema
means that components in the “middle” that might need to apply compression would need to know this information.

I think the best approach would be for your Kafka records to be sent to Kafka already in Parquet format. So, you
would accumulate the rows of data into large batches, encode and compress into Parquet using the correct schema,
and then send to Kafka in a batch containing one large record. Then the existing producer and consumer could be used
without change. I know that this means you end up with very large records, but you’re actually ending up with a very similar
situation by creating huge batches of 100,000 smaller records which still need to be accommodated by Kafka.

Just my 2 cents. I hope I’ve managed to revitalise the discussion thread and get some more opinions too.

Thanks,
Andrew

> On 21 Nov 2023, at 17:20, Xinli shang <sh...@uber.com.INVALID> wrote:
>
> Hi, all
>
> Can I ask for a discussion on the KIP just created KIP-1008: ParKa - the
> Marriage of Parquet and Kafka
> <https://cwiki.apache.org/confluence/display/KAFKA/KIP-1008%3A+ParKa+-+the+Marriage+of+Parquet+and+Kafka>
> ?
>
> --
> Xinli Shang