[jira] [Commented] (IOTDB-298) Last time-value query

2020-02-11 Thread Shao Wei (Jira)


[ 
https://issues.apache.org/jira/browse/IOTDB-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17035005#comment-17035005
 ] 

Shao Wei commented on IOTDB-298:


Hi, a last query scan just work as normal query scan. I've learned that we make 
a copy for the memtable and this copy could be used for this query. So there 
should be no blocking when multiple copies of memtable can be used during read 
and write.

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


[jira] [Commented] (IOTDB-298) Last time-value query

2020-02-11 Thread atoildw (Jira)


[ 
https://issues.apache.org/jira/browse/IOTDB-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17034666#comment-17034666
 ] 

atoildw commented on IOTDB-298:
---

i have a question, if i'm in step 2 for scanning last result ,at the same time 
another thread was exec insert ,so you wanna block insert? or kill raw data 
query?

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


[jira] [Commented] (IOTDB-298) Last time-value query

2020-02-11 Thread Shao Wei (Jira)


[ 
https://issues.apache.org/jira/browse/IOTDB-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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)