Skip to content

Commit

Permalink
Add a length limit of 512 to the properties stored in the segment met…
Browse files Browse the repository at this point in the history
…adata
  • Loading branch information
Jackie-Jiang committed Sep 11, 2020
1 parent 11fd62b commit 5593656
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -78,6 +78,9 @@
public class SegmentColumnarIndexCreator implements SegmentCreator {
// TODO Refactor class name to match interface name
private static final Logger LOGGER = LoggerFactory.getLogger(SegmentColumnarIndexCreator.class);
// Allow at most 512 characters for the metadata property
private static final int METADATA_PROPERTY_LENGTH_LIMIT = 512;

private SegmentGeneratorConfig config;
private Map<String, ColumnIndexCreationInfo> indexCreationInfoMap;
private Map<String, SegmentDictionaryCreator> _dictionaryCreatorMap = new HashMap<>();
Expand Down Expand Up @@ -562,6 +565,7 @@ public static void addColumnMinMaxValueInfo(PropertiesConfiguration properties,
* Helper method to check whether the given value is a valid property value.
* <p>Value is invalid iff:
* <ul>
* <li>It contains more than 512 characters</li>
* <li>It contains leading/trailing whitespace</li>
* <li>It contains list separator (',')</li>
* </ul>
Expand All @@ -572,6 +576,9 @@ static boolean isValidPropertyValue(String value) {
if (length == 0) {
return true;
}
if (length > METADATA_PROPERTY_LENGTH_LIMIT) {
return false;
}
if (Character.isWhitespace(value.charAt(0)) || Character.isWhitespace(value.charAt(length - 1))) {
return false;
}
Expand Down

0 comments on commit 5593656

Please sign in to comment.