From b78619c6e01421b06af0572840a6af53cfe05609 Mon Sep 17 00:00:00 2001 From: Almog Gavra Date: Thu, 26 Sep 2019 15:00:36 -0700 Subject: [PATCH] feat: remove equalsIgnoreCase from all Name classes (MINOR) (#3411) --- .../java/io/confluent/ksql/name/Name.java | 14 ----- .../ksql/schema/ksql/FormatOptions.java | 6 +++ .../ksql/schema/ksql/LogicalSchema.java | 2 +- .../ksql/schema/ksql/LogicalSchemaTest.java | 2 +- .../io/confluent/ksql/analyzer/Analyzer.java | 6 +-- .../ksql/analyzer/SourceSchemas.java | 2 +- .../ksql/ddl/commands/CommandFactories.java | 4 +- .../ksql/physical/PhysicalPlanBuilder.java | 2 +- .../ksql/analyzer/AnalyzerFunctionalTest.java | 12 ++--- .../util/ExpressionTypeManagerTest.java | 2 +- .../io/confluent/ksql/parser/AstBuilder.java | 12 ++--- .../confluent/ksql/parser/KsqlParserTest.java | 52 +++++++++---------- .../server/execution/ListSourceExecutor.java | 4 +- 13 files changed, 56 insertions(+), 64 deletions(-) diff --git a/ksql-common/src/main/java/io/confluent/ksql/name/Name.java b/ksql-common/src/main/java/io/confluent/ksql/name/Name.java index a330c24091bd..75175fc369dc 100644 --- a/ksql-common/src/main/java/io/confluent/ksql/name/Name.java +++ b/ksql-common/src/main/java/io/confluent/ksql/name/Name.java @@ -42,20 +42,6 @@ public String name() { return name; } - /** - * @see String#equalsIgnoreCase(String) - */ - public boolean equalsIgnoreCase(final T o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - return name.equalsIgnoreCase(o.name()); - } - public boolean startsWith(final T o) { if (this == o) { return true; diff --git a/ksql-common/src/main/java/io/confluent/ksql/schema/ksql/FormatOptions.java b/ksql-common/src/main/java/io/confluent/ksql/schema/ksql/FormatOptions.java index 53f7ce6c08fe..705369d4a2b3 100644 --- a/ksql-common/src/main/java/io/confluent/ksql/schema/ksql/FormatOptions.java +++ b/ksql-common/src/main/java/io/confluent/ksql/schema/ksql/FormatOptions.java @@ -28,6 +28,12 @@ public static FormatOptions none() { return new FormatOptions(word -> true); } + /** + * @return options that escape nothing + * @apiNote this is dangerous and could cause reserved identifiers + * to be mangled. Use this API sparingly (e.g. in logging error + * messages) + */ public static FormatOptions noEscape() { return new FormatOptions(word -> false); } diff --git a/ksql-common/src/main/java/io/confluent/ksql/schema/ksql/LogicalSchema.java b/ksql-common/src/main/java/io/confluent/ksql/schema/ksql/LogicalSchema.java index 684cad2562e4..cbf496efee41 100644 --- a/ksql-common/src/main/java/io/confluent/ksql/schema/ksql/LogicalSchema.java +++ b/ksql-common/src/main/java/io/confluent/ksql/schema/ksql/LogicalSchema.java @@ -131,7 +131,7 @@ public Optional findColumn(final ColumnName columnName) { } @VisibleForTesting - public Optional findColumn(final String columnName) { + private Optional findColumn(final String columnName) { Optional found = doFindColumn(columnName, metadata); if (found.isPresent()) { return found; diff --git a/ksql-common/src/test/java/io/confluent/ksql/schema/ksql/LogicalSchemaTest.java b/ksql-common/src/test/java/io/confluent/ksql/schema/ksql/LogicalSchemaTest.java index c97bb209552f..55c3ac607162 100644 --- a/ksql-common/src/test/java/io/confluent/ksql/schema/ksql/LogicalSchemaTest.java +++ b/ksql-common/src/test/java/io/confluent/ksql/schema/ksql/LogicalSchemaTest.java @@ -268,7 +268,7 @@ public void shouldGetKeyFieldFromValueIfAdded() { @Test public void shouldGetMetaFields() { - assertThat(SOME_SCHEMA.findColumn("ROWTIME"), is(Optional.of( + assertThat(SOME_SCHEMA.findColumn(ROWTIME_NAME), is(Optional.of( Column.of(ROWTIME_NAME, SqlTypes.BIGINT) ))); } diff --git a/ksql-engine/src/main/java/io/confluent/ksql/analyzer/Analyzer.java b/ksql-engine/src/main/java/io/confluent/ksql/analyzer/Analyzer.java index 11e7ef26fc52..84fea949d639 100644 --- a/ksql-engine/src/main/java/io/confluent/ksql/analyzer/Analyzer.java +++ b/ksql-engine/src/main/java/io/confluent/ksql/analyzer/Analyzer.java @@ -268,8 +268,8 @@ private List getNoneMetaOrKeySelectAliases() { } final ColumnName columnName = select.getName(); - if (columnName.equalsIgnoreCase(SchemaUtil.ROWTIME_NAME) - || columnName.equalsIgnoreCase(SchemaUtil.ROWKEY_NAME)) { + if (columnName.equals(SchemaUtil.ROWTIME_NAME) + || columnName.equals(SchemaUtil.ROWKEY_NAME)) { columnNames.remove(idx); } } @@ -473,7 +473,7 @@ private Optional getJoinFieldNameFromExpr( final SourceName sourceAlias ) { if (nameRef.getReference().qualifier().isPresent() - && !nameRef.getReference().qualifier().get().equalsIgnoreCase(sourceAlias)) { + && !nameRef.getReference().qualifier().get().equals(sourceAlias)) { return Optional.empty(); } diff --git a/ksql-engine/src/main/java/io/confluent/ksql/analyzer/SourceSchemas.java b/ksql-engine/src/main/java/io/confluent/ksql/analyzer/SourceSchemas.java index 286019fe794b..aa8eb6e4ff87 100644 --- a/ksql-engine/src/main/java/io/confluent/ksql/analyzer/SourceSchemas.java +++ b/ksql-engine/src/main/java/io/confluent/ksql/analyzer/SourceSchemas.java @@ -79,7 +79,7 @@ Set sourcesWithField(final ColumnName columnName) { return ImmutableSet.of(); } - return sourceSchema.findColumn(baseColumnName).isPresent() + return sourceSchema.findColumn(ColumnName.of(baseColumnName)).isPresent() ? ImmutableSet.of(sourceName) : ImmutableSet.of(); } diff --git a/ksql-engine/src/main/java/io/confluent/ksql/ddl/commands/CommandFactories.java b/ksql-engine/src/main/java/io/confluent/ksql/ddl/commands/CommandFactories.java index fe679d8bc47e..d0ca496beda5 100644 --- a/ksql-engine/src/main/java/io/confluent/ksql/ddl/commands/CommandFactories.java +++ b/ksql-engine/src/main/java/io/confluent/ksql/ddl/commands/CommandFactories.java @@ -271,11 +271,11 @@ private static LogicalSchema buildSchema(final TableElements tableElements) { } tableElements.forEach(e -> { - if (e.getName().equalsIgnoreCase(SchemaUtil.ROWTIME_NAME)) { + if (e.getName().equals(SchemaUtil.ROWTIME_NAME)) { throw new KsqlException("'" + e.getName().name() + "' is a reserved column name."); } - final boolean isRowKey = e.getName().equalsIgnoreCase(SchemaUtil.ROWKEY_NAME); + final boolean isRowKey = e.getName().equals(SchemaUtil.ROWKEY_NAME); if (e.getNamespace() == Namespace.KEY) { if (!isRowKey) { diff --git a/ksql-engine/src/main/java/io/confluent/ksql/physical/PhysicalPlanBuilder.java b/ksql-engine/src/main/java/io/confluent/ksql/physical/PhysicalPlanBuilder.java index a0a9c71b2ac1..6d5471662cbc 100644 --- a/ksql-engine/src/main/java/io/confluent/ksql/physical/PhysicalPlanBuilder.java +++ b/ksql-engine/src/main/java/io/confluent/ksql/physical/PhysicalPlanBuilder.java @@ -478,7 +478,7 @@ private static void enforceKeyEquivalence( if (sinkKeyCol.isPresent() && resultKeyCol.isPresent() - && sinkKeyCol.get().name().equalsIgnoreCase(resultKeyCol.get().name()) + && sinkKeyCol.get().name().equals(resultKeyCol.get().name()) && Objects.equals(sinkKeyCol.get().type(), resultKeyCol.get().type())) { return; } diff --git a/ksql-engine/src/test/java/io/confluent/ksql/analyzer/AnalyzerFunctionalTest.java b/ksql-engine/src/test/java/io/confluent/ksql/analyzer/AnalyzerFunctionalTest.java index 3c1c9cacd0dc..aa588ac8df15 100644 --- a/ksql-engine/src/test/java/io/confluent/ksql/analyzer/AnalyzerFunctionalTest.java +++ b/ksql-engine/src/test/java/io/confluent/ksql/analyzer/AnalyzerFunctionalTest.java @@ -21,6 +21,7 @@ import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; @@ -134,9 +135,9 @@ public void init() { public void testSimpleQueryAnalysis() { final String simpleQuery = "SELECT col0, col2, col3 FROM test1 WHERE col0 > 100 EMIT CHANGES;"; final Analysis analysis = analyzeQuery(simpleQuery, jsonMetaStore); - Assert.assertTrue("FROM was not analyzed correctly.", - analysis.getFromDataSources().get(0).getDataSource().getName() - .equalsIgnoreCase(SourceName.of("test1"))); + assertEquals("FROM was not analyzed correctly.", + analysis.getFromDataSources().get(0).getDataSource().getName(), + SourceName.of("TEST1")); assertThat(analysis.getWhereExpression().get().toString(), is("(TEST1.COL0 > 100)")); final List selects = analysis.getSelectExpressions(); @@ -201,9 +202,8 @@ public void testBooleanExpressionAnalysis() { final String queryStr = "SELECT col0 = 10, col2, col3 > col1 FROM test1 EMIT CHANGES;"; final Analysis analysis = analyzeQuery(queryStr, jsonMetaStore); - Assert.assertTrue("FROM was not analyzed correctly.", - analysis.getFromDataSources().get(0).getDataSource().getName() - .equalsIgnoreCase(SourceName.of("test1"))); + assertEquals("FROM was not analyzed correctly.", + analysis.getFromDataSources().get(0).getDataSource().getName(), SourceName.of("TEST1")); final List selects = analysis.getSelectExpressions(); assertThat(selects.get(0).getExpression().toString(), is("(TEST1.COL0 = 10)")); diff --git a/ksql-execution/src/test/java/io/confluent/ksql/execution/util/ExpressionTypeManagerTest.java b/ksql-execution/src/test/java/io/confluent/ksql/execution/util/ExpressionTypeManagerTest.java index ef6558ff9785..d7b2f645e61c 100644 --- a/ksql-execution/src/test/java/io/confluent/ksql/execution/util/ExpressionTypeManagerTest.java +++ b/ksql-execution/src/test/java/io/confluent/ksql/execution/util/ExpressionTypeManagerTest.java @@ -397,7 +397,7 @@ public void shouldGetCorrectSchemaForSearchedCaseWhenStruct() { final SqlType result = expressionTypeManager.getExpressionSqlType(expression); // Then: - final SqlType sqlType = SCHEMA.findColumn(ADDRESS.toString()).get().type(); + final SqlType sqlType = SCHEMA.findColumn(ColumnName.of(ADDRESS.toString())).get().type(); assertThat(result, is(sqlType)); } diff --git a/ksql-parser/src/main/java/io/confluent/ksql/parser/AstBuilder.java b/ksql-parser/src/main/java/io/confluent/ksql/parser/AstBuilder.java index 4c207ab858eb..bb26aecc69d5 100644 --- a/ksql-parser/src/main/java/io/confluent/ksql/parser/AstBuilder.java +++ b/ksql-parser/src/main/java/io/confluent/ksql/parser/AstBuilder.java @@ -1037,14 +1037,14 @@ public Node visitColumnReference(final SqlBaseParser.ColumnReferenceContext cont private boolean isValidNameOrAlias(final SourceName name) { if (dataSourceExtractor.isJoin()) { - final boolean sameAsLeft = name.equalsIgnoreCase(dataSourceExtractor.getLeftAlias()) - || name.equalsIgnoreCase(dataSourceExtractor.getLeftName()); - final boolean sameAsRight = name.equalsIgnoreCase(dataSourceExtractor.getRightAlias()) - || name.equalsIgnoreCase(dataSourceExtractor.getRightName()); + final boolean sameAsLeft = name.equals(dataSourceExtractor.getLeftAlias()) + || name.equals(dataSourceExtractor.getLeftName()); + final boolean sameAsRight = name.equals(dataSourceExtractor.getRightAlias()) + || name.equals(dataSourceExtractor.getRightName()); return sameAsLeft || sameAsRight; } - return ((name.equalsIgnoreCase(dataSourceExtractor.getFromAlias()) - || name.equalsIgnoreCase(dataSourceExtractor.getFromName()))); + return ((name.equals(dataSourceExtractor.getFromAlias()) + || name.equals(dataSourceExtractor.getFromName()))); } @Override diff --git a/ksql-parser/src/test/java/io/confluent/ksql/parser/KsqlParserTest.java b/ksql-parser/src/test/java/io/confluent/ksql/parser/KsqlParserTest.java index eea027883e23..0b48ed4ec6c2 100644 --- a/ksql-parser/src/test/java/io/confluent/ksql/parser/KsqlParserTest.java +++ b/ksql-parser/src/test/java/io/confluent/ksql/parser/KsqlParserTest.java @@ -212,8 +212,8 @@ public void testProjection() { Assert.assertTrue(query.getSelect().getSelectItems().size() == 3); Assert.assertTrue(query.getSelect().getSelectItems().get(0) instanceof SingleColumn); final SingleColumn column0 = (SingleColumn)query.getSelect().getSelectItems().get(0); - Assert.assertTrue(column0.getAlias().equalsIgnoreCase(ColumnName.of("COL0"))); - Assert.assertTrue(column0.getExpression().toString().equalsIgnoreCase("TEST1.COL0")); + Assert.assertTrue(column0.getAlias().equals(ColumnName.of("COL0"))); + Assert.assertTrue(column0.getExpression().toString().equals("TEST1.COL0")); } @Test @@ -227,15 +227,15 @@ public void testProjectionWithArrayMap() { Assert.assertTrue(query.getSelect().getSelectItems().get(0) instanceof SingleColumn); final SingleColumn column0 = (SingleColumn)query.getSelect().getSelectItems().get(0); Assert.assertTrue("testProjectionWithArrayMap fails", - column0.getAlias().equalsIgnoreCase(ColumnName.of("COL0"))); - Assert.assertTrue(column0.getExpression().toString().equalsIgnoreCase("TEST1.COL0")); + column0.getAlias().equals(ColumnName.of("COL0"))); + Assert.assertTrue(column0.getExpression().toString().equals("TEST1.COL0")); final SingleColumn column3 = (SingleColumn)query.getSelect().getSelectItems().get(3); final SingleColumn column4 = (SingleColumn)query.getSelect().getSelectItems().get(4); Assert.assertTrue(column3.getExpression().toString() - .equalsIgnoreCase("TEST1.COL4[0]")); + .equals("TEST1.COL4[0]")); Assert.assertTrue(column4.getExpression().toString() - .equalsIgnoreCase("TEST1.COL5['key1']")); + .equals("TEST1.COL5['key1']")); } @Test @@ -259,7 +259,7 @@ public void testBinaryExpression() { Assert.assertTrue(statement instanceof Query); final Query query = (Query) statement; final SingleColumn column0 = (SingleColumn)query.getSelect().getSelectItems().get(0); - Assert.assertTrue(column0.getAlias().equalsIgnoreCase(ColumnName.of("KSQL_COL_0"))); + Assert.assertTrue(column0.getAlias().equals(ColumnName.of("KSQL_COL_0"))); Assert.assertTrue(column0.getExpression().toString().equalsIgnoreCase("(TEST1.COL0 + 10)")); } @@ -270,7 +270,7 @@ public void testBooleanExpression() { Assert.assertTrue(statement instanceof Query); final Query query = (Query) statement; final SingleColumn column0 = (SingleColumn)query.getSelect().getSelectItems().get(0); - Assert.assertTrue(column0.getAlias().equalsIgnoreCase(ColumnName.of("KSQL_COL_0"))); + Assert.assertTrue(column0.getAlias().equals(ColumnName.of("KSQL_COL_0"))); Assert.assertTrue(column0.getExpression().toString().equalsIgnoreCase("(TEST1.COL0 = 10)")); } @@ -281,27 +281,27 @@ public void testLiterals() { Assert.assertTrue(statement instanceof Query); final Query query = (Query) statement; final SingleColumn column0 = (SingleColumn)query.getSelect().getSelectItems().get(0); - Assert.assertTrue(column0.getAlias().equalsIgnoreCase(ColumnName.of("KSQL_COL_0"))); + Assert.assertTrue(column0.getAlias().equals(ColumnName.of("KSQL_COL_0"))); Assert.assertTrue(column0.getExpression().toString().equalsIgnoreCase("10")); final SingleColumn column1 = (SingleColumn)query.getSelect().getSelectItems().get(1); - Assert.assertTrue(column1.getAlias().equalsIgnoreCase(ColumnName.of("COL2"))); + Assert.assertTrue(column1.getAlias().equals(ColumnName.of("COL2"))); Assert.assertTrue(column1.getExpression().toString().equalsIgnoreCase("TEST1.COL2")); final SingleColumn column2 = (SingleColumn)query.getSelect().getSelectItems().get(2); - Assert.assertTrue(column2.getAlias().equalsIgnoreCase(ColumnName.of("KSQL_COL_2"))); + Assert.assertTrue(column2.getAlias().equals(ColumnName.of("KSQL_COL_2"))); Assert.assertTrue(column2.getExpression().toString().equalsIgnoreCase("'test'")); final SingleColumn column3 = (SingleColumn)query.getSelect().getSelectItems().get(3); - Assert.assertTrue(column3.getAlias().equalsIgnoreCase(ColumnName.of("KSQL_COL_3"))); + Assert.assertTrue(column3.getAlias().equals(ColumnName.of("KSQL_COL_3"))); Assert.assertTrue(column3.getExpression().toString().equalsIgnoreCase("2.5")); final SingleColumn column4 = (SingleColumn)query.getSelect().getSelectItems().get(4); - Assert.assertTrue(column4.getAlias().equalsIgnoreCase(ColumnName.of("KSQL_COL_4"))); + Assert.assertTrue(column4.getAlias().equals(ColumnName.of("KSQL_COL_4"))); Assert.assertTrue(column4.getExpression().toString().equalsIgnoreCase("true")); final SingleColumn column5 = (SingleColumn)query.getSelect().getSelectItems().get(5); - Assert.assertTrue(column5.getAlias().equalsIgnoreCase(ColumnName.of("KSQL_COL_5"))); + Assert.assertTrue(column5.getAlias().equals(ColumnName.of("KSQL_COL_5"))); Assert.assertTrue(column5.getExpression().toString().equalsIgnoreCase("-5")); } @@ -355,15 +355,15 @@ public void testBooleanLogicalExpression() { Assert.assertTrue(statement instanceof Query); final Query query = (Query) statement; final SingleColumn column0 = (SingleColumn)query.getSelect().getSelectItems().get(0); - Assert.assertTrue(column0.getAlias().equalsIgnoreCase(ColumnName.of("KSQL_COL_0"))); + Assert.assertTrue(column0.getAlias().equals(ColumnName.of("KSQL_COL_0"))); Assert.assertTrue(column0.getExpression().toString().equalsIgnoreCase("10")); final SingleColumn column1 = (SingleColumn)query.getSelect().getSelectItems().get(1); - Assert.assertTrue(column1.getAlias().equalsIgnoreCase(ColumnName.of("COL2"))); + Assert.assertTrue(column1.getAlias().equals(ColumnName.of("COL2"))); Assert.assertTrue(column1.getExpression().toString().equalsIgnoreCase("TEST1.COL2")); final SingleColumn column2 = (SingleColumn)query.getSelect().getSelectItems().get(2); - Assert.assertTrue(column2.getAlias().equalsIgnoreCase(ColumnName.of("KSQL_COL_2"))); + Assert.assertTrue(column2.getAlias().equals(ColumnName.of("KSQL_COL_2"))); Assert.assertTrue(column2.getExpression().toString().equalsIgnoreCase("'test'")); } @@ -397,8 +397,8 @@ public void testSimpleLeftJoin() { final Join join = (Join) query.getFrom(); Assert.assertTrue("testSimpleLeftJoin fails", join.getType().toString().equalsIgnoreCase("LEFT")); - Assert.assertTrue("testSimpleLeftJoin fails", ((AliasedRelation)join.getLeft()).getAlias().equalsIgnoreCase(SourceName.of("T1"))); - Assert.assertTrue("testSimpleLeftJoin fails", ((AliasedRelation)join.getRight()).getAlias().equalsIgnoreCase(SourceName.of("T2"))); + Assert.assertTrue("testSimpleLeftJoin fails", ((AliasedRelation)join.getLeft()).getAlias().equals(SourceName.of("T1"))); + Assert.assertTrue("testSimpleLeftJoin fails", ((AliasedRelation)join.getRight()).getAlias().equals(SourceName.of("T2"))); } @@ -415,8 +415,8 @@ public void testLeftJoinWithFilter() { final Join join = (Join) query.getFrom(); Assert.assertTrue(join.getType().toString().equalsIgnoreCase("LEFT")); - Assert.assertTrue(((AliasedRelation)join.getLeft()).getAlias().equalsIgnoreCase(SourceName.of("T1"))); - Assert.assertTrue(((AliasedRelation)join.getRight()).getAlias().equalsIgnoreCase(SourceName.of("T2"))); + Assert.assertTrue(((AliasedRelation)join.getLeft()).getAlias().equals(SourceName.of("T1"))); + Assert.assertTrue(((AliasedRelation)join.getRight()).getAlias().equals(SourceName.of("T2"))); Assert.assertTrue(query.getWhere().get().toString().equalsIgnoreCase("(T2.COL2 = 'test')")); } @@ -480,15 +480,15 @@ public void testUDF() { final Query query = (Query) statement; final SingleColumn column0 = (SingleColumn)query.getSelect().getSelectItems().get(0); - Assert.assertTrue(column0.getAlias().equalsIgnoreCase(ColumnName.of("KSQL_COL_0"))); + Assert.assertTrue(column0.getAlias().equals(ColumnName.of("KSQL_COL_0"))); Assert.assertTrue(column0.getExpression().toString().equalsIgnoreCase("LCASE(T1.COL1)")); final SingleColumn column1 = (SingleColumn)query.getSelect().getSelectItems().get(1); - Assert.assertTrue(column1.getAlias().equalsIgnoreCase(ColumnName.of("KSQL_COL_1"))); + Assert.assertTrue(column1.getAlias().equals(ColumnName.of("KSQL_COL_1"))); Assert.assertTrue(column1.getExpression().toString().equalsIgnoreCase("CONCAT(T1.COL2, 'hello')")); final SingleColumn column2 = (SingleColumn)query.getSelect().getSelectItems().get(2); - Assert.assertTrue(column2.getAlias().equalsIgnoreCase(ColumnName.of("KSQL_COL_2"))); + Assert.assertTrue(column2.getAlias().equals(ColumnName.of("KSQL_COL_2"))); Assert.assertTrue(column2.getExpression().toString().equalsIgnoreCase("FLOOR(ABS(T1.COL3))")); } @@ -601,7 +601,7 @@ public void testSelectTumblingWindow() { Assert.assertTrue(query.getSelect().getSelectItems ().size() == 2); Assert.assertTrue(query.getWhere().get().toString().equalsIgnoreCase("(ORDERS.ORDERUNITS > 5)")); - Assert.assertTrue(((AliasedRelation)query.getFrom()).getAlias().equalsIgnoreCase(SourceName.of("ORDERS"))); + Assert.assertTrue(((AliasedRelation)query.getFrom()).getAlias().equals(SourceName.of("ORDERS"))); Assert.assertTrue(query.getWindow().isPresent()); Assert.assertTrue(query.getWindow().get().toString().equalsIgnoreCase(" WINDOW STREAMWINDOW TUMBLING ( SIZE 30 SECONDS ) ")); } @@ -641,7 +641,7 @@ public void testSelectSessionWindow() { Assert.assertTrue(query.getSelect().getSelectItems ().size() == 2); Assert.assertTrue(query.getWhere().get().toString().equalsIgnoreCase("(ORDERS.ORDERUNITS > 5)")); - Assert.assertTrue(((AliasedRelation)query.getFrom()).getAlias().equalsIgnoreCase(SourceName.of("ORDERS"))); + Assert.assertTrue(((AliasedRelation)query.getFrom()).getAlias().equals(SourceName.of("ORDERS"))); Assert.assertTrue(query .getWindow().isPresent()); Assert.assertTrue(query diff --git a/ksql-rest-app/src/main/java/io/confluent/ksql/rest/server/execution/ListSourceExecutor.java b/ksql-rest-app/src/main/java/io/confluent/ksql/rest/server/execution/ListSourceExecutor.java index aa8080229c92..f9e40fa4f3d9 100644 --- a/ksql-rest-app/src/main/java/io/confluent/ksql/rest/server/execution/ListSourceExecutor.java +++ b/ksql-rest-app/src/main/java/io/confluent/ksql/rest/server/execution/ListSourceExecutor.java @@ -154,7 +154,7 @@ private static List> getSpecificTables( ) { return executionContext.getMetaStore().getAllDataSources().values().stream() .filter(KsqlTable.class::isInstance) - .filter(structuredDataSource -> !structuredDataSource.getName().equalsIgnoreCase( + .filter(structuredDataSource -> !structuredDataSource.getName().equals( KsqlRestApplication.getCommandsStreamName())) .map(table -> (KsqlTable) table) .collect(Collectors.toList()); @@ -165,7 +165,7 @@ private static List> getSpecificStreams( ) { return executionContext.getMetaStore().getAllDataSources().values().stream() .filter(KsqlStream.class::isInstance) - .filter(structuredDataSource -> !structuredDataSource.getName().equalsIgnoreCase( + .filter(structuredDataSource -> !structuredDataSource.getName().equals( KsqlRestApplication.getCommandsStreamName())) .map(table -> (KsqlStream) table) .collect(Collectors.toList());