Search in sources :

Example 61 with SqlRow

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());
}
Also used : SqlRow(com.hazelcast.sql.SqlRow) SqlRowMetadata(com.hazelcast.sql.SqlRowMetadata) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 62 with SqlRow

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());
}
Also used : SqlRow(com.hazelcast.sql.SqlRow) SqlRowMetadata(com.hazelcast.sql.SqlRowMetadata) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 63 with SqlRow

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());
}
Also used : SqlRow(com.hazelcast.sql.SqlRow) SqlRowMetadata(com.hazelcast.sql.SqlRowMetadata) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 64 with SqlRow

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());
}
Also used : SqlRow(com.hazelcast.sql.SqlRow) SqlRowMetadata(com.hazelcast.sql.SqlRowMetadata) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 65 with SqlRow

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());
}
Also used : SqlRow(com.hazelcast.sql.SqlRow) SqlRowMetadata(com.hazelcast.sql.SqlRowMetadata) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

SqlRow (com.hazelcast.sql.SqlRow)65 Test (org.junit.Test)35 SqlResult (com.hazelcast.sql.SqlResult)29 QuickTest (com.hazelcast.test.annotation.QuickTest)25 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)17 SqlRowMetadata (com.hazelcast.sql.SqlRowMetadata)13 HazelcastSqlException (com.hazelcast.sql.HazelcastSqlException)11 ArrayList (java.util.ArrayList)10 HazelcastInstance (com.hazelcast.core.HazelcastInstance)8 SqlStatement (com.hazelcast.sql.SqlStatement)7 SqlService (com.hazelcast.sql.SqlService)5 HashSet (java.util.HashSet)5 SqlColumnType (com.hazelcast.sql.SqlColumnType)3 ClientConfig (com.hazelcast.client.config.ClientConfig)2 Config (com.hazelcast.config.Config)2 IndexConfig (com.hazelcast.config.IndexConfig)2 HazelcastException (com.hazelcast.core.HazelcastException)2 ExpressionBiValue (com.hazelcast.jet.sql.impl.support.expressions.ExpressionBiValue)2 IMap (com.hazelcast.map.IMap)2 SqlColumnMetadata (com.hazelcast.sql.SqlColumnMetadata)2