public static TreePattern parsePipePatternFromSourceParameters(
      final PipeParameters sourceParameters) {
    final boolean isTreeModelDataAllowedToBeCaptured =
        isTreeModelDataAllowToBeCaptured(sourceParameters);

    final String path = sourceParameters.getStringByKeys(EXTRACTOR_PATH_KEY, SOURCE_PATH_KEY);

    // 1. If "source.path" is specified, it will be interpreted as an IoTDB-style path,
    // ignoring the other 2 parameters.
    if (path != null) {
      return new IoTDBTreePattern(isTreeModelDataAllowedToBeCaptured, path);
    }

    final String pattern =
        sourceParameters.getStringByKeys(EXTRACTOR_PATTERN_KEY, SOURCE_PATTERN_KEY);

    // 2. Otherwise, If "source.pattern" is specified, it will be interpreted
    // according to "source.pattern.format".
    if (pattern != null) {
      final String patternFormat =
          sourceParameters.getStringByKeys(EXTRACTOR_PATTERN_FORMAT_KEY, SOURCE_PATTERN_FORMAT_KEY);

      // If "source.pattern.format" is not specified, use prefix format by default.
      if (patternFormat == null) {
        return new PrefixTreePattern(isTreeModelDataAllowedToBeCaptured, pattern);
      }

      switch (patternFormat.toLowerCase()) {
        case EXTRACTOR_PATTERN_FORMAT_IOTDB_VALUE:
          return new IoTDBTreePattern(isTreeModelDataAllowedToBeCaptured, pattern);
        case EXTRACTOR_PATTERN_FORMAT_PREFIX_VALUE:
          return new PrefixTreePattern(isTreeModelDataAllowedToBeCaptured, pattern);
        default:
          LOGGER.info(
              "Unknown pattern format: {}, use prefix matching format by default.", patternFormat);
          return new PrefixTreePattern(isTreeModelDataAllowedToBeCaptured, pattern);
      }
    }

    // 3. If neither "source.path" nor "source.pattern" is specified,
    // this pipe source will match all data.
    return new IoTDBTreePattern(isTreeModelDataAllowedToBeCaptured, null);
  }
Interpret from source parameters and get a {@link TreePattern}.

@return The interpreted {@link TreePattern} which is not {@code null}.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TreePattern.java