Search in sources :

Example 1 with DefaultRecordMapper

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);
}
Also used : StatisticsMode(com.datastax.oss.dsbulk.workflow.commons.settings.StatsSettings.StatisticsMode) DefaultRecordMapper(com.datastax.oss.dsbulk.workflow.commons.schema.DefaultRecordMapper) DefaultMapping(com.datastax.oss.dsbulk.mapping.DefaultMapping) Mapping(com.datastax.oss.dsbulk.mapping.Mapping) ProtocolVersion(com.datastax.oss.driver.api.core.ProtocolVersion) DefaultProtocolVersion(com.datastax.oss.driver.api.core.DefaultProtocolVersion)

Aggregations

DefaultProtocolVersion (com.datastax.oss.driver.api.core.DefaultProtocolVersion)1 ProtocolVersion (com.datastax.oss.driver.api.core.ProtocolVersion)1 DefaultMapping (com.datastax.oss.dsbulk.mapping.DefaultMapping)1 Mapping (com.datastax.oss.dsbulk.mapping.Mapping)1 DefaultRecordMapper (com.datastax.oss.dsbulk.workflow.commons.schema.DefaultRecordMapper)1 StatisticsMode (com.datastax.oss.dsbulk.workflow.commons.settings.StatsSettings.StatisticsMode)1