siddhi-io / siddhi

Stream Processing and Complex Event Processing Engine
http://siddhi.io
Apache License 2.0
1.52k stars 529 forks source link

DuplicateDefinitionException #1773

Open webfrank opened 2 years ago

webfrank commented 2 years ago

Description: I was trying to aggregate some data over a time batch window and insert into db

Affected Siddhi Version: 5.1.2

OS, DB, other environment details and versions:
Docker container image 5.1.2

Steps to reproduce:

@app:name('netflow')

@source(type="mqtt", ..., @map(type = 'json'))
define stream Source (
    version int,
    flow_seq_num long,
    flowset_id int,
    protocol int,
    input_snmp int,
    output_snmp int,
    first_switched long,
    last_switched long,
    host string,
    ts long,
    tenant string,
    dst string,
    dhost string,
    src string,
    shost string,
    dport int,
    sport int,
    packets int,
    bytes int
);

@Store(type="rdbms", ...)
define table NetFlow (
    ts long,
    host string,
    src string,
    dst string,
    shost string,
    dhost string,
    sport int,
    dport int,
    packets int,
    bytes int,
    tenant string,
    first_switched long,
    last_switched long,
    snmp_in int,
    snmp_out int,
    protocol int
);

from Source#window.timeBatch(30 seconds)#log("INFO", "Sample Event :", true)
select
    max(ts) as ts,
    host,
    src,
    dst,
    shost,
    dhost,
    sport,
    dport,
    sum(packets) as packets,
    sum(bytes) as bytes,
    tenant,
    min(first_switched) as first_switched,
    max(last_switched) as last_switched,
    input_snmp as snmp_in,
    output_snmp as snmp_out, 
    protocol
group by tenant,src,dst,shost,dhost,sport,dport,protocol,host,input_snmp,output_snmp 
insert current events into NetFlow;

When I start the runner I got this error:


Caused by: io.siddhi.query.api.exception.DuplicateDefinitionException: Error on 'netflow' @ Line: 76. Position: 34, near 'insert current events into NetFlow. Error between @ Line: 76. Position: 0 and @ Line: 76. Position: 34. Different definition same as output 'define stream NetFlow (ts long, host string, src string, dst string, shost string, dhost string, sport int, dport int, packets long, bytes long, tenant string, first_switched long, last_switched long, snmp_in int, snmp_out int, protocol int)' already exist as '@Store( type = "rdbms",...)define table NetFlow (ts long, host string, src string, dst string, shost string, dhost string, sport int, dport int, packets int, bytes int, tenant string, first_switched long, last_switched long, snmp_in int, snmp_out int, protocol int)'
        at io.siddhi.core.util.parser.QueryParser.parse(QueryParser.java:275)

**Related Issues:**
<!-- Any related issues such as sub tasks, issues reported in other repositories (e.g component repositories), similar problems, etc. -->