Search in sources :

Example 16 with SqlRowMetadata

use of com.hazelcast.sql.SqlRowMetadata in project hazelcast by hazelcast.

the class SqlInsertWindowBoundsTest method test_windowBoundsSameTypeAsDescriptor_TIMESTAMP.

@Test
public void test_windowBoundsSameTypeAsDescriptor_TIMESTAMP() {
    String name = randomName();
    TestStreamSqlConnector.create(sqlService, name, asList("ts", "name"), asList(TIMESTAMP, VARCHAR), row(timestamp(0L), "Alice"), row(timestamp(15L), null));
    String interval = "INTERVAL '0.001' SECOND";
    final SqlRow row = instance().getSql().execute(sql(name, interval)).iterator().next();
    final SqlRowMetadata metadata = row.getMetadata();
    assertThat(metadata.getColumn(0).getType()).isEqualTo(SqlColumnType.TIMESTAMP);
    assertThat((Object) row.getObject(0)).isInstanceOf(SqlColumnType.TIMESTAMP.getValueClass());
    assertThat(metadata.getColumn(1).getType()).isEqualTo(SqlColumnType.TIMESTAMP);
    assertThat((Object) row.getObject(1)).isInstanceOf(SqlColumnType.TIMESTAMP.getValueClass());
    assertThat(metadata.getColumn(2).getType()).isEqualTo(SqlColumnType.TIMESTAMP);
    assertThat((Object) row.getObject(2)).isInstanceOf(SqlColumnType.TIMESTAMP.getValueClass());
}
Also used : SqlRow(com.hazelcast.sql.SqlRow) SqlRowMetadata(com.hazelcast.sql.SqlRowMetadata) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 17 with SqlRowMetadata

use of com.hazelcast.sql.SqlRowMetadata in project hazelcast by hazelcast.

the class SqlInsertWindowBoundsTest method test_windowBoundsSameTypeAsDescriptor_SMALLINT.

@Test
public void test_windowBoundsSameTypeAsDescriptor_SMALLINT() {
    String name = randomName();
    TestStreamSqlConnector.create(sqlService, name, asList("ts", "name"), asList(SMALLINT, VARCHAR), row((short) 1, "Alice"), row((short) 10, null));
    String interval = "1";
    final SqlRow row = instance().getSql().execute(sql(name, interval)).iterator().next();
    final SqlRowMetadata metadata = row.getMetadata();
    assertThat(metadata.getColumn(0).getType()).isEqualTo(SqlColumnType.SMALLINT);
    assertThat((Object) row.getObject(0)).isInstanceOf(SqlColumnType.SMALLINT.getValueClass());
    assertThat(metadata.getColumn(1).getType()).isEqualTo(SqlColumnType.SMALLINT);
    assertThat((Object) row.getObject(1)).isInstanceOf(SqlColumnType.SMALLINT.getValueClass());
    assertThat(metadata.getColumn(2).getType()).isEqualTo(SqlColumnType.SMALLINT);
    assertThat((Object) row.getObject(2)).isInstanceOf(SqlColumnType.SMALLINT.getValueClass());
}
Also used : SqlRow(com.hazelcast.sql.SqlRow) SqlRowMetadata(com.hazelcast.sql.SqlRowMetadata) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 18 with SqlRowMetadata

use of com.hazelcast.sql.SqlRowMetadata in project hazelcast by hazelcast.

the class SqlInsertWindowBoundsTest method test_windowBoundsSameTypeAsDescriptor_TIME.

@Test
public void test_windowBoundsSameTypeAsDescriptor_TIME() {
    String name = randomName();
    TestStreamSqlConnector.create(sqlService, name, asList("ts", "name"), asList(TIME, VARCHAR), row(timestamp(0L).toLocalTime().toString(), "Alice"), row(timestamp(10L).toLocalTime().toString(), null));
    String interval = "INTERVAL '0.001' SECOND";
    final SqlRow row = instance().getSql().execute(sql(name, interval)).iterator().next();
    final SqlRowMetadata metadata = row.getMetadata();
    assertThat(metadata.getColumn(0).getType()).isEqualTo(SqlColumnType.TIME);
    assertThat((Object) row.getObject(0)).isInstanceOf(SqlColumnType.TIME.getValueClass());
    assertThat(metadata.getColumn(1).getType()).isEqualTo(SqlColumnType.TIME);
    assertThat((Object) row.getObject(1)).isInstanceOf(SqlColumnType.TIME.getValueClass());
    assertThat(metadata.getColumn(2).getType()).isEqualTo(SqlColumnType.TIME);
    assertThat((Object) row.getObject(2)).isInstanceOf(SqlColumnType.TIME.getValueClass());
}
Also used : SqlRow(com.hazelcast.sql.SqlRow) SqlRowMetadata(com.hazelcast.sql.SqlRowMetadata) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

SqlRowMetadata (com.hazelcast.sql.SqlRowMetadata)18 SqlRow (com.hazelcast.sql.SqlRow)13 QuickTest (com.hazelcast.test.annotation.QuickTest)10 Test (org.junit.Test)10 SqlColumnMetadata (com.hazelcast.sql.SqlColumnMetadata)5 ArrayList (java.util.ArrayList)5 SqlResult (com.hazelcast.sql.SqlResult)4 HashMap (java.util.HashMap)4 DmlPlan (com.hazelcast.jet.sql.impl.SqlPlanImpl.DmlPlan)3 IMapDeletePlan (com.hazelcast.jet.sql.impl.SqlPlanImpl.IMapDeletePlan)3 IMapInsertPlan (com.hazelcast.jet.sql.impl.SqlPlanImpl.IMapInsertPlan)3 BitmapIndexOptions (com.hazelcast.config.BitmapIndexOptions)2 UniqueKeyTransformation (com.hazelcast.config.BitmapIndexOptions.UniqueKeyTransformation)2 IndexConfig (com.hazelcast.config.IndexConfig)2 IndexType (com.hazelcast.config.IndexType)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)2 Job (com.hazelcast.jet.Job)2 JobStateSnapshot (com.hazelcast.jet.JobStateSnapshot)2 JobConfig (com.hazelcast.jet.config.JobConfig)2