adelapena commented on code in PR #2673:
URL: https://github.com/apache/cassandra/pull/2673#discussion_r1360579083
##########
src/java/org/apache/cassandra/cql3/statements/SelectStatement.java:
##########
@@ -109,6 +112,15 @@ public class SelectStatement implements
CQLStatement.SingleKeyspaceCqlStatement
private static final NoSpamLogger noSpamLogger =
NoSpamLogger.getLogger(SelectStatement.logger, 1, TimeUnit.MINUTES);
public static final int DEFAULT_PAGE_SIZE = 10000;
+ public static final String TOPK_CONSISTENCY_LEVEL_ERROR = "Top-K queries
can only be run with consistency level ONE/LOCAL_ONE. Consistency level %s was
used.";
+ public static final String TOPK_LIMIT_ERROR = "Top-K queries must have a
limit specified and the limit must be less than the query page size";
+ public static final String TOPK_PARTITION_LIMIT_ERROR = "Top-K queries do
not support per-partition limits";
+ public static final String TOPK_AGGREGATION_ERROR = "Top-K queries can not
be run with aggregation";
+ public static final String TOPK_CONSISTENCY_LEVEL_WARNING = "Top-K queries
can only be run with consistency level ONE " +
+ "/ LOCAL_ONE /
NODE_LOCAL. Consistency level %s was used. " +
+ "Downgrading
to consistency level %s.";
+ public static final String TOPK_PAGE_SIZE_WARNING = "Top-K queries do not
support paging and the page size is set to %d, " +
+ "which is less than
LIMIT %d. The page size has been set to %d to match the LIMIT.";
Review Comment:
Nit: the two last arguments are identical, so we can use "%<d" for the last
one:
```suggestion
public static final String TOPK_PAGE_SIZE_WARNING = "Top-K queries do
not support paging and the page size is set to %d, " +
"which is less than
LIMIT %d. The page size has been set to %<d to match the LIMIT.";
```
This will make `String.format` calls only need two args:
```java
ClientWarn.instance.warn(String.format(TOPK_PAGE_SIZE_WARNING, oldPageSize,
limit.count()));
```
```java
assertEquals(String.format(SelectStatement.TOPK_PAGE_SIZE_WARNING, 9, 10),
ClientWarn.instance.getWarnings().get(0));
```
--
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]