Maxwell-Guo commented on code in PR #2398:
URL: https://github.com/apache/cassandra/pull/2398#discussion_r1227441138
##########
src/java/org/apache/cassandra/cql3/statements/CreateTableStatement.java:
##########
@@ -342,8 +344,13 @@ public ParsedStatement.Prepared prepare(Types udts) throws
RequestValidationExce
// If we give a clustering order, we must explicitly do so for all
aliases and in the order of the PK
if (!properties.definedOrdering.isEmpty())
{
- if (properties.definedOrdering.size() > columnAliases.size())
- throw new InvalidRequestException("Only clustering key
columns can be defined in CLUSTERING ORDER directive");
+ List<ColumnIdentifier> nonClusterColumn =
properties.definedOrdering.keySet().stream()
Review Comment:
I think we can change the code format to :
`List<ColumnIdentifier> nonClusterColumn =
properties.definedOrdering.keySet().stream()
.filter((id) ->
!columnAliases.contains(id))
.collect(Collectors.toList());`
which align “.stream()” and ".filter()", ".collect()"
##########
test/unit/org/apache/cassandra/schema/CreateTableValidationTest.java:
##########
@@ -48,4 +51,89 @@ public void testInvalidBloomFilterFPRatio() throws Throwable
// sanity check
createTable("CREATE TABLE %s (a int PRIMARY KEY, b int) WITH
bloom_filter_fp_chance = 0.1");
}
+
+ @Test
+ public void testCreateTableErrorOnNonClusterKey()
Review Comment:
+1 with @ekaterinadimitrova2
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]