[ 
https://issues.apache.org/jira/browse/CALCITE-1227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15303513#comment-15303513
 ] 

zhen wang commented on CALCITE-1227:
------------------------------------

I am having some fun with this one here: 
https://github.com/apache/calcite/compare/master...zinking:csvstream?expand=1
current status: the streaming query can capture the file changes and emit 
output correspondingly. 

one remaining item is regarding how to terminate the stream
1. when the query is in emitting output status, then it can be cancelled 
perfectly. 
2. however when the query is blocked for more input, seems I haven't managed to 
break from that point

>0: jdbc:calcite:model=/Users/awang/workspace/> select stream * from ss.depts;
+---------+--------+------+
| ROWTIME | DEPTNO | NAME |
+---------+--------+------+
| 2016-05-27 05:12:31 | 10     | Sales |
| 2016-05-27 05:12:31 | 20     | Marketing |
| 2016-05-27 05:12:31 | 30     | Accounts |
| 2016-05-27 05:12:31 | 40     | 40   |
| 2016-05-27 05:12:31 | 50     | 50   |
| 2016-05-27 05:12:31 | 60     | 60   |
Exception in thread "SIGINT handler" java.lang.UnsupportedOperationException
        at 
org.apache.calcite.avatica.AvaticaResultSet.cancel(AvaticaResultSet.java:171)
        at 
org.apache.calcite.avatica.AvaticaStatement.cancel(AvaticaStatement.java:299)
        at sqlline.DispatchCallback.forceKillSqlQuery(DispatchCallback.java:83)
        at sqlline.SunSignalHandler.handle(SunSignalHandler.java:38)
        at sun.misc.Signal$1.run(Signal.java:212)
        at java.lang.Thread.run(Thread.java:745)

[~julianhyde] would you mind take a look and comments are appreciated. thanks.


> Add streaming CSV table
> -----------------------
>
>                 Key: CALCITE-1227
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1227
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>
> Add a variant of CsvTable that can be streamed. It would serve as an example 
> of how to write stream adapters.
> It would be like the CSV adapter, but watches a file and reports records 
> added to the end of the file (like the tail command). 
> You’d have to change {{CsvTable}} to implement {{StreamableTable}}, and 
> implement the {{Table stream()}} method to return a variant of the table that 
> is in “follow” mode.
> It would probably be implemented by a variant of CsvEnumerator, but it is 
> getting its input in bursts, as the file is appended to.
> You would still be able to use this adapter to read historical data from the 
> CSV file. Appending records to the file would make a nice demo.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to