abhioncbr commented on code in PR #12440:
URL: https://github.com/apache/pinot/pull/12440#discussion_r1509441264
##########
pinot-spi/src/main/java/org/apache/pinot/spi/env/CommonsConfigurationUtils.java:
##########
@@ -287,4 +321,35 @@ private static PropertiesConfiguration
createPropertiesConfiguration(boolean set
return config;
}
+
+ /**
+ * Creates the IOFactory based on the provided kind.
+ *
+ * @param ioFactoryKind IOFactory kind
+ * @param config to get the header content from the property configuration
+ * @param headerContentToCheck header content to validate.
+ * @return IOFactory
+ */
+ private static IOFactory createPropertyIOFactory(PropertyIOFactoryKind
ioFactoryKind,
+ PropertiesConfiguration config, String headerContentToCheck) {
+ switch (ioFactoryKind) {
+ case ConfigFileIOFactory:
+ return new ConfigFilePropertyIOFactory();
+ case SegmentMetadataIOFactory:
+ String headerContent = config.getHeader();
+ boolean skipEscapeUnescapePropertyName =
+ shouldSkipEscapeUnescapePropertyName(headerContent,
headerContentToCheck);
+ return new
SegmentMetadataPropertyIOFactory(skipEscapeUnescapePropertyName);
+ case DefaultPropertyConfigurationIOFactory:
+ default:
+ return new PropertiesConfiguration.DefaultIOFactory();
+ }
+ }
+
+ private static boolean shouldSkipEscapeUnescapePropertyName(String header,
String headerContentToCheck) {
Review Comment:
We are introducing the segment metadata version header, so it should not be
present for old metadata properties. That's why checking whether the header
contains `segment.metadata.version` or not.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]