kr11 commented on a change in pull request #34: fix sonar 
URL: https://github.com/apache/incubator-iotdb/pull/34#discussion_r251230601
 
 

 ##########
 File path: 
tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/Decoder.java
 ##########
 @@ -46,23 +50,37 @@ public static Decoder getDecoderByType(TSEncoding type, 
TSDataType dataType) {
     // PLA and DFT encoding are not supported in current version
     if (type == TSEncoding.PLAIN) {
       return new PlainDecoder(EndianType.LITTLE_ENDIAN);
-    } else if (type == TSEncoding.RLE && dataType == TSDataType.BOOLEAN) {
-      return new IntRleDecoder(EndianType.LITTLE_ENDIAN);
-    } else if (type == TSEncoding.TS_2DIFF && dataType == TSDataType.INT32) {
-      return new DeltaBinaryDecoder.IntDeltaDecoder();
-    } else if (type == TSEncoding.TS_2DIFF && dataType == TSDataType.INT64) {
-      return new DeltaBinaryDecoder.LongDeltaDecoder();
-    } else if (type == TSEncoding.RLE && dataType == TSDataType.INT32) {
-      return new IntRleDecoder(EndianType.LITTLE_ENDIAN);
-    } else if (type == TSEncoding.RLE && dataType == TSDataType.INT64) {
-      return new LongRleDecoder(EndianType.LITTLE_ENDIAN);
-    } else if ((dataType == TSDataType.FLOAT || dataType == TSDataType.DOUBLE)
-        && (type == TSEncoding.RLE || type == TSEncoding.TS_2DIFF)) {
-      return new FloatDecoder(TSEncoding.valueOf(type.toString()), dataType);
-    } else if (type == TSEncoding.GORILLA && dataType == TSDataType.FLOAT) {
-      return new SinglePrecisionDecoder();
-    } else if (type == TSEncoding.GORILLA && dataType == TSDataType.DOUBLE) {
-      return new DoublePrecisionDecoder();
+    } else if (type == TSEncoding.RLE) {
 
 Review comment:
   If we want to refactor it for readability, `switch-case` is recommended:
   ```
   switch(dataType){
        FLOAT:
        INT64:
       ...
   }
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to