use of com.datastax.oss.dsbulk.workflow.commons.schema.DefaultRecordMapper in project dsbulk by datastax.
the class SchemaSettings method createRecordMapper.
public RecordMapper createRecordMapper(CqlSession session, RecordMetadata recordMetadata, boolean batchingEnabled) throws IllegalArgumentException {
if (!schemaGenerationStrategy.isWriting() || !schemaGenerationStrategy.isMapping()) {
throw new IllegalStateException("Cannot create record mapper when schema generation strategy is " + schemaGenerationStrategy);
}
Mapping mapping = prepareStatementAndCreateMapping(session, batchingEnabled, EnumSet.noneOf(StatisticsMode.class));
ProtocolVersion protocolVersion = session.getContext().getProtocolVersion();
if (protocolVersion.getCode() < DefaultProtocolVersion.V4.getCode() && nullToUnset) {
LOGGER.warn(String.format("Protocol version in use (%s) does not support unset bound variables; " + "forcing schema.nullToUnset to false", protocolVersion));
nullToUnset = false;
}
return new DefaultRecordMapper(preparedStatements, partitionKeyVariables(), mutatesOnlyStaticColumns() ? Collections.emptySet() : clusteringColumnVariables(), protocolVersion, mapping, recordMetadata, nullToUnset, allowExtraFields, allowMissingFields);
}
Aggregations