Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ public static void validate(TableConfig tableConfig, @Nullable Schema schema, @N
} catch (Exception e) {
throw new IllegalStateException("Could not create StreamConfig using the streamConfig map", e);
}
validateDecoder(streamConfig);
validateDecoder(streamConfig.getStreamConfigsMap().getOrDefault(StreamConfigProperties.STREAM_TYPE,
"kafka"), streamConfig);
}
validateTierConfigList(tableConfig.getTierConfigsList());
validateIndexingConfig(tableConfig.getIndexingConfig(), schema);
Expand Down Expand Up @@ -515,14 +516,18 @@ public static void validateIngestionAggregation(AggregationFunctionType function
}

@VisibleForTesting
static void validateDecoder(StreamConfig streamConfig) {
static void validateDecoder(String streamType, StreamConfig streamConfig) {
if (streamConfig.getDecoderClass().equals("org.apache.pinot.plugin.inputformat.protobuf.ProtoBufMessageDecoder")) {
String descriptorFileKey = String.format("stream.%s.decoder.prop.descriptorFile", streamType);
// check the existence of the needed decoder props
if (!streamConfig.getDecoderProperties().containsKey("stream.kafka.decoder.prop.descriptorFile")) {
throw new IllegalStateException("Missing property of descriptorFile for ProtoBufMessageDecoder");
if (!streamConfig.getDecoderProperties().containsKey(descriptorFileKey)) {
throw new IllegalStateException("Missing property of descriptorFile for ProtoBufMessageDecoder: "
+ descriptorFileKey);
}
if (!streamConfig.getDecoderProperties().containsKey("stream.kafka.decoder.prop.protoClassName")) {
throw new IllegalStateException("Missing property of protoClassName for ProtoBufMessageDecoder");
String protoClassName = String.format("stream.%s.decoder.prop.protoClassName", streamType);
if (!streamConfig.getDecoderProperties().containsKey(protoClassName)) {
throw new IllegalStateException("Missing property of protoClassName for ProtoBufMessageDecoder: "
+ protoClassName);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,14 +622,14 @@ public void ingestionStreamConfigsTest() {
"org.apache.pinot.plugin.inputformat.protobuf.ProtoBufMessageDecoder");
streamConfigs.put("stream.kafka.decoder.prop.descriptorFile", "file://test");
try {
TableConfigUtils.validateDecoder(new StreamConfig("test", streamConfigs));
TableConfigUtils.validateDecoder("kafka", new StreamConfig("test", streamConfigs));
} catch (IllegalStateException e) {
// expected
}
streamConfigs.remove("stream.kafka.decoder.prop.descriptorFile");
streamConfigs.put("stream.kafka.decoder.prop.protoClassName", "test");
try {
TableConfigUtils.validateDecoder(new StreamConfig("test", streamConfigs));
TableConfigUtils.validateDecoder("kafka", new StreamConfig("test", streamConfigs));
} catch (IllegalStateException e) {
// expected
}
Expand Down