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

Milinda Lakmal Pathirage commented on CALCITE-968:
--------------------------------------------------

[~julianhyde], I started to change the SqlValidatorImpl to support 
stream-to-relation joins. I have several questions on this?

1. Is it a requirement for the stream to be at the left most position (just 
after {{FROM}} clause) in a stream-to-relation join? As I understand its 
possible for a stream to be in any place if we think in terms of instantaneous 
relations as in CQL.
2. If a stream can be in any place how can we throw a proper error in 
SqlValidatorImpl's {{validateModality}}? For an example, let's say we trying 
the following logic if required modality is {{STREAM}}:

{code:java|borderStyle=solid}
boolean atLeastOneSupportsModality = false;
for (Pair<String, SqlValidatorNamespace> namespace : scope.children) {
   if(namespace.right.supportsModality(modality)) {
     atLeastOneSupportsModality = true;
   }
}

if (!atLeastOneSupportsModality) {
  if (fail) {
    throw newValidationError(namespace.right.getNode(),
       Static.RESOURCE.cannotConvertToStream(namespace.left));
  } else {
    return false;
  }
}
{code}

In above which child node we should use (to get the position) when throwing the 
error? Let's say if we move the error throwing logic inside the for loop, is it 
okay if we throw the error for the last child? May be we should throw the error 
with the position of select node?

> Support stream joins
> --------------------
>
>                 Key: CALCITE-968
>                 URL: https://issues.apache.org/jira/browse/CALCITE-968
>             Project: Calcite
>          Issue Type: New Feature
>          Components: core, stream
>            Reporter: Milinda Lakmal Pathirage
>            Assignee: Julian Hyde
>
> Stream joins are used to relate information from different streams or stream 
> and relation combinations. Calcite lacks (proper) support for 
> stream-to-relation joins and stream-to-stream joins.
> stream-to-relation join like below fails at the SQL validation stage.
> select stream orders.orderId, orders.productId, products.name from orders 
> join products on orders.productId = products.id
> But if 'products' is a stream, the query is valid according to Calcite, even 
> though the stream-to-stream join in above query is not valid due to unbounded 
> nature of streams.



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

Reply via email to