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 2021/01/21 11:41:47 UTC

[GitHub] [iotdb] haimeiguo opened a new pull request #2543: fail to create timeseries when set invalid sdt parameters

haimeiguo opened a new pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543


   Currently we check SDT parameters when flushing,  if the parameters are not valid we will only disable SDT compression. 
   
   This pr moves SDT validation process to when we create timeseries. If SDT parameters are false, user will get an error and timeseries are not created. Also log info will record if user did not set compMinTime or compMaxTime.
   
   `
   IoTDB> create timeseries root.sg4.d1.s3 with datatype=double,loss=sdt,compdev=-2
   Msg: 303: SDT compression deviation cannot be negative. Failed to create timeseries.
   
   IoTDB> create timeseries root.sg4.d1.s4 with datatype=double,loss=sdt,compdev=2,compmintime=4,compmaxtime=1
   Msg: 303: Error occurred SDT compression maximum needs to be greater than compression minimum. Failed to create timeseries.
   `


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



[GitHub] [iotdb] sonarcloud[bot] removed a comment on pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#issuecomment-764593220






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



[GitHub] [iotdb] jixuan1989 commented on a change in pull request #2543: [IOTDB-1091] fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r565358473



##########
File path: server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java
##########
@@ -102,6 +102,13 @@ private IoTDBConstant() {
   public static final String PATH_WILDCARD = "*";
   public static final String TIME = "time";
 
+  //sdt parameters
+  public static final String LOSS = "loss";

Review comment:
       The problem is... with Antlr, all these keywords will be converted to lowercase, but if users call thrift API, createTimeseries(), how they know they must write these keywords as lowercase.
   (The example in your SQL grammar doc is uppercase)




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



[GitHub] [iotdb] jixuan1989 commented on a change in pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r561835640



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -237,6 +242,58 @@ MeasurementMNode createTimeseries(PartialPath path, TSDataType dataType, TSEncod
     }
   }
 
+  //check if sdt parameters are valid
+  private void checkSDTFormat(PartialPath path, Map<String, String> props) throws IOException {

Review comment:
       Why IOexception...




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



[GitHub] [iotdb] sonarcloud[bot] commented on pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#issuecomment-764593220


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [6 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list)
   
   


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



[GitHub] [iotdb] wangchao316 commented on a change in pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
wangchao316 commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r562318805



##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java
##########
@@ -133,40 +133,15 @@ private void checkSdtEncoding() {
       }
 
       if (isSdtEncoding && measurementSchema.getProps().containsKey("compdev")) {
-        try {
-          sdtEncoder
-              .setCompDeviation(Double.parseDouble(measurementSchema.getProps().get("compdev")));
-        } catch (NumberFormatException e) {
-          logger.error("meet error when formatting SDT compression deviation");
-        }
-        if (sdtEncoder.getCompDeviation() < 0) {

Review comment:
       hello, Thanks for this contribution. I think the judgment cannot be deleted.  we should consider upgrading, if compdeviation is negative in low version,  which exist in high version after upgrade high version,  we need have a judgment for this parameter.
   I suggestion:
   1. deal when we create timeseries.
   2. deal when use this parameter. 




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



[GitHub] [iotdb] sonarcloud[bot] commented on pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#issuecomment-766518972


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list)
   
   


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



[GitHub] [iotdb] sonarcloud[bot] commented on pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#issuecomment-764593220


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [6 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list)
   
   


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



[GitHub] [iotdb] sonarcloud[bot] removed a comment on pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#issuecomment-766518972


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list)
   
   


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



[GitHub] [iotdb] jixuan1989 merged pull request #2543: [IOTDB-1091] fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
jixuan1989 merged pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543


   


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



[GitHub] [iotdb] sonarcloud[bot] removed a comment on pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#issuecomment-766508965


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list)
   
   


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



[GitHub] [iotdb] jixuan1989 commented on a change in pull request #2543: [IOTDB-1091] fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r565346593



##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java
##########
@@ -133,40 +133,15 @@ private void checkSdtEncoding() {
       }
 
       if (isSdtEncoding && measurementSchema.getProps().containsKey("compdev")) {
-        try {
-          sdtEncoder
-              .setCompDeviation(Double.parseDouble(measurementSchema.getProps().get("compdev")));
-        } catch (NumberFormatException e) {
-          logger.error("meet error when formatting SDT compression deviation");
-        }
-        if (sdtEncoder.getCompDeviation() < 0) {

Review comment:
       in general, we need to obey the rule you mentioned.
   The exception here is SDT will be introduced from 0.12, that is, this feature is not released up to now.




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



[GitHub] [iotdb] wangchao316 commented on a change in pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
wangchao316 commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r562318805



##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java
##########
@@ -133,40 +133,15 @@ private void checkSdtEncoding() {
       }
 
       if (isSdtEncoding && measurementSchema.getProps().containsKey("compdev")) {
-        try {
-          sdtEncoder
-              .setCompDeviation(Double.parseDouble(measurementSchema.getProps().get("compdev")));
-        } catch (NumberFormatException e) {
-          logger.error("meet error when formatting SDT compression deviation");
-        }
-        if (sdtEncoder.getCompDeviation() < 0) {

Review comment:
       hello, Thanks for this contribution. I think the judgment cannot be deleted.  we should consider upgrading, if compdeviation is negative in low version,  which exist in high version after upgrade high version,  we need have a judgment for this parameter.
   I suggestion:
   1. deal when we create timeseries.
   2. deal when use this parameter. 




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



[GitHub] [iotdb] jixuan1989 commented on a change in pull request #2543: [IOTDB-1091] fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r565786285



##########
File path: server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java
##########
@@ -102,6 +102,13 @@ private IoTDBConstant() {
   public static final String PATH_WILDCARD = "*";
   public static final String TIME = "time";
 
+  //sdt parameters
+  public static final String LOSS = "loss";

Review comment:
       OK..




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



[GitHub] [iotdb] weizihan0110 commented on a change in pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
weizihan0110 commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r561975415



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -237,6 +242,58 @@ MeasurementMNode createTimeseries(PartialPath path, TSDataType dataType, TSEncod
     }
   }
 
+  //check if sdt parameters are valid
+  private void checkSDTFormat(PartialPath path, Map<String, String> props) throws IOException {
+    String s = "Failed to create timeseries.";
+
+    if (!props.containsKey("compdev")) {

Review comment:
       Hi, something like "compdev" should not be hard-code. It's better to extract them to be a variable.

##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -237,6 +242,58 @@ MeasurementMNode createTimeseries(PartialPath path, TSDataType dataType, TSEncod
     }
   }
 
+  //check if sdt parameters are valid
+  private void checkSDTFormat(PartialPath path, Map<String, String> props) throws IOException {
+    String s = "Failed to create timeseries.";
+
+    if (!props.containsKey("compdev")) {

Review comment:
       Same as above

##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -237,6 +242,58 @@ MeasurementMNode createTimeseries(PartialPath path, TSDataType dataType, TSEncod
     }
   }
 
+  //check if sdt parameters are valid
+  private void checkSDTFormat(PartialPath path, Map<String, String> props) throws IOException {
+    String s = "Failed to create timeseries.";
+
+    if (!props.containsKey("compdev")) {
+      throw new IOException("SDT compression deviation is required. " + s);
+    }
+
+    try {
+      double d = Double.parseDouble(props.get("compdev"));
+      if (d < 0) {
+        throw new IOException("Error occurred SDT compression deviation cannot be negative. " + s);
+      }
+    } catch (NumberFormatException e) {
+      throw new IOException("Error occurred when formatting SDT compression deviation. " + s);
+    }
+
+    long compMaxTime = Long.MAX_VALUE;
+    long compMinTime = 0;
+    if (props.containsKey("compmintime")) {
+      try {
+        compMinTime = Long.parseLong(props.get("compmintime"));
+        if (compMinTime < 0) {
+          throw new NumberFormatException();

Review comment:
       should print something like "compmintime cannot be negative"

##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -212,6 +212,11 @@ MeasurementMNode createTimeseries(PartialPath path, TSDataType dataType, TSEncod
       }
       cur = cur.getChild(nodeName);
     }
+
+    if (props != null && props.containsKey("loss") && props.get("loss").equals("sdt")) {

Review comment:
       Hi, something like "sdt" or "loss" should not be hard-code. It's better to extract them to be a variable.

##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -237,6 +242,58 @@ MeasurementMNode createTimeseries(PartialPath path, TSDataType dataType, TSEncod
     }
   }
 
+  //check if sdt parameters are valid
+  private void checkSDTFormat(PartialPath path, Map<String, String> props) throws IOException {
+    String s = "Failed to create timeseries.";
+
+    if (!props.containsKey("compdev")) {
+      throw new IOException("SDT compression deviation is required. " + s);
+    }
+
+    try {
+      double d = Double.parseDouble(props.get("compdev"));
+      if (d < 0) {
+        throw new IOException("Error occurred SDT compression deviation cannot be negative. " + s);
+      }
+    } catch (NumberFormatException e) {
+      throw new IOException("Error occurred when formatting SDT compression deviation. " + s);
+    }
+
+    long compMaxTime = Long.MAX_VALUE;
+    long compMinTime = 0;
+    if (props.containsKey("compmintime")) {
+      try {
+        compMinTime = Long.parseLong(props.get("compmintime"));
+        if (compMinTime < 0) {
+          throw new NumberFormatException();
+        }
+      } catch (NumberFormatException e) {
+        throw new IOException("Error occurred when formatting SDT compression minimum time. " + s);
+      }
+    } else {
+      logger.info(path + " enabled SDT but did not set compression minimum time.");
+    }
+
+    if (props.containsKey("compmaxtime")) {
+      try {
+        compMaxTime = Long.parseLong(props.get("compmaxtime"));
+        if (compMaxTime < 0) {
+          throw new NumberFormatException();

Review comment:
       Same as above




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



[GitHub] [iotdb] sonarcloud[bot] commented on pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#issuecomment-766708514


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list)
   
   


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



[GitHub] [iotdb] weizihan0110 commented on a change in pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
weizihan0110 commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r561975415



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -237,6 +242,58 @@ MeasurementMNode createTimeseries(PartialPath path, TSDataType dataType, TSEncod
     }
   }
 
+  //check if sdt parameters are valid
+  private void checkSDTFormat(PartialPath path, Map<String, String> props) throws IOException {
+    String s = "Failed to create timeseries.";
+
+    if (!props.containsKey("compdev")) {

Review comment:
       Hi, something like "compdev" should not be hard-code. It's better to extract them to be a variable.




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



[GitHub] [iotdb] jixuan1989 commented on a change in pull request #2543: [IOTDB-1091] fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r565359618



##########
File path: server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java
##########
@@ -102,6 +102,13 @@ private IoTDBConstant() {
   public static final String PATH_WILDCARD = "*";
   public static final String TIME = "time";
 
+  //sdt parameters
+  public static final String LOSS = "loss";

Review comment:
       and make sure it works on the cluster mode.




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



[GitHub] [iotdb] weizihan0110 commented on a change in pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
weizihan0110 commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r561975415



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -237,6 +242,58 @@ MeasurementMNode createTimeseries(PartialPath path, TSDataType dataType, TSEncod
     }
   }
 
+  //check if sdt parameters are valid
+  private void checkSDTFormat(PartialPath path, Map<String, String> props) throws IOException {
+    String s = "Failed to create timeseries.";
+
+    if (!props.containsKey("compdev")) {

Review comment:
       Same as above




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



[GitHub] [iotdb] sonarcloud[bot] removed a comment on pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#issuecomment-764593220


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [6 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list)
   
   


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



[GitHub] [iotdb] sonarcloud[bot] commented on pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#issuecomment-766508965






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



[GitHub] [iotdb] weizihan0110 commented on a change in pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
weizihan0110 commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r561981261



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -237,6 +242,58 @@ MeasurementMNode createTimeseries(PartialPath path, TSDataType dataType, TSEncod
     }
   }
 
+  //check if sdt parameters are valid
+  private void checkSDTFormat(PartialPath path, Map<String, String> props) throws IOException {
+    String s = "Failed to create timeseries.";
+
+    if (!props.containsKey("compdev")) {
+      throw new IOException("SDT compression deviation is required. " + s);
+    }
+
+    try {
+      double d = Double.parseDouble(props.get("compdev"));
+      if (d < 0) {
+        throw new IOException("Error occurred SDT compression deviation cannot be negative. " + s);
+      }
+    } catch (NumberFormatException e) {
+      throw new IOException("Error occurred when formatting SDT compression deviation. " + s);
+    }
+
+    long compMaxTime = Long.MAX_VALUE;
+    long compMinTime = 0;
+    if (props.containsKey("compmintime")) {
+      try {
+        compMinTime = Long.parseLong(props.get("compmintime"));
+        if (compMinTime < 0) {
+          throw new NumberFormatException();

Review comment:
       should print something like "compmintime cannot be negative"

##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -212,6 +212,11 @@ MeasurementMNode createTimeseries(PartialPath path, TSDataType dataType, TSEncod
       }
       cur = cur.getChild(nodeName);
     }
+
+    if (props != null && props.containsKey("loss") && props.get("loss").equals("sdt")) {

Review comment:
       Hi, something like "sdt" or "loss" should not be hard-code. It's better to extract them to be a variable.

##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -237,6 +242,58 @@ MeasurementMNode createTimeseries(PartialPath path, TSDataType dataType, TSEncod
     }
   }
 
+  //check if sdt parameters are valid
+  private void checkSDTFormat(PartialPath path, Map<String, String> props) throws IOException {
+    String s = "Failed to create timeseries.";
+
+    if (!props.containsKey("compdev")) {
+      throw new IOException("SDT compression deviation is required. " + s);
+    }
+
+    try {
+      double d = Double.parseDouble(props.get("compdev"));
+      if (d < 0) {
+        throw new IOException("Error occurred SDT compression deviation cannot be negative. " + s);
+      }
+    } catch (NumberFormatException e) {
+      throw new IOException("Error occurred when formatting SDT compression deviation. " + s);
+    }
+
+    long compMaxTime = Long.MAX_VALUE;
+    long compMinTime = 0;
+    if (props.containsKey("compmintime")) {
+      try {
+        compMinTime = Long.parseLong(props.get("compmintime"));
+        if (compMinTime < 0) {
+          throw new NumberFormatException();
+        }
+      } catch (NumberFormatException e) {
+        throw new IOException("Error occurred when formatting SDT compression minimum time. " + s);
+      }
+    } else {
+      logger.info(path + " enabled SDT but did not set compression minimum time.");
+    }
+
+    if (props.containsKey("compmaxtime")) {
+      try {
+        compMaxTime = Long.parseLong(props.get("compmaxtime"));
+        if (compMaxTime < 0) {
+          throw new NumberFormatException();

Review comment:
       Same as above




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



[GitHub] [iotdb] sonarcloud[bot] commented on pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#issuecomment-766508965


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=2543&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=2543&metric=new_duplicated_lines_density&view=list)
   
   


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



[GitHub] [iotdb] haimeiguo commented on a change in pull request #2543: [IOTDB-1091] fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
haimeiguo commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r565767265



##########
File path: server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java
##########
@@ -102,6 +102,13 @@ private IoTDBConstant() {
   public static final String PATH_WILDCARD = "*";
   public static final String TIME = "time";
 
+  //sdt parameters
+  public static final String LOSS = "loss";

Review comment:
       Hi, in CreateTimeSeriesPlan, I converted props to case insensitive. 
   this.props = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);




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



[GitHub] [iotdb] jixuan1989 commented on a change in pull request #2543: fail to create timeseries when set invalid sdt parameters

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #2543:
URL: https://github.com/apache/iotdb/pull/2543#discussion_r561835640



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -237,6 +242,58 @@ MeasurementMNode createTimeseries(PartialPath path, TSDataType dataType, TSEncod
     }
   }
 
+  //check if sdt parameters are valid
+  private void checkSDTFormat(PartialPath path, Map<String, String> props) throws IOException {

Review comment:
       Why IOexception...




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