You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2020/09/15 22:04:16 UTC

[incubator-pinot] branch master updated: Add a length limit of 512 to the properties stored in the segment metadata (#6008)

This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new b2df8ea  Add a length limit of 512 to the properties stored in the segment metadata (#6008)
b2df8ea is described below

commit b2df8ea51180df272cc7e67b91ac2f7827db4b1a
Author: Xiaotian (Jackie) Jiang <17...@users.noreply.github.com>
AuthorDate: Tue Sep 15 15:04:04 2020 -0700

    Add a length limit of 512 to the properties stored in the segment metadata (#6008)
---
 .../core/segment/creator/impl/SegmentColumnarIndexCreator.java     | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pinot-core/src/main/java/org/apache/pinot/core/segment/creator/impl/SegmentColumnarIndexCreator.java b/pinot-core/src/main/java/org/apache/pinot/core/segment/creator/impl/SegmentColumnarIndexCreator.java
index 4489dc8..e3fda09 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/segment/creator/impl/SegmentColumnarIndexCreator.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/segment/creator/impl/SegmentColumnarIndexCreator.java
@@ -78,6 +78,9 @@ import static org.apache.pinot.core.segment.creator.impl.V1Constants.MetadataKey
 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<>();
@@ -562,6 +565,7 @@ public class SegmentColumnarIndexCreator implements SegmentCreator {
    * 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>
@@ -572,6 +576,9 @@ public class SegmentColumnarIndexCreator implements SegmentCreator {
     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;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org