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

Julian Hyde commented on CALCITE-1227:
--------------------------------------

I agree about the "upon next record" problem. That is why I suggested, a couple 
of comments back, that the reader reads using a timeout. I notice that 
CsvStreamReader has a field {{Queue<String> contentQueue}} and calls 
{{contentQueue.poll();}}. Can you convert that to a {{BlockingQueue}} and call 
{{BlockingQueue.poll(long timeout, TimeUnit unit)}}?

You could add

{code}
enum DataContext.Variable {
  CANCEL_FLAG("cancelFlag", CancelFlag.class)
}
{code}

and the enumerator could check its state periodically:

{code}
DataContext root;
CancelFlag flag = root.get(DataContext.Variable.CANCEL_FLAG.name());
for (;;) {
   ...

  if (flag.isCancelRequested()) {
    return;
  }
}
{code}


> 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