[
https://issues.apache.org/jira/browse/CALCITE-1227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15306375#comment-15306375
]
zhen wang commented on CALCITE-1227:
------------------------------------
indeed I didn't quite get how DataContext could used to help. will continue ...
public Enumerable<Object[]> scan(DataContext root) {
so `DataContext` could easily be injected into `CsvStreamReader`. problem is
how does the reader get the `Cancel` signal ?
the `order` stream could end because it always have next result. when CTRL-C is
signaled, SQLine enters Canceled mode. and **upon next record** it will break
from the reading records loop and after that close statement result set etc...
what is different for CsvStream here is that, although SQL line enters Canceled
mode, it needs another(next) input to break from the reading record loop, which
CsvStream wouldn't able to give (as itself is blocked for next input).
so my understanding is: upon cancel handling in AvaticaStatement, it has to
obtain the DataContext, and inject the cancel status into variable map, and
thus reader could check there.
> 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)