Search in sources :

Example 1 with GenericQueryTarget

use of com.hazelcast.sql.impl.extract.GenericQueryTarget in project hazelcast by hazelcast.

the class KvRowProjectorTest method test_project_onlyDataKeyAndValueIsProvided.

@Test
public void test_project_onlyDataKeyAndValueIsProvided() {
    InternalSerializationService serializationService = new DefaultSerializationServiceBuilder().build();
    KvRowProjector projector = new KvRowProjector(new QueryPath[] { QueryPath.KEY_PATH, QueryPath.VALUE_PATH }, new QueryDataType[] { INT, INT }, new GenericQueryTarget(serializationService, null, true), new GenericQueryTarget(serializationService, null, false), null, asList(MultiplyFunction.create(ColumnExpression.create(0, INT), ConstantExpression.create(2, INT), INT), DivideFunction.create(ColumnExpression.create(1, INT), ConstantExpression.create(2, INT), INT)), SqlTestSupport.createExpressionEvalContext());
    JetSqlRow row = projector.project(serializationService.toData(1), serializationService.toData(8));
    assertThat(row).isEqualTo(jetRow(2, 4));
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) GenericQueryTarget(com.hazelcast.sql.impl.extract.GenericQueryTarget) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService) JetSqlRow(com.hazelcast.sql.impl.row.JetSqlRow) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)1 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)1 GenericQueryTarget (com.hazelcast.sql.impl.extract.GenericQueryTarget)1 JetSqlRow (com.hazelcast.sql.impl.row.JetSqlRow)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Test (org.junit.Test)1