Search in sources :

Example 66 with Type

use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.

the class SqlTypeParserTest method shouldGetTypeFromDecimal.

@Test
public void shouldGetTypeFromDecimal() {
    // Given:
    final String schemaString = "DECIMAL(2, 1)";
    // When:
    final Type type = parser.parse(schemaString);
    // Then:
    assertThat(type, is(new Type(SqlTypes.decimal(2, 1))));
}
Also used : Type(io.confluent.ksql.execution.expression.tree.Type) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 67 with Type

use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.

the class SqlTypeParserTest method shouldGetTypeFromStruct.

@Test
public void shouldGetTypeFromStruct() {
    // Given:
    final String schemaString = "STRUCT<A VARCHAR>";
    // When:
    final Type type = parser.parse(schemaString);
    // Then:
    assertThat(type, is(new Type(SqlTypes.struct().field("A", SqlTypes.STRING).build())));
}
Also used : Type(io.confluent.ksql.execution.expression.tree.Type) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 68 with Type

use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.

the class SqlTypeParserTest method shouldGetTypeFromStringArray.

@Test
public void shouldGetTypeFromStringArray() {
    // Given:
    final String schemaString = "ARRAY<VARCHAR>";
    // When:
    final Type type = parser.parse(schemaString);
    // Then:
    assertThat(type, is(new Type(SqlTypes.array(SqlTypes.STRING))));
}
Also used : Type(io.confluent.ksql.execution.expression.tree.Type) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 69 with Type

use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.

the class SqlTypeParserTest method shouldGetTypeFromVarchar.

@Test
public void shouldGetTypeFromVarchar() {
    // Given:
    final String schemaString = "VARCHAR";
    // When:
    final Type type = parser.parse(schemaString);
    // Then:
    assertThat(type, is(new Type(SqlTypes.STRING)));
}
Also used : Type(io.confluent.ksql.execution.expression.tree.Type) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 70 with Type

use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.

the class SqlTypeParserTest method shouldGetTypeFromMap.

@Test
public void shouldGetTypeFromMap() {
    // Given:
    final String schemaString = "MAP<BIGINT, INT>";
    // When:
    final Type type = parser.parse(schemaString);
    // Then:
    assertThat(type, is(new Type(SqlTypes.map(SqlTypes.BIGINT, SqlTypes.INTEGER))));
}
Also used : Type(io.confluent.ksql.execution.expression.tree.Type) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Aggregations

Type (io.confluent.ksql.execution.expression.tree.Type)73 Test (org.junit.Test)71 SqlPrimitiveType (io.confluent.ksql.schema.ksql.types.SqlPrimitiveType)23 DataSourceType (io.confluent.ksql.metastore.model.DataSource.DataSourceType)19 Matchers.containsString (org.hamcrest.Matchers.containsString)16 Cast (io.confluent.ksql.execution.expression.tree.Cast)13 CreateStream (io.confluent.ksql.parser.tree.CreateStream)13 ArithmeticBinaryExpression (io.confluent.ksql.execution.expression.tree.ArithmeticBinaryExpression)12 ArithmeticUnaryExpression (io.confluent.ksql.execution.expression.tree.ArithmeticUnaryExpression)12 ComparisonExpression (io.confluent.ksql.execution.expression.tree.ComparisonExpression)12 CreateArrayExpression (io.confluent.ksql.execution.expression.tree.CreateArrayExpression)12 CreateMapExpression (io.confluent.ksql.execution.expression.tree.CreateMapExpression)12 CreateStructExpression (io.confluent.ksql.execution.expression.tree.CreateStructExpression)12 DereferenceExpression (io.confluent.ksql.execution.expression.tree.DereferenceExpression)12 Expression (io.confluent.ksql.execution.expression.tree.Expression)12 InListExpression (io.confluent.ksql.execution.expression.tree.InListExpression)12 LogicalBinaryExpression (io.confluent.ksql.execution.expression.tree.LogicalBinaryExpression)12 SearchedCaseExpression (io.confluent.ksql.execution.expression.tree.SearchedCaseExpression)12 StringLiteral (io.confluent.ksql.execution.expression.tree.StringLiteral)12 SubscriptExpression (io.confluent.ksql.execution.expression.tree.SubscriptExpression)12