9aman commented on code in PR #15347: URL: https://github.com/apache/pinot/pull/15347#discussion_r2008746634
########## pinot-spi/src/main/java/org/apache/pinot/spi/utils/IngestionConfigUtils.java: ########## @@ -101,11 +101,38 @@ public static List<Map<String, String>> getStreamConfigMaps(TableConfig tableCon return streamConfigMaps; } if (tableConfig.getIndexingConfig() != null && tableConfig.getIndexingConfig().getStreamConfigs() != null) { - return Arrays.asList(tableConfig.getIndexingConfig().getStreamConfigs()); + return List.of(tableConfig.getIndexingConfig().getStreamConfigs()); } throw new IllegalStateException("Could not find streamConfigs for REALTIME table: " + tableNameWithType); } + public static List<StreamConfig> getStreamConfigs(TableConfig tableConfig) { + return getStreamConfigMaps(tableConfig).stream() + .map(streamConfigMap -> new StreamConfig(tableConfig.getTableName(), streamConfigMap)) + .collect(Collectors.toList()); + } + + public static Map<String, String> getFirstStreamConfigMap(TableConfig tableConfig) { + String tableNameWithType = tableConfig.getTableName(); + Preconditions.checkState(tableConfig.getTableType() == TableType.REALTIME, + "Cannot fetch streamConfigs for OFFLINE table: %s", tableNameWithType); + if (tableConfig.getIngestionConfig() != null + && tableConfig.getIngestionConfig().getStreamIngestionConfig() != null) { + List<Map<String, String>> streamConfigMaps = + tableConfig.getIngestionConfig().getStreamIngestionConfig().getStreamConfigMaps(); + Preconditions.checkState(!streamConfigMaps.isEmpty(), "Table must have at least 1 stream"); + return streamConfigMaps.get(0); + } + if (tableConfig.getIndexingConfig() != null && tableConfig.getIndexingConfig().getStreamConfigs() != null) { + return tableConfig.getIndexingConfig().getStreamConfigs(); + } + throw new IllegalStateException("Could not find streamConfigs for REALTIME table: " + tableNameWithType); + } + + public static StreamConfig getFirstStreamConfig(TableConfig tableConfig) { Review Comment: Same -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org