Re: [PR] [IOTDB-6305] Add show current_timestamp statement [iotdb]

2024-03-01 Thread via GitHub


qiaojialin merged PR #12106:
URL: https://github.com/apache/iotdb/pull/12106


-- 
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-unsubscr...@iotdb.apache.org

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



Re: [PR] [IOTDB-6305] Add show current_timestamp statement [iotdb]

2024-02-29 Thread via GitHub


JackieTien97 commented on code in PR #12106:
URL: https://github.com/apache/iotdb/pull/12106#discussion_r1508533879


##
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/memory/StatementMemorySourceVisitor.java:
##
@@ -259,4 +260,19 @@ public StatementMemorySource visitShowPathsUsingTemplate(
 return new StatementMemorySource(
 tsBlockBuilder.build(), context.getAnalysis().getRespDatasetHeader());
   }
+
+  public StatementMemorySource visitShowCurrentTimestamp(
+  ShowCurrentTimestampStatement showCurrentTimestampStatement,
+  StatementMemorySourceContext context) {
+List outputDataTypes =
+ColumnHeaderConstant.showCurrentTimestampColumnHeaders.stream()
+.map(ColumnHeader::getColumnType)
+.collect(Collectors.toList());
+TsBlockBuilder tsBlockBuilder = new TsBlockBuilder(outputDataTypes);
+tsBlockBuilder.getTimeColumnBuilder().writeLong(0L);
+tsBlockBuilder.getColumnBuilder(0).writeLong(System.currentTimeMillis());

Review Comment:
   It's a long value, how to resolve this long value depends on the user. We 
can default return `ms`, in stardand sql, there will be a parameter called 
`precision` in current_timestamp function to decide whether to return `ms`, 
`us` or `ns`, so I think it's ok to defaultly return `ms` here and this 
function call's time precision should have nothing to do with our 
`timestamp_precision` configuration.



-- 
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-unsubscr...@iotdb.apache.org

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



Re: [PR] [IOTDB-6305] Add show current_timestamp statement [iotdb]

2024-02-29 Thread via GitHub


HTHou commented on code in PR #12106:
URL: https://github.com/apache/iotdb/pull/12106#discussion_r1508529972


##
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/memory/StatementMemorySourceVisitor.java:
##
@@ -259,4 +260,19 @@ public StatementMemorySource visitShowPathsUsingTemplate(
 return new StatementMemorySource(
 tsBlockBuilder.build(), context.getAnalysis().getRespDatasetHeader());
   }
+
+  public StatementMemorySource visitShowCurrentTimestamp(
+  ShowCurrentTimestampStatement showCurrentTimestampStatement,
+  StatementMemorySourceContext context) {
+List outputDataTypes =
+ColumnHeaderConstant.showCurrentTimestampColumnHeaders.stream()
+.map(ColumnHeader::getColumnType)
+.collect(Collectors.toList());
+TsBlockBuilder tsBlockBuilder = new TsBlockBuilder(outputDataTypes);
+tsBlockBuilder.getTimeColumnBuilder().writeLong(0L);
+tsBlockBuilder.getColumnBuilder(0).writeLong(System.currentTimeMillis());

Review Comment:
   Is there any issue when the timestamp_precision is ns or us? @JackieTien97 



-- 
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-unsubscr...@iotdb.apache.org

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