[
https://issues.apache.org/jira/browse/IOTDB-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17034640#comment-17034640
]
Shao Wei commented on IOTDB-298:
--------------------------------
Here is a brief design specification of *Last* query
1. "Last" query results will be cached in MTree nodes to be accessed quickly.
2. If no "Last" time-value result has been cached, perform a raw data query
scan of the timeseries to find the last time-value result, and store it in an
MTree node.
3. Upon each successful write, if the timestamp of newly inserted tuple is
larger than the one we've already cached, this write will update the cached
time-value pair as well.
4. To persist the Last time-value result, create a snapshot of current "Last"
time-value in memtable. When we flush memtable, this time-value result will be
flushed to disk.
5. When the database restarts, recover the memtable with Last time-value from
disk and store this time-value result in MTree.
My plan:
Phase 1, to finish above 1, 2, 3. The persistence of Last query result will
not be implemented.
Phase 2, to finish above 4 and 5.
> Last time-value query
> ---------------------
>
> Key: IOTDB-298
> URL: https://issues.apache.org/jira/browse/IOTDB-298
> Project: Apache IoTDB
> Issue Type: New Feature
> Reporter: Jialin Qiao
> Assignee: Shao Wei
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> We have two aggregators:
> last_value -> return the value of the last data point
> max_time -> return the time of the last data point
> However, we do not have an aggregator that returns the last time-value pair.
> This is very antihuman in a time-series database :(:(:(
>
> I suggest adding a new last query:
>
> last s1 from root.sg1.d1, root.sg1.d2 or other similar grammar.
>
> The Result should be in the following format:
>
> Path, Time, Value
> root.sg1.d1.s1, 100, 100
> root.sg1.d2.s1, 10, 10
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)