Search in sources :

Example 1 with SCHEMA

use of io.confluent.ksql.execution.testutil.TestExpressions.SCHEMA in project ksql by confluentinc.

the class SqlToJavaVisitorTest method init.

@Before
public void init() {
    final AtomicInteger funCounter = new AtomicInteger();
    final AtomicInteger structCounter = new AtomicInteger();
    ksqlConfig = new KsqlConfig(Collections.emptyMap());
    sqlToJavaVisitor = new SqlToJavaVisitor(SCHEMA, functionRegistry, ref -> ref.text().replace(".", "_"), name -> name.text() + "_" + funCounter.getAndIncrement(), struct -> "schema" + structCounter.getAndIncrement(), ksqlConfig);
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) COL0(io.confluent.ksql.execution.testutil.TestExpressions.COL0) COL1(io.confluent.ksql.execution.testutil.TestExpressions.COL1) ArithmeticBinaryExpression(io.confluent.ksql.execution.expression.tree.ArithmeticBinaryExpression) UdfFactory(io.confluent.ksql.function.UdfFactory) Time(java.sql.Time) ColumnName(io.confluent.ksql.name.ColumnName) COL7(io.confluent.ksql.execution.testutil.TestExpressions.COL7) COL3(io.confluent.ksql.execution.testutil.TestExpressions.COL3) StringLiteral(io.confluent.ksql.execution.expression.tree.StringLiteral) BigDecimal(java.math.BigDecimal) DateLiteral(io.confluent.ksql.execution.expression.tree.DateLiteral) UdfMetadata(io.confluent.ksql.function.udf.UdfMetadata) IntegerLiteral(io.confluent.ksql.execution.expression.tree.IntegerLiteral) LambdaFunctionCall(io.confluent.ksql.execution.expression.tree.LambdaFunctionCall) DoubleLiteral(io.confluent.ksql.execution.expression.tree.DoubleLiteral) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) DATECOL(io.confluent.ksql.execution.testutil.TestExpressions.DATECOL) IntervalUnit(io.confluent.ksql.execution.expression.tree.IntervalUnit) DecimalLiteral(io.confluent.ksql.execution.expression.tree.DecimalLiteral) SCHEMA(io.confluent.ksql.execution.testutil.TestExpressions.SCHEMA) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) LambdaVariable(io.confluent.ksql.execution.expression.tree.LambdaVariable) ImmutableMap(com.google.common.collect.ImmutableMap) Expression(io.confluent.ksql.execution.expression.tree.Expression) FunctionRegistry(io.confluent.ksql.function.FunctionRegistry) CreateMapExpression(io.confluent.ksql.execution.expression.tree.CreateMapExpression) WhenClause(io.confluent.ksql.execution.expression.tree.WhenClause) KsqlConfig(io.confluent.ksql.util.KsqlConfig) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) TIMESTAMPCOL(io.confluent.ksql.execution.testutil.TestExpressions.TIMESTAMPCOL) LambdaType(io.confluent.ksql.function.types.LambdaType) CastEvaluator(io.confluent.ksql.execution.codegen.helpers.CastEvaluator) Sign(io.confluent.ksql.execution.expression.tree.ArithmeticUnaryExpression.Sign) Operator(io.confluent.ksql.schema.Operator) BYTESCOL(io.confluent.ksql.execution.testutil.TestExpressions.BYTESCOL) KsqlException(io.confluent.ksql.util.KsqlException) Optional(java.util.Optional) ARRAYCOL(io.confluent.ksql.execution.testutil.TestExpressions.ARRAYCOL) ArithmeticUnaryExpression(io.confluent.ksql.execution.expression.tree.ArithmeticUnaryExpression) Mockito.mock(org.mockito.Mockito.mock) GenericType(io.confluent.ksql.function.types.GenericType) TestExpressions.literal(io.confluent.ksql.execution.testutil.TestExpressions.literal) Optional.empty(java.util.Optional.empty) KsqlScalarFunction(io.confluent.ksql.function.KsqlScalarFunction) MAPCOL(io.confluent.ksql.execution.testutil.TestExpressions.MAPCOL) SqlPrimitiveType(io.confluent.ksql.schema.ksql.types.SqlPrimitiveType) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) Mock(org.mockito.Mock) Assert.assertThrows(org.junit.Assert.assertThrows) CreateArrayExpression(io.confluent.ksql.execution.expression.tree.CreateArrayExpression) UnqualifiedColumnReferenceExp(io.confluent.ksql.execution.expression.tree.UnqualifiedColumnReferenceExp) Field(io.confluent.ksql.execution.expression.tree.CreateStructExpression.Field) SourceName.of(io.confluent.ksql.name.SourceName.of) ImmutableList(com.google.common.collect.ImmutableList) Cast(io.confluent.ksql.execution.expression.tree.Cast) QualifiedColumnReferenceExp(io.confluent.ksql.execution.expression.tree.QualifiedColumnReferenceExp) MockitoJUnit(org.mockito.junit.MockitoJUnit) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) SqlType(io.confluent.ksql.schema.ksql.types.SqlType) TimeLiteral(io.confluent.ksql.execution.expression.tree.TimeLiteral) CreateStructExpression(io.confluent.ksql.execution.expression.tree.CreateStructExpression) Before(org.junit.Before) FunctionName(io.confluent.ksql.name.FunctionName) ParamTypes(io.confluent.ksql.function.types.ParamTypes) LikePredicate(io.confluent.ksql.execution.expression.tree.LikePredicate) InPredicate(io.confluent.ksql.execution.expression.tree.InPredicate) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) Type(io.confluent.ksql.execution.expression.tree.ComparisonExpression.Type) TIMECOL(io.confluent.ksql.execution.testutil.TestExpressions.TIMECOL) Date(java.sql.Date) TimeUnit(java.util.concurrent.TimeUnit) FunctionCall(io.confluent.ksql.execution.expression.tree.FunctionCall) SimpleCaseExpression(io.confluent.ksql.execution.expression.tree.SimpleCaseExpression) SubscriptExpression(io.confluent.ksql.execution.expression.tree.SubscriptExpression) Rule(org.junit.Rule) InListExpression(io.confluent.ksql.execution.expression.tree.InListExpression) ComparisonExpression(io.confluent.ksql.execution.expression.tree.ComparisonExpression) ArrayType(io.confluent.ksql.function.types.ArrayType) SearchedCaseExpression(io.confluent.ksql.execution.expression.tree.SearchedCaseExpression) MockitoRule(org.mockito.junit.MockitoRule) SqlTypes(io.confluent.ksql.schema.ksql.types.SqlTypes) Collections(java.util.Collections) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) KsqlConfig(io.confluent.ksql.util.KsqlConfig) Before(org.junit.Before)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 CastEvaluator (io.confluent.ksql.execution.codegen.helpers.CastEvaluator)1 ArithmeticBinaryExpression (io.confluent.ksql.execution.expression.tree.ArithmeticBinaryExpression)1 ArithmeticUnaryExpression (io.confluent.ksql.execution.expression.tree.ArithmeticUnaryExpression)1 Sign (io.confluent.ksql.execution.expression.tree.ArithmeticUnaryExpression.Sign)1 Cast (io.confluent.ksql.execution.expression.tree.Cast)1 ComparisonExpression (io.confluent.ksql.execution.expression.tree.ComparisonExpression)1 Type (io.confluent.ksql.execution.expression.tree.ComparisonExpression.Type)1 CreateArrayExpression (io.confluent.ksql.execution.expression.tree.CreateArrayExpression)1 CreateMapExpression (io.confluent.ksql.execution.expression.tree.CreateMapExpression)1 CreateStructExpression (io.confluent.ksql.execution.expression.tree.CreateStructExpression)1 Field (io.confluent.ksql.execution.expression.tree.CreateStructExpression.Field)1 DateLiteral (io.confluent.ksql.execution.expression.tree.DateLiteral)1 DecimalLiteral (io.confluent.ksql.execution.expression.tree.DecimalLiteral)1 DoubleLiteral (io.confluent.ksql.execution.expression.tree.DoubleLiteral)1 Expression (io.confluent.ksql.execution.expression.tree.Expression)1 FunctionCall (io.confluent.ksql.execution.expression.tree.FunctionCall)1 InListExpression (io.confluent.ksql.execution.expression.tree.InListExpression)1 InPredicate (io.confluent.ksql.execution.expression.tree.InPredicate)1