Search in sources :

Example 36 with Column

use of org.apache.ignite.internal.schema.Column in project ignite-3 by apache.

the class UpgradingRowAdapter method bitmaskValue.

/**
 * {@inheritDoc}
 */
@Override
public BitSet bitmaskValue(int colIdx) throws InvalidTypeException {
    int mappedId = mapColumn(colIdx);
    Column column = mappedId < 0 ? mapper.mappedColumn(colIdx) : super.schema().column(mappedId);
    if (NativeTypeSpec.BITMASK != column.type().spec()) {
        throw new SchemaException("Type conversion is not supported yet.");
    }
    return mappedId < 0 ? (BitSet) column.defaultValue() : super.bitmaskValue(mappedId);
}
Also used : SchemaException(org.apache.ignite.internal.schema.SchemaException) Column(org.apache.ignite.internal.schema.Column)

Example 37 with Column

use of org.apache.ignite.internal.schema.Column in project ignite-3 by apache.

the class UpgradingRowAdapter method dateTimeValue.

/**
 * {@inheritDoc}
 */
@Override
public LocalDateTime dateTimeValue(int colIdx) throws InvalidTypeException {
    int mappedId = mapColumn(colIdx);
    Column column = mappedId < 0 ? mapper.mappedColumn(colIdx) : super.schema().column(mappedId);
    if (NativeTypeSpec.DATETIME != column.type().spec()) {
        throw new SchemaException("Type conversion is not supported yet.");
    }
    return mappedId < 0 ? (LocalDateTime) column.defaultValue() : super.dateTimeValue(mappedId);
}
Also used : SchemaException(org.apache.ignite.internal.schema.SchemaException) Column(org.apache.ignite.internal.schema.Column)

Example 38 with Column

use of org.apache.ignite.internal.schema.Column in project ignite-3 by apache.

the class UpgradingRowAdapter method longValue.

/**
 * {@inheritDoc}
 */
@Override
public long longValue(int colIdx) throws InvalidTypeException {
    int mappedId = mapColumn(colIdx);
    Column column = mappedId < 0 ? mapper.mappedColumn(colIdx) : super.schema().column(mappedId);
    if (NativeTypeSpec.INT64 != column.type().spec()) {
        throw new SchemaException("Type conversion is not supported yet.");
    }
    return mappedId < 0 ? (long) column.defaultValue() : super.longValue(mappedId);
}
Also used : SchemaException(org.apache.ignite.internal.schema.SchemaException) Column(org.apache.ignite.internal.schema.Column)

Example 39 with Column

use of org.apache.ignite.internal.schema.Column in project ignite-3 by apache.

the class UpgradingRowAdapter method intValue.

/**
 * {@inheritDoc}
 */
@Override
public int intValue(int colIdx) throws InvalidTypeException {
    int mappedId = mapColumn(colIdx);
    Column column = mappedId < 0 ? mapper.mappedColumn(colIdx) : super.schema().column(mappedId);
    if (NativeTypeSpec.INT32 != column.type().spec()) {
        throw new SchemaException("Type conversion is not supported yet.");
    }
    return mappedId < 0 ? (int) column.defaultValue() : super.intValue(mappedId);
}
Also used : SchemaException(org.apache.ignite.internal.schema.SchemaException) Column(org.apache.ignite.internal.schema.Column)

Example 40 with Column

use of org.apache.ignite.internal.schema.Column in project ignite-3 by apache.

the class UpgradingRowAdapter method decimalValue.

/**
 * {@inheritDoc}
 */
@Override
public BigDecimal decimalValue(int colIdx) throws InvalidTypeException {
    int mappedId = mapColumn(colIdx);
    Column column = mappedId < 0 ? mapper.mappedColumn(colIdx) : super.schema().column(mappedId);
    if (NativeTypeSpec.DECIMAL != column.type().spec()) {
        throw new SchemaException("Type conversion is not supported yet.");
    }
    return mappedId < 0 ? (BigDecimal) column.defaultValue() : super.decimalValue(mappedId);
}
Also used : SchemaException(org.apache.ignite.internal.schema.SchemaException) Column(org.apache.ignite.internal.schema.Column)

Aggregations

Column (org.apache.ignite.internal.schema.Column)131 SchemaDescriptor (org.apache.ignite.internal.schema.SchemaDescriptor)78 Test (org.junit.jupiter.api.Test)44 Row (org.apache.ignite.internal.schema.row.Row)37 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)31 Tuple (org.apache.ignite.table.Tuple)27 MethodSource (org.junit.jupiter.params.provider.MethodSource)27 SchemaException (org.apache.ignite.internal.schema.SchemaException)22 BinaryRow (org.apache.ignite.internal.schema.BinaryRow)20 RowAssembler (org.apache.ignite.internal.schema.row.RowAssembler)11 DummySchemaManagerImpl (org.apache.ignite.internal.table.impl.DummySchemaManagerImpl)11 TupleMarshaller (org.apache.ignite.internal.schema.marshaller.TupleMarshaller)10 TupleMarshallerImpl (org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl)10 TestObjectWithAllTypes (org.apache.ignite.internal.schema.testobjects.TestObjectWithAllTypes)10 Arrays (java.util.Arrays)7 NotNull (org.jetbrains.annotations.NotNull)7 List (java.util.List)6 Random (java.util.Random)6 NativeTypeSpec (org.apache.ignite.internal.schema.NativeTypeSpec)6 BigDecimal (java.math.BigDecimal)5