skoppu22 commented on code in PR #214:
URL:
https://github.com/apache/cassandra-analytics/pull/214#discussion_r3529788573
##########
cassandra-analytics-common/src/main/java/org/apache/cassandra/spark/utils/CqlUtils.java:
##########
@@ -296,4 +299,33 @@ public static boolean isTimeRangeFilterSupported(String
compactionStrategy)
{
return compactionStrategy == null ||
compactionStrategy.endsWith("TimeWindowCompactionStrategy");
}
+
+ /**
+ * Extracts replication type from create schema statement
+ *
+ * @param schemaStr full cluster schema string as returned by Sidecar
+ * @param keyspace name of the keyspace to check
+ * @return {@code true} if keyspace is tracked {@code false} otherwise
+ */
+ public static String extractReplicationType(@NotNull String schemaStr,
@NotNull String keyspace)
+ {
+ String createKeyspaceSchema = extractKeyspaceSchema(schemaStr,
keyspace);
+ Matcher matcher =
REPLICATION_TYPE_PATTERN.matcher(createKeyspaceSchema);
+ if (matcher.find())
+ {
+ return matcher.group(1);
+ }
+ return null;
+ }
+
+ /**
+ * Returns {@code true} if {@code replication_type = 'tracked'} in create
statement otherwise {@code false}
+ *
+ * @param replicationType replication type extracted from create statement
+ * @return {@code true} if replication type is tracked {@code false}
otherwise
+ */
+ public static boolean isTracked(String replicationType)
+ {
+ return TRACKED_REPLICATION_TYPE.equalsIgnoreCase(replicationType);
Review Comment:
OK
--
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]