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 2020/11/20 08:49:18 UTC

[GitHub] [iotdb] mychaow commented on a change in pull request #2087: [IOTDB-890] SDT implementation

mychaow commented on a change in pull request #2087:
URL: https://github.com/apache/iotdb/pull/2087#discussion_r527510805



##########
File path: antlr/src/main/antlr4/org/apache/iotdb/db/qp/strategy/SqlBase.g4
##########
@@ -641,6 +640,7 @@ dateFormat
 constant
     : dateExpression
     | NaN
+    | SDT

Review comment:
       Maybe you need to add some parameter name of sdt?
   And Please add some example in the docs.

##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java
##########
@@ -97,18 +109,93 @@ public ChunkWriterImpl(MeasurementSchema schema) {
     this.pageWriter = new PageWriter(measurementSchema);
     this.pageWriter.setTimeEncoder(measurementSchema.getTimeEncoder());
     this.pageWriter.setValueEncoder(measurementSchema.getValueEncoder());
+
+    //check if the measurement schema uses SDT
+    checkSdtEncoding();
+  }
+
+  public ChunkWriterImpl(MeasurementSchema schema, boolean isMerging) {
+    this(schema);
+    this.isMerging = isMerging;
+  }
+
+  private void checkSdtEncoding() {
+    if (measurementSchema.getProps() != null && !isMerging) {
+      for (Map.Entry<String, String> entry : measurementSchema.getProps().entrySet()) {
+        //check if is sdt encoding
+        if (entry.getKey().toLowerCase().equals("loss") && entry.getValue().toLowerCase()
+            .equals("sdt")) {
+          isSdtEncoding = true;
+          sdtEncoder = new SdtEncoder();
+        }
+
+        //set compression deviation
+        else if (isSdtEncoding &&
+            entry.getKey().toLowerCase().equals("cd")) {

Review comment:
       cd is too simple

##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java
##########
@@ -155,6 +266,12 @@ public void write(long[] timestamps, boolean[] values, int batchSize) {
 
   @Override
   public void write(long[] timestamps, float[] values, int batchSize) {

Review comment:
       so, how about double[] ?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org