use of com.hazelcast.sql.SqlRow in project hazelcast by hazelcast.
the class SqlInsertWindowBoundsTest method test_windowBoundsSameTypeAsDescriptor_BIGINT.
@Test
public void test_windowBoundsSameTypeAsDescriptor_BIGINT() {
String name = randomName();
TestStreamSqlConnector.create(sqlService, name, asList("ts", "name"), asList(BIGINT, VARCHAR), row(1L, "Alice"), row(10L, 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.BIGINT);
assertThat((Object) row.getObject(0)).isInstanceOf(SqlColumnType.BIGINT.getValueClass());
assertThat(metadata.getColumn(1).getType()).isEqualTo(SqlColumnType.BIGINT);
assertThat((Object) row.getObject(1)).isInstanceOf(SqlColumnType.BIGINT.getValueClass());
assertThat(metadata.getColumn(2).getType()).isEqualTo(SqlColumnType.BIGINT);
assertThat((Object) row.getObject(2)).isInstanceOf(SqlColumnType.BIGINT.getValueClass());
}
use of com.hazelcast.sql.SqlRow in project hazelcast by hazelcast.
the class SqlInsertWindowBoundsTest method test_windowBoundsSameTypeAsDescriptor_TINYINT.
@Test
public void test_windowBoundsSameTypeAsDescriptor_TINYINT() {
String name = randomName();
TestStreamSqlConnector.create(sqlService, name, asList("ts", "name"), asList(TINYINT, VARCHAR), row((byte) 1, "Alice"), row((byte) 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.TINYINT);
assertThat((Object) row.getObject(0)).isInstanceOf(SqlColumnType.TINYINT.getValueClass());
assertThat(metadata.getColumn(1).getType()).isEqualTo(SqlColumnType.TINYINT);
assertThat((Object) row.getObject(1)).isInstanceOf(SqlColumnType.TINYINT.getValueClass());
assertThat(metadata.getColumn(2).getType()).isEqualTo(SqlColumnType.TINYINT);
assertThat((Object) row.getObject(2)).isInstanceOf(SqlColumnType.TINYINT.getValueClass());
}
use of com.hazelcast.sql.SqlRow 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());
}
use of com.hazelcast.sql.SqlRow 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());
}
use of com.hazelcast.sql.SqlRow 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());
}
Aggregations