k-rus commented on code in PR #4038: URL: https://github.com/apache/cassandra/pull/4038#discussion_r2270066933
########## src/java/org/apache/cassandra/schema/IndexMetadata.java: ########## @@ -111,29 +108,25 @@ public static IndexMetadata fromIndexTargets(List<IndexTarget> targets, { Map<String, String> newOptions = new HashMap<>(options); newOptions.put(IndexTarget.TARGET_OPTION_NAME, targets.stream() - .map(target -> target.asCqlString()) + .map(IndexTarget::asCqlString) .collect(Collectors.joining(", "))); return new IndexMetadata(name, newOptions, kind); } - public static boolean isNameValid(String name) - { - return name != null && !name.isEmpty() && PATTERN_WORD_CHARS.matcher(name).matches(); - } - public static String generateDefaultIndexName(String table, ColumnIdentifier column) { - return PATTERN_NON_WORD_CHAR.matcher(table + "_" + column.toString() + "_idx").replaceAll(""); + return PATTERN_NON_WORD_CHAR.matcher(table + '_' + column.toString() + "_idx").replaceAll(""); } public static String generateDefaultIndexName(String table) { - return PATTERN_NON_WORD_CHAR.matcher(table + "_" + "idx").replaceAll(""); + return PATTERN_NON_WORD_CHAR.matcher(table + "_idx").replaceAll(""); } public void validate(TableMetadata table) { - if (!isNameValid(name)) + // Validating the length will be addressed by CASSANDRA-20445 Review Comment: This comment is added intentionally that fixing length validation for index names is left for a follow up commit. Can you provide a reasoning and way to improve here? -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org