com.datastax.driver.core.DataType Java Examples

The following examples show how to use com.datastax.driver.core.DataType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractCassandraProcessorTest.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetPrimitiveAvroTypeFromCassandraType() throws Exception {
    assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.ascii()));
    assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.text()));
    assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.varchar()));
    assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.timestamp()));
    assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.timeuuid()));
    assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.uuid()));
    assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.inet()));
    assertEquals("string", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.varint()));

    assertEquals("boolean", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.cboolean()));
    assertEquals("int", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.cint()));

    assertEquals("long", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.bigint()));
    assertEquals("long", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.counter()));

    assertEquals("float", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.cfloat()));
    assertEquals("double", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.cdouble()));

    assertEquals("bytes", AbstractCassandraProcessor.getPrimitiveAvroTypeFromCassandraType(DataType.blob()));
}
 
Example #2
Source File: UserTypeConverter.java    From debezium-incubator with Apache License 2.0 6 votes vote down vote up
@Override
public UserType convert(DataType dataType) {
    com.datastax.driver.core.UserType userType = (com.datastax.driver.core.UserType) dataType;

    String typeNameString = userType.getTypeName();
    Collection<String> fieldNames = userType.getFieldNames();

    List<AbstractType<?>> innerAbstractTypes = new ArrayList<>(fieldNames.size());

    ByteBuffer typeNameBuffer = UTF8Type.instance.fromString(typeNameString);

    List<FieldIdentifier> fieldIdentifiers = new ArrayList<>(fieldNames.size());
    for (String fieldName : fieldNames) {
        fieldIdentifiers.add(FieldIdentifier.forInternalString(fieldName));
        innerAbstractTypes.add((CassandraTypeConverter.convert(userType.getFieldType(fieldName))));
    }

    return new UserType(userType.getKeyspace(),
            typeNameBuffer,
            fieldIdentifiers,
            innerAbstractTypes,
            !userType.isFrozen());
}
 
Example #3
Source File: CassandraTables.java    From hugegraph with Apache License 2.0 6 votes vote down vote up
@Override
public void init(CassandraSessionPool.Session session) {
    ImmutableMap<HugeKeys, DataType> pkeys = ImmutableMap.of(
            HugeKeys.ID, TYPE_SL
    );
    ImmutableMap<HugeKeys, DataType> ckeys = ImmutableMap.of();
    ImmutableMap<HugeKeys, DataType> columns = ImmutableMap
            .<HugeKeys, DataType>builder()
            .put(HugeKeys.NAME, DataType.text())
            .put(HugeKeys.ID_STRATEGY, DataType.tinyint())
            .put(HugeKeys.PRIMARY_KEYS, DataType.list(TYPE_PK))
            .put(HugeKeys.NULLABLE_KEYS, DataType.set(TYPE_PK))
            .put(HugeKeys.INDEX_LABELS, DataType.set(TYPE_IL))
            .put(HugeKeys.PROPERTIES, DataType.set(TYPE_PK))
            .put(HugeKeys.ENABLE_LABEL_INDEX, DataType.cboolean())
            .put(HugeKeys.USER_DATA, TYPE_UD)
            .put(HugeKeys.STATUS, DataType.tinyint())
            .put(HugeKeys.TTL, TYPE_TTL)
            .put(HugeKeys.TTL_START_TIME, TYPE_PK)
            .build();

    this.createTable(session, pkeys, ckeys, columns);
    this.createIndex(session, NAME_INDEX, HugeKeys.NAME);
}
 
Example #4
Source File: ResultImplTest.java    From scalardb with Apache License 2.0 6 votes vote down vote up
@Test
public void getValue_ProperValuesGivenInConstructor_ShouldReturnWhatsSet() {
  // Arrange
  String expectedText = ANY_NAME;
  int expectedInt = ANY_INT;
  definitions.add(expectedText, DataType.cint());
  when(row.getInt(expectedText)).thenReturn(expectedInt);
  ResultImpl spy = spy(new ResultImpl(new ArrayList<>(), null));
  doReturn(definitions.get()).when(spy).getColumnDefinitions(row);
  spy.interpret(row);

  // Act
  Optional<Value> actual = spy.getValue(expectedText);

  // Assert
  assertThat(actual).isEqualTo(Optional.of(new IntValue(expectedText, expectedInt)));
}
 
Example #5
Source File: CassandraTypeConverterTest.java    From debezium-incubator with Apache License 2.0 6 votes vote down vote up
@Test
public void testMap() {
    // map from ASCII to Double
    // test non-frozen
    DataType mapType = DataType.map(DataType.ascii(), DataType.cdouble());
    AbstractType<?> convertedType = CassandraTypeConverter.convert(mapType);

    MapType<?, ?> expectedType = MapType.getInstance(AsciiType.instance, DoubleType.instance, true);
    Assert.assertEquals(expectedType, convertedType);

    // test frozen
    mapType = DataType.map(DataType.ascii(), DataType.cdouble(), true);
    convertedType = CassandraTypeConverter.convert(mapType);
    expectedType = MapType.getInstance(AsciiType.instance, DoubleType.instance, false);
    Assert.assertEquals(expectedType, convertedType);
    Assert.assertTrue("Expected convertType to be frozen", convertedType.isFrozenCollection());
}
 
Example #6
Source File: QakkaQueueManager.java    From usergrid with Apache License 2.0 6 votes vote down vote up
private <T extends Serializable> void doSendMessage( T body, List<String> regions ) throws IOException {

        createQueueIfNecessary();

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        oos.writeObject(body);
        oos.flush();
        oos.close();
        ByteBuffer byteBuffer = ByteBuffer.wrap( bos.toByteArray() );

        queueMessageManager.sendMessages(
            scope.getName(),
            regions,
            null, // delay millis
            null, // expiration seconds
            "application/octet-stream",
            DataType.serializeValue( byteBuffer, ProtocolVersion.NEWEST_SUPPORTED ));
    }
 
Example #7
Source File: CassandraUtils.java    From deep-spark with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the partition key related to a given {@link Cells}.
 *
 * @param cells        {@link Cells} from Cassandra to extract the partition key.
 * @param keyValidator Cassandra key type.
 * @param numberOfKeys Number of keys.
 * @return Partition key.
 */
public static ByteBuffer getPartitionKey(Cells cells, AbstractType<?> keyValidator, int numberOfKeys) {
    ByteBuffer partitionKey;
    if (keyValidator instanceof CompositeType) {
        ByteBuffer[] keys = new ByteBuffer[numberOfKeys];

        for (int i = 0; i < cells.size(); i++) {
            Cell c = cells.getCellByIdx(i);

            if (c.isKey()) {
                keys[i] = DataType.serializeValue(c.getValue(), CassandraDeepJobConfig.PROTOCOL_VERSION);
            }
        }

        partitionKey = CompositeType.build(keys);
    } else {
        Cell cell = cells.getCellByIdx(0);
        partitionKey = DataType.serializeValue(cell.getValue(), CassandraDeepJobConfig.PROTOCOL_VERSION);
    }
    return partitionKey;
}
 
Example #8
Source File: CassandraTables.java    From hugegraph with Apache License 2.0 6 votes vote down vote up
@Override
public void init(CassandraSessionPool.Session session) {
    ImmutableMap<HugeKeys, DataType> pkeys = ImmutableMap.of(
            HugeKeys.ID, DataType.cint()
    );
    ImmutableMap<HugeKeys, DataType> ckeys = ImmutableMap.of();
    ImmutableMap<HugeKeys, DataType> columns = ImmutableMap
            .<HugeKeys, DataType>builder()
            .put(HugeKeys.NAME, DataType.text())
            .put(HugeKeys.DATA_TYPE, DataType.tinyint())
            .put(HugeKeys.CARDINALITY, DataType.tinyint())
            .put(HugeKeys.AGGREGATE_TYPE, DataType.tinyint())
            .put(HugeKeys.PROPERTIES, DataType.set(TYPE_PK))
            .put(HugeKeys.USER_DATA, TYPE_UD)
            .put(HugeKeys.STATUS, DataType.tinyint())
            .build();

    this.createTable(session, pkeys, ckeys, columns);
    this.createIndex(session, NAME_INDEX, HugeKeys.NAME);
}
 
Example #9
Source File: CassandraTables.java    From hugegraph with Apache License 2.0 6 votes vote down vote up
@Override
public void init(CassandraSessionPool.Session session) {
    ImmutableMap<HugeKeys, DataType> pkeys = ImmutableMap.of(
            HugeKeys.ID, TYPE_IL
    );
    ImmutableMap<HugeKeys, DataType> ckeys = ImmutableMap.of();
    ImmutableMap<HugeKeys, DataType> columns = ImmutableMap
            .<HugeKeys, DataType>builder()
            .put(HugeKeys.NAME, DataType.text())
            .put(HugeKeys.BASE_TYPE, DataType.tinyint())
            .put(HugeKeys.BASE_VALUE, TYPE_SL)
            .put(HugeKeys.INDEX_TYPE, DataType.tinyint())
            .put(HugeKeys.FIELDS, DataType.list(TYPE_PK))
            .put(HugeKeys.USER_DATA, TYPE_UD)
            .put(HugeKeys.STATUS, DataType.tinyint())
            .build();

    this.createTable(session, pkeys, ckeys, columns);
    this.createIndex(session, NAME_INDEX, HugeKeys.NAME);
}
 
Example #10
Source File: CassandraTables.java    From hugegraph with Apache License 2.0 6 votes vote down vote up
@Override
public void init(CassandraSessionPool.Session session) {
    ImmutableMap<HugeKeys, DataType> pkeys = ImmutableMap.of(
            HugeKeys.OWNER_VERTEX, TYPE_ID
    );
    ImmutableMap<HugeKeys, DataType> ckeys = ImmutableMap.of(
            HugeKeys.DIRECTION, DataType.tinyint(),
            HugeKeys.LABEL, TYPE_SL,
            HugeKeys.SORT_VALUES, DataType.text(),
            HugeKeys.OTHER_VERTEX, TYPE_ID
    );
    ImmutableMap<HugeKeys, DataType> columns = ImmutableMap.of(
            HugeKeys.PROPERTIES, DataType.map(TYPE_PK, TYPE_PROP),
            HugeKeys.EXPIRED_TIME, TYPE_EXPIRED_TIME
    );

    this.createTable(session, pkeys, ckeys, columns);

    /*
     * Only out-edges table needs label index because we query edges
     * by label from out-edges table
     */
    if (this.direction == Directions.OUT) {
        this.createIndex(session, LABEL_INDEX, HugeKeys.LABEL);
    }
}
 
Example #11
Source File: CassandraTypeConverterTest.java    From debezium-incubator with Apache License 2.0 5 votes vote down vote up
@Test
public void testBoolean() {
    DataType booleanType = DataType.cboolean();
    AbstractType<?> convertedType = CassandraTypeConverter.convert(booleanType);

    BooleanType expectedType = BooleanType.instance;

    Assert.assertEquals(expectedType, convertedType);
}
 
Example #12
Source File: TestCassandraUtils.java    From ingestion with Apache License 2.0 5 votes vote down vote up
@Test
public void parseValueText() {
  for (final DataType dataType : textualTypes) {
    assertThat(CassandraUtils.parseValue(dataType, "unquoted_text"))
        .isEqualTo("unquoted_text");
    assertThat(CassandraUtils.parseValue(dataType, "'quoted_text'"))
        .isEqualTo("'quoted_text'");
    assertThat(CassandraUtils.parseValue(dataType, "'unescaped_'quoted_text'"))
        .isEqualTo("'unescaped_'quoted_text'");
  }
}
 
Example #13
Source File: SaveToCassandraOperationsService.java    From Decision with Apache License 2.0 5 votes vote down vote up
private HashMap<String, String> getStreamFieldsAndTypes(List<ColumnNameTypeValue> columns) {

        HashMap<String, String> fields = new HashMap<String, String>();
        for (ColumnNameTypeValue column : columns) {
            switch (column.getType()) {
            case BOOLEAN:
                fields.put(column.getColumn(), DataType.Name.BOOLEAN.toString());
                break;
            case DOUBLE:
                fields.put(column.getColumn(), DataType.Name.DOUBLE.toString());
                break;
            case FLOAT:
                fields.put(column.getColumn(), DataType.Name.FLOAT.toString());
                break;
            case INTEGER:
                fields.put(column.getColumn(), DataType.Name.INT.toString());
                break;
            case LONG:
                fields.put(column.getColumn(), DataType.Name.DOUBLE.toString());
                break;
            case STRING:
                fields.put(column.getColumn(), DataType.Name.TEXT.toString());
                break;
            default:
                throw new RuntimeException("Unsupported Column type");
            }
        }

        return fields;
    }
 
Example #14
Source File: CellValidatorTest.java    From deep-spark with Apache License 2.0 5 votes vote down vote up
public void testDataTypeListInstantiation() {
    try {
        assertNull(cellValidator((DataType) null));
        fail();
    } catch (Exception e) {
        //ok
    }

    DataType type = DataType.list(DataType.timeuuid());

    CellValidator cv = cellValidator(type);
    assertNotNull(cv);
    assertEquals(cv.getValidatorClassName(), ListType.class.getName());
    assertNotNull(cv.getValidatorTypes());
    assertEquals(cv.validatorKind(), Kind.LIST);
    assertEquals(cv.getValidatorTypes().size(), 1);
    assertEquals(cv.getValidatorTypes().iterator().next(), "timeuuid");
    assertEquals(DataType.Name.LIST, cv.getCqlTypeName());

    try {
        Collection<String> types = cv.getValidatorTypes();
        types.add("test");
        fail("Validator types collection must be inmutable");
    } catch (Exception ex) {
        // ok
    }

    //        assertNotNull(cv.getAbstractType());
    //        assertEquals(cv.getAbstractType(), ListType.getInstance(TimeUUIDType.instance));
}
 
Example #15
Source File: CassandraTypeConverterTest.java    From debezium-incubator with Apache License 2.0 5 votes vote down vote up
@Test
public void testCounter() {
    DataType counterType = DataType.counter();
    AbstractType<?> convertedType = CassandraTypeConverter.convert(counterType);

    CounterColumnType expectedType = CounterColumnType.instance;

    Assert.assertEquals(expectedType, convertedType);
}
 
Example #16
Source File: CassandraPOJOInputOperator.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
public CassandraPOJOInputOperator()
{
  super();
  columnDataTypes = new ArrayList<DataType>();
  setters = new ArrayList<Object>();
  this.store = new CassandraStore();
}
 
Example #17
Source File: CassandraTypeConverterTest.java    From debezium-incubator with Apache License 2.0 5 votes vote down vote up
@Test
public void testTimeUUID() {
    DataType timeUUID = DataType.timeuuid();
    AbstractType<?> convertedType = CassandraTypeConverter.convert(timeUUID);

    TimeUUIDType expectedType = TimeUUIDType.instance;

    Assert.assertEquals(expectedType, convertedType);
}
 
Example #18
Source File: AbstractCassandraProcessor.java    From nifi with Apache License 2.0 5 votes vote down vote up
protected static DataType getPrimitiveDataTypeFromString(String dataTypeName) {
    Set<DataType> primitiveTypes = DataType.allPrimitiveTypes();
    for (DataType primitiveType : primitiveTypes) {
        if (primitiveType.toString().equals(dataTypeName)) {
            return primitiveType;
        }
    }
    return null;
}
 
Example #19
Source File: PojoField.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes field info from property descriptor.
 *
 * @param accessor {@link PojoFieldAccessor} accessor.
 */
private void init(PojoFieldAccessor accessor) {
    DataType.Name cassandraType = PropertyMappingHelper.getCassandraType(accessor.getFieldType());
    cassandraType = cassandraType == null ? DataType.Name.BLOB : cassandraType;

    this.colDDL = "\"" + col + "\" " + cassandraType.toString();

    this.accessor = accessor;
}
 
Example #20
Source File: CassandraType.java    From presto with Apache License 2.0 5 votes vote down vote up
public static boolean isFullySupported(DataType dataType)
{
    if (toCassandraType(dataType.getName()).isEmpty()) {
        return false;
    }

    return dataType.getTypeArguments().stream()
            .allMatch(CassandraType::isFullySupported);
}
 
Example #21
Source File: CassandraTables.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
@Override
public void init(CassandraSessionPool.Session session) {
    ImmutableMap<HugeKeys, DataType> pkeys = ImmutableMap.of(
            HugeKeys.SCHEMA_TYPE, DataType.text()
    );
    ImmutableMap<HugeKeys, DataType> ckeys = ImmutableMap.of();
    ImmutableMap<HugeKeys, DataType> columns = ImmutableMap.of(
            HugeKeys.ID, DataType.counter()
    );

    this.createTable(session, pkeys, ckeys, columns);
}
 
Example #22
Source File: CQLUtils.java    From usergrid with Apache License 2.0 5 votes vote down vote up
public static String spaceSeparatedKeyValue(Map<String, ?> columns){

        StringJoiner columnsSchema = new StringJoiner(",");
        columns.forEach( (key, value) -> {

            if( value == DataType.Name.CUSTOM ){
                columnsSchema.add(key+" "+COMPOSITE_TYPE);
            }else {
                columnsSchema.add(key + " " + String.valueOf(value));
            }
        });

        return columnsSchema.toString();

    }
 
Example #23
Source File: CassandraBaseDAO.java    From conductor with Apache License 2.0 5 votes vote down vote up
private String getCreateTaskDefLimitTableStatement() {
    return SchemaBuilder.createTable(config.getCassandraKeyspace(), TABLE_TASK_DEF_LIMIT)
        .ifNotExists()
        .addPartitionKey(TASK_DEF_NAME_KEY, DataType.text())
        .addClusteringColumn(TASK_ID_KEY, DataType.uuid())
        .addColumn(WORKFLOW_ID_KEY, DataType.uuid())
        .getQueryString();
}
 
Example #24
Source File: CassandraTables.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
@Override
public void init(CassandraSessionPool.Session session) {
    ImmutableMap<HugeKeys, DataType> pkeys = ImmutableMap.of(
            HugeKeys.FIELD_VALUES, DataType.text()
    );
    ImmutableMap<HugeKeys, DataType> ckeys = ImmutableMap.of(
            HugeKeys.INDEX_LABEL_ID, TYPE_IL,
            HugeKeys.ELEMENT_IDS, TYPE_ID
    );
    ImmutableMap<HugeKeys, DataType> columns = ImmutableMap.of(
            HugeKeys.EXPIRED_TIME, TYPE_EXPIRED_TIME
    );

    this.createTable(session, pkeys, ckeys, columns);
}
 
Example #25
Source File: CellValidator.java    From deep-spark with Apache License 2.0 5 votes vote down vote up
/**
 * private constructor.
 *
 * @param type a {@link com.datastax.driver.core.DataType} coming from the underlying Java driver.
 */
private CellValidator(DataType type) {
    if (type == null) {
        throw new DeepInstantiationException("input DataType cannot be null");
    }

    cqlTypeName = type.getName();

    if (!type.isCollection()) {
        validatorClassName = MAP_JAVA_TYPE_TO_ABSTRACT_TYPE.get(type.asJavaClass()).getClass()
                .getName();
    } else {
        validatorTypes = new ArrayList<>();

        for (DataType dataType : type.getTypeArguments()) {
            validatorTypes.add(dataType.toString());
        }

        switch (type.getName()) {
        case SET:
            validatorKind = Kind.SET;
            validatorClassName = SetType.class.getName();
            break;
        case LIST:
            validatorKind = Kind.LIST;
            validatorClassName = ListType.class.getName();
            break;
        case MAP:
            validatorKind = Kind.MAP;
            validatorClassName = MapType.class.getName();
            break;
        default:
            throw new DeepGenericException("Cannot determine collection type for " + type.getName());
        }

        validatorTypes = unmodifiableCollection(validatorTypes);
    }
}
 
Example #26
Source File: PersistenceSettings.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Returns Cassandra table columns DDL, corresponding to POJO fields which should be persisted.
 *
 * @param ignoreColumns Table columns to ignore (exclude) from DDL.
 * @return DDL statement for Cassandra table fields.
 */
public String getTableColumnsDDL(Set<String> ignoreColumns) {
    if (PersistenceStrategy.BLOB == stgy)
        return "  \"" + col + "\" " + DataType.Name.BLOB.toString();

    if (PersistenceStrategy.PRIMITIVE == stgy)
        return "  \"" + col + "\" " + PropertyMappingHelper.getCassandraType(javaCls);

    List<F> fields = getFields();

    if (fields == null || fields.isEmpty()) {
        throw new IllegalStateException("There are no POJO fields found for '" + javaCls.toString()
            + "' class to be presented as a Cassandra primary key");
    }

    // Accumulating already processed columns in the set, to prevent duplicating columns
    // shared by two different POJO fields.
    Set<String> processedColumns = new HashSet<>();

    StringBuilder builder = new StringBuilder();

    for (F field : fields) {
        if ((ignoreColumns != null && ignoreColumns.contains(field.getColumn())) ||
                processedColumns.contains(field.getColumn())) {
            continue;
        }

        if (builder.length() > 0)
            builder.append(",\n");

        builder.append("  ").append(field.getColumnDDL());

        processedColumns.add(field.getColumn());
    }

    return builder.toString();
}
 
Example #27
Source File: CellValidatorTest.java    From deep-spark with Apache License 2.0 5 votes vote down vote up
public void testBlobDataType() {
    CellValidator cv = cellValidator(DataType.blob());
    assertNotNull(cv);
    assertEquals(cv.getValidatorClassName(), BytesType.class.getName());
    assertNull(cv.getValidatorTypes());
    assertNotNull(cv.getAbstractType());
    assertEquals(cv.getAbstractType(), BytesType.instance);
}
 
Example #28
Source File: DatastaxGenericFloatGetter.java    From SimpleFlatMapper with MIT License 5 votes vote down vote up
private DataType.Name validateName(DataType dataType) {

        final DataType.Name name = dataType.getName();
        if (DataTypeHelper.isNumber(name)) {
            return name;
        }

        throw new IllegalArgumentException("Datatype " + dataType + " not a number");
    }
 
Example #29
Source File: CassandraTypeConverterTest.java    From debezium-incubator with Apache License 2.0 5 votes vote down vote up
@Test
public void testTuple() {
    // tuple containing timestamp and smallint.
    // tuples are always frozen, so we don't need to test that.
    // we don't care about the protocol version or the codec registry.
    DataType tupleType = TupleType.of(null, null, DataType.timestamp(), DataType.smallint());
    AbstractType<?> convertedType = CassandraTypeConverter.convert(tupleType);

    List<AbstractType<?>> innerAbstractTypes = new ArrayList<>(2);
    innerAbstractTypes.add(TimestampType.instance);
    innerAbstractTypes.add(ShortType.instance);
    org.apache.cassandra.db.marshal.TupleType expectedType = new org.apache.cassandra.db.marshal.TupleType(innerAbstractTypes);

    Assert.assertEquals(expectedType, convertedType);
}
 
Example #30
Source File: TupleTypeConverter.java    From debezium-incubator with Apache License 2.0 5 votes vote down vote up
@Override
public TupleType convert(DataType dataType) {
    com.datastax.driver.core.TupleType tupleDataType = (com.datastax.driver.core.TupleType) dataType;
    List<DataType> innerTypes = tupleDataType.getComponentTypes();
    List<AbstractType<?>> innerAbstractTypes = new ArrayList<>(innerTypes.size());
    for (DataType dt : innerTypes) {
        innerAbstractTypes.add(CassandraTypeConverter.convert(dt));
    }
    return new TupleType(innerAbstractTypes);
}