use of io.confluent.ksql.parser.tree.JoinedSource in project ksql by confluentinc.
the class SqlFormatterTest method shouldFormatOuterJoinWithoutJoinWindow.
@Test
public void shouldFormatOuterJoinWithoutJoinWindow() {
final Join join = new Join(leftAlias, ImmutableList.of(new JoinedSource(Optional.empty(), rightAlias, JoinedSource.Type.OUTER, criteria, Optional.empty())));
final String expected = "`left` L\nFULL OUTER JOIN `right` R ON (('left.col0' = 'right.col0'))";
assertEquals(expected, SqlFormatter.formatSql(join));
}
use of io.confluent.ksql.parser.tree.JoinedSource in project ksql by confluentinc.
the class SqlFormatterTest method shouldFormatOuterJoin.
@Test
public void shouldFormatOuterJoin() {
final Join join = new Join(leftAlias, ImmutableList.of(new JoinedSource(Optional.empty(), rightAlias, JoinedSource.Type.OUTER, criteria, Optional.of(new WithinExpression(10, TimeUnit.SECONDS)))));
final String expected = "`left` L\nFULL OUTER JOIN `right` R WITHIN 10 SECONDS ON" + " (('left.col0' = 'right.col0'))";
assertEquals(expected, SqlFormatter.formatSql(join));
}
use of io.confluent.ksql.parser.tree.JoinedSource in project ksql by confluentinc.
the class SqlFormatterTest method shouldFormatLeftJoinWithoutJoinWindow.
@Test
public void shouldFormatLeftJoinWithoutJoinWindow() {
final Join join = new Join(leftAlias, ImmutableList.of(new JoinedSource(Optional.empty(), rightAlias, JoinedSource.Type.LEFT, criteria, Optional.empty())));
final String result = SqlFormatter.formatSql(join);
final String expected = "`left` L\nLEFT OUTER JOIN `right` R ON (('left.col0' = 'right.col0'))";
assertEquals(expected, result);
}
use of io.confluent.ksql.parser.tree.JoinedSource in project ksql by confluentinc.
the class SqlFormatterTest method shouldFormatMultipleLeftJoinWithWithin.
@Test
public void shouldFormatMultipleLeftJoinWithWithin() {
final List<JoinedSource> rights = ImmutableList.of(new JoinedSource(Optional.empty(), rightAlias, JoinedSource.Type.LEFT, criteria, Optional.of(new WithinExpression(10, TimeUnit.SECONDS))), new JoinedSource(Optional.empty(), right2Alias, JoinedSource.Type.LEFT, criteria2, Optional.of(new WithinExpression(10, TimeUnit.SECONDS))));
final Join join = new Join(leftAlias, rights);
final String expected = "`left` L" + "\nLEFT OUTER JOIN `right` R WITHIN 10 SECONDS ON (('left.col0' = 'right.col0'))" + "\nLEFT OUTER JOIN `right2` R2 WITHIN 10 SECONDS ON (('left.col0' = 'right2.col0'))";
assertEquals(expected, SqlFormatter.formatSql(join));
}
use of io.confluent.ksql.parser.tree.JoinedSource in project ksql by confluentinc.
the class SqlFormatterTest method shouldFormatInnerJoinWithoutJoinWindow.
@Test
public void shouldFormatInnerJoinWithoutJoinWindow() {
final Join join = new Join(leftAlias, ImmutableList.of(new JoinedSource(Optional.empty(), rightAlias, JoinedSource.Type.INNER, criteria, Optional.empty())));
final String expected = "`left` L\nINNER JOIN `right` R ON (('left.col0' = 'right.col0'))";
assertEquals(expected, SqlFormatter.formatSql(join));
}
Aggregations