Hi Aneela,
*Reason for the error:*
This is because count() function returns a *long*
but the ssh_logins attribute (of the SSHOutStream Stream which you have
defined) is of type *int*.
*Possible solution:*
Is it possible to edit the Stream Definition of SSHOutStream? If so, you
can get rid of this issue by editing it as below:
define stream SSHOutStream (ts string, ssh_logins *long*);
Let us know if you cannot edit the Stream Definition of SSHOutStream. Then
we can consider other options.
*To explain further as why this error occurs:*
when Siddhi compiles the query:
from intermediateStream
select ts, count(ts) as ssh_logins
group by ts
insert into SSHOutStream;
it infers the Stream Definition of SSHOutStream. Since the count(ts)
returns a LONG, Siddhi will infer the attribute types of SSHOutStream as
below:
ts string, ssh_logins *long*
Since the Stream Definition of this inferred Stream is different that of
the exported Stream:
@Export('SSHOutStream:1.0.0')
define stream SSHOutStream (ts string, ssh_logins *int*);
you have got the error:
Different definition same as output stream definition
:StreamDefinition{id='SSHOutStream',
attributeList=[Attribute{id='ts', type=STRING}, *Attribute{id='ssh_logins',
type=LONG}]*, annotations=[]} already exist
as:StreamDefinition{id='SSHOutStream',
attributeList=[Attribute{id='ts', type=STRING}, *Attribute{id='ssh_logins',
type=INT}*], annotations=[Annotation{name='Export',
elements=[Element{key='null', value='SSHOutStream:1.0.0'}]}]} in execution
plan "ExecutionPlan"
Hope this helps.
Thanks,
Dilini
On Sat, Jun 18, 2016 at 11:34 PM, Aneela Safdar <[email protected]> wrote:
>
> *The query I am trying to make work is :*
>
> @Import('SSHInStream:1.0.0')
> define stream SSHInStream (ts string, uid string, id_orig_h string,
> id_orig_p int, id_resp_h string, id_resp_p int, version int, client string,
> server string, cipher_alg string, mac_alg string, compression_alg string,
> kex_alg string, host_key_alg string, host_key string);
> @Export('SSHOutStream:1.0.0')
> define stream SSHOutStream (ts string, ssh_logins int);
>
> from SSHInStream
> select time:dateFormat(ts,'yyyy-MM-dd HH:mm') as ts, uid, id_orig_h,
> id_orig_p, id_resp_h, id_resp_p
> insert into intermediateStream;
>
> from intermediateStream
> select ts, count(ts) as ssh_logins
> group by ts
> insert into SSHOutStream;
>
> *And the error it generates is :*
> Different definition same as output stream definition
> :StreamDefinition{id='SSHOutStream', attributeList=[Attribute{id='ts',
> type=STRING}, Attribute{id='ssh_logins', type=LONG}], annotations=[]}
> already exist as:StreamDefinition{id='SSHOutStream',
> attributeList=[Attribute{id='ts', type=STRING}, Attribute{id='ssh_logins',
> type=INT}], annotations=[Annotation{name='Export',
> elements=[Element{key='null', value='SSHOutStream:1.0.0'}]}]} in execution
> plan "ExecutionPlan"
>
> I am having a hard time to understand why compiler considering same
> streams as two duplicates? I have studied samples given in WSO2CEP
> documentation and they use the same syntax. Please help.
>
> Regards, Aneela Safdar
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
--
*Dilini Muthumala*
Senior Software Engineer,
WSO2 Inc.
*E-mail :* [email protected]
*Mobile: *+94 713-400-029
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev