Hi, Query builder's Batch simply sends a QUERY message through the wire where the query string is a CQL batch statement <http://docs.datastax.com/en/cql/3.3/cql/cql_reference/batch_r.html>: "BEGIN BATCH ... APPLY BATCH".
BatchStatement actually sends a BATCH message <https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v4.spec#L379> through the wire, and indeed is only available from protocol V2 onwards. Both are valid ways of executing a batch and are semantically equivalent; one big advantage of BatchStatement vs Batch is that you can group prepared statements together and execute them as a batch. However neither Batch nor BatchStatements will split big batches into smaller ones AFAIK. Thanks Alexandre On Fri, Mar 25, 2016 at 4:44 AM Jimmy Lin <y2klyf+w...@gmail.com> wrote: > Hi all, > What is the difference between datastax driver Batch and BatchStatement? > > In particular, BatchStatment call out that it needs native protocol of > version 2 or above. > What is the advantage using native protocol 2.0 for batch execution? > > Will any of these two api smart enough to split a big batch into multiple > smaller one ? > (to avoid batch_size_warn_threshold_in_kb or > batch_size_failed_threshold_in_kb > ) > > Thanks > > Batch > > https://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/querybuilder/Batch.html > > BatchStatement > > https://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/BatchStatement.html > -- Alexandre Dutra Driver & Tools Engineer @ DataStax