use of io.confluent.ksql.execution.expression.tree.QualifiedColumnReferenceExp in project ksql by confluentinc.
the class ProjectionTest method shouldNotMatchUnqualifiedColumnToQualifiedSingleColumn.
@Test
public void shouldNotMatchUnqualifiedColumnToQualifiedSingleColumn() {
// Given:
final Projection projection = Projection.of(ImmutableList.of(new SingleColumn(new UnqualifiedColumnReferenceExp(COL0), Optional.empty())));
// Then:
assertThat(projection.containsExpression(new QualifiedColumnReferenceExp(A, COL0)), is(false));
}
use of io.confluent.ksql.execution.expression.tree.QualifiedColumnReferenceExp in project ksql by confluentinc.
the class ExpressionFormatterTest method shouldFormatQualifiedColumnReference.
@Test
public void shouldFormatQualifiedColumnReference() {
final QualifiedColumnReferenceExp ref = new QualifiedColumnReferenceExp(SourceName.of("foo"), ColumnName.of("bar"));
assertThat(ExpressionFormatter.formatExpression(ref), equalTo("foo.bar"));
}
use of io.confluent.ksql.execution.expression.tree.QualifiedColumnReferenceExp in project ksql by confluentinc.
the class SqlToJavaVisitorTest method shouldThrowOnQualifiedColumnReference.
@Test
public void shouldThrowOnQualifiedColumnReference() {
// Given:
final Expression expression = new QualifiedColumnReferenceExp(of("foo"), ColumnName.of("bar"));
// When:
assertThrows(UnsupportedOperationException.class, () -> sqlToJavaVisitor.process(expression));
}
use of io.confluent.ksql.execution.expression.tree.QualifiedColumnReferenceExp in project ksql by confluentinc.
the class ColumnReferenceValidatorTest method shouldGetSourceForUnqualifiedColumnRef.
@Test
public void shouldGetSourceForUnqualifiedColumnRef() {
// Given:
final ColumnName column = ColumnName.of("qualified");
final Expression expression = new QualifiedColumnReferenceExp(SourceName.of("fully"), column);
when(sourceSchemas.sourcesWithField(any(), any())).thenReturn(sourceNames("something"));
// When:
analyzer.analyzeExpression(expression, CLAUSE_TYPE);
// Then:
verify(sourceSchemas).sourcesWithField(Optional.of(SourceName.of("fully")), column);
}
use of io.confluent.ksql.execution.expression.tree.QualifiedColumnReferenceExp in project ksql by confluentinc.
the class ColumnReferenceValidatorTest method shouldGetSourceForQualifiedColumnRef.
@Test
public void shouldGetSourceForQualifiedColumnRef() {
// Given:
final QualifiedColumnReferenceExp expression = new QualifiedColumnReferenceExp(SourceName.of("something"), ColumnName.of("else"));
when(sourceSchemas.sourcesWithField(any(), any())).thenReturn(ImmutableSet.of(SourceName.of("something")));
// When:
final Set<SourceName> columnRefs = analyzer.analyzeExpression(expression, CLAUSE_TYPE);
// Then:
verify(sourceSchemas).sourcesWithField(Optional.of(expression.getQualifier()), expression.getColumnName());
assertThat(Iterables.getOnlyElement(columnRefs), is(SourceName.of("something")));
}
Aggregations