Caideyipi commented on code in PR #17936:
URL: https://github.com/apache/iotdb/pull/17936#discussion_r3410739883
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/subscription/SubscriptionInfo.java:
##########
@@ -374,41 +372,41 @@ private void validateConsensusProtocolSupport(final
TopicConfig topicConfig)
throw new SubscriptionException(exceptionMessage);
}
- private void validateConsensusTableColumnPattern(final TopicConfig
topicConfig)
- throws SubscriptionException {
- if (!topicConfig.hasAttribute(TopicConstant.COLUMN_KEY)) {
- return;
+ private void validateColumnFilter(final TopicConfig topicConfig) throws
SubscriptionException {
+ int columnFilterKeyCount = 0;
+ for (final String key : topicConfig.getAttribute().keySet()) {
+ if (TopicConstant.COLUMN_FILTER_KEY.equalsIgnoreCase(key)) {
+ columnFilterKeyCount++;
+ }
}
-
- if (!topicConfig.isTableTopic()) {
+ if (columnFilterKeyCount > 1) {
final String exceptionMessage =
String.format(
- "Failed to create or alter topic, %s is only supported for table
topics",
- TopicConstant.COLUMN_KEY);
+ "Failed to create or alter topic, duplicate %s attributes are
not allowed",
+ TopicConstant.COLUMN_FILTER_KEY);
LOGGER.warn(exceptionMessage);
throw new SubscriptionException(exceptionMessage);
}
- if (!isConsensusBasedTopicConfig(topicConfig)) {
+ if (!topicConfig.hasColumnFilter()) {
+ return;
+ }
+
+ if (!topicConfig.isTableTopic()) {
final String exceptionMessage =
String.format(
- "Failed to create or alter topic, %s is only supported for
consensus table topics",
- TopicConstant.COLUMN_KEY);
+ "Failed to create or alter topic, %s is only supported for table
topics",
+ TopicConstant.COLUMN_FILTER_KEY);
LOGGER.warn(exceptionMessage);
throw new SubscriptionException(exceptionMessage);
}
- final String columnPattern =
- topicConfig.getStringOrDefault(
- TopicConstant.COLUMN_KEY, TopicConstant.COLUMN_DEFAULT_VALUE);
- try {
- Pattern.compile(columnPattern);
- } catch (final PatternSyntaxException e) {
+ if (topicConfig.getColumnFilter().trim().isEmpty()) {
Review Comment:
ConfigNode ?????????? key??? table topic???????????? `column-filter`
??????SQL ??? DataNode ?
`TableConfigTaskVisitor.validateAndNormalizeColumnFilter()` ???
`ColumnFilterParser.parseAndValidate()`?????? ConfigNode create/alter topic RPC
??????????????????
?? DataNode refresh matcher ????? fail closed ? empty matcher???? topic
??/?????????????????? parser/validator ????????? ConfigNode ??????????
--
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]