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/07/18 12:53:40 UTC

[GitHub] [iotdb] HTHou commented on a change in pull request #3067: [IOTDB-1059] Support sql statement insert without timestamp

HTHou commented on a change in pull request #3067:
URL: https://github.com/apache/iotdb/pull/3067#discussion_r671838508



##########
File path: server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
##########
@@ -1763,8 +1763,12 @@ private void parseInsertValuesSpec(InsertValuesSpecContext ctx, InsertOperator i
       long timestamp;
       if (insertMultiValues.get(i).dateFormat() != null) {
         timestamp = parseTimeFormat(insertMultiValues.get(i).dateFormat().getText());
-      } else {
+      } else if (insertMultiValues.get(i).INT() != null) {
         timestamp = Long.parseLong(insertMultiValues.get(i).INT().getText());
+      } else if (insertMultiValues.size() != 1) {
+        throw new SQLParserException("need timestamps when insert multi rows");
+      } else {
+        timestamp = parseTimeFormat("now()");

Review comment:
       ```suggestion
           timestamp = parseTimeFormat(SQLConstant.NOW_FUNC);
   ```




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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

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