You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by fhueske <gi...@git.apache.org> on 2018/02/14 13:48:26 UTC
[GitHub] flink pull request #5272: [Flink-8397][Connectors]Support Row type for Cassa...
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/5272#discussion_r168175822
--- Diff: flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/batch/connectors/cassandra/CassandraOutputFormat.java ---
@@ -95,15 +94,14 @@ public void writeRecord(OUT record) throws IOException {
throw new IOException("write record failed", exception);
}
- Object[] fields = new Object[record.getArity()];
- for (int i = 0; i < record.getArity(); i++) {
- fields[i] = record.getField(i);
- }
+ Object[] fields = extractFields(record);
ResultSetFuture result = session.executeAsync(prepared.bind(fields));
Futures.addCallback(result, callback);
}
- /**
+ protected abstract Object[] extractFields(OUT record);
--- End diff --
Add an `Object[] fields` parameter that can be reused across invocations of `extractFields()`.
---