SteveYurongSu commented on code in PR #11720: URL: https://github.com/apache/iotdb/pull/11720#discussion_r1428747909
########## iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/IoTDBDataRegionExtractor.java: ########## @@ -84,6 +90,29 @@ public IoTDBDataRegionExtractor() { @Override public void validate(PipeParameterValidator validator) throws Exception { + // Check whether the pattern is legal + String pattern = Review Comment: ```suggestion final String pattern = ``` ########## iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/IoTDBDataRegionExtractor.java: ########## @@ -84,6 +90,29 @@ public IoTDBDataRegionExtractor() { @Override public void validate(PipeParameterValidator validator) throws Exception { + // Check whether the pattern is legal + String pattern = + validator + .getParameters() + .getStringOrDefault( + Arrays.asList(EXTRACTOR_PATTERN_KEY, SOURCE_PATTERN_KEY), + EXTRACTOR_PATTERN_DEFAULT_VALUE); + try { + PathUtils.isLegalPath(pattern); + } catch (IllegalPathException e) { + try { + String[] pathNodes = StringUtils.split(pattern, "\\."); + PathUtils.splitPathToDetachedNodes( + String.join(".", Arrays.copyOfRange(pathNodes, 0, pathNodes.length - 1))); + String lastNode = pathNodes[pathNodes.length - 1]; + if (!"".equals(lastNode)) { + Double.parseDouble(lastNode); + } + } catch (NumberFormatException | IllegalPathException ignored) { Review Comment: ```suggestion } catch (Exception e) { LOGGER.warn(""); throw new IllegalArgumentException(pattern); } ``` -- 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: reviews-unsubscr...@iotdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org