You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2019/03/01 01:51:14 UTC

[GitHub] jt2594838 commented on a change in pull request #80: [IOTDB-31] failed to set float precision when creating timeseries

jt2594838 commented on a change in pull request #80: [IOTDB-31] failed to set float precision when creating timeseries
URL: https://github.com/apache/incubator-iotdb/pull/80#discussion_r261455521
 
 

 ##########
 File path: tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/TSEncodingBuilder.java
 ##########
 @@ -149,15 +161,18 @@ public Encoder getEncoder(TSDataType type) {
     @Override
     public void initFromProps(Map<String, String> props) {
       // set max error from initialized map or default value if not set
-      if (props == null || !props.containsKey(Encoder.MAX_POINT_NUMBER)) {
+      if (!isKeyContainedInMap(props, Encoder.MAX_POINT_NUMBER)) {
         maxPointNumber = TSFileConfig.floatPrecision;
       } else {
-        maxPointNumber = Integer.valueOf(props.get(Encoder.MAX_POINT_NUMBER));
-        if (maxPointNumber < 0) {
-          maxPointNumber = TSFileConfig.floatPrecision;
-          LOGGER
-              .warn("cannot set max point number to negative value, replaced with default value:{}",
-                  maxPointNumber);
+        for(Map.Entry<String, String> entry : props.entrySet()) {
+          if(Encoder.MAX_POINT_NUMBER.equalsIgnoreCase(entry.getKey())) {
+            maxPointNumber = Integer.valueOf(entry.getValue());
+            if (maxPointNumber < 0) {
+              maxPointNumber = TSFileConfig.floatPrecision;
+              LOGGER.warn("cannot set max point number to negative value, replaced with default value:{}",
+                        maxPointNumber);
+            }
+          }
 
 Review comment:
   It seems that the `else` block is just enough and the `if` block is redundant.
   You may set `maxPointNumber = TSFileConfig.floatPrecision` first and then go through the loop `for(Map.Entry<String, String> entry : props.entrySet()) `.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services