2

When creating a sessionWindowEngine, the server reported an error: "A table can't contain duplicate column names." However, both my input and output tables are properly defined and do not contain duplicate column names. What is the reason for this error, and how can I modify the script to execute the code correctly?

The definition of the input table is as follows:

ofpanel_colnames = [
"TimeStamp_1",
'ID_1', 'UpperLimit_1', 'LowerLimit_1',
'PreOpenInt_1',
'OpenPrice_1', 'HighPrice_1', 'LowPrice_1', 'LastPrice_1',
'BidPrice_1', 'BidVol_1', 'AskPrice_1', 'AskVol_1',
'Volume_1', 'Amount_1', 'OpenInt_1',
'ClosePrice_1', 'SettlePrice_1',
'ReceiveTime_1',
'UnderlyingID',
"TimeStamp_2",
'ID_2', 'UpperLimit_2', 'LowerLimit_2',
'BidPrice_2', 'BidVol_2', 'AskPrice_2', 'AskVol_2',
'ReceiveTime_2'
]
ofpanel_colTypes = [
TIMESTAMP,
SYMBOL, DOUBLE, DOUBLE,
DOUBLE,
DOUBLE, DOUBLE, DOUBLE, DOUBLE,
DOUBLE, INT, DOUBLE, INT,
INT, DOUBLE, DOUBLE,
DOUBLE, DOUBLE,
NANOTIMESTAMP,
STRING,
TIMESTAMP,
SYMBOL, DOUBLE, DOUBLE,
DOUBLE, INT, DOUBLE, INT,
NANOTIMESTAMP
]
share streamTable(1:0, ofpanel_colnames, ofpanel_colTypes ) as ofPanel_stream

The output table is defined as follows:

try{dropStreamTable("SampleStream")}catch(ex){print(ex)}
share streamTable(
 1:0,
 ["LogTime","InstrumentID","TimeStamp_1","ID_1","UpperLimit_1","LowerLimit_1","PreOpenInt_1"],
 [TIMESTAMP,STRING,TIMESTAMP,STRING,DOUBLE, DOUBLE, INT]
) as SampleStream

The engine creation script is as follows:

try{dropStreamEngine(name="DataProcessor")}catch(ex){print(ex)}
engine_ = createSessionWindowEngine(
 name = 'DataProcessor', 
 sessionGap = 30*1000, // 30s response window
 metrics=<[
 last(TimeStamp_1),
 last(ID_1),
 last(UpperLimit_1),
 last(LowerLimit_1),
 last(PreOpenInt_1)
 ]>, 
 dummyTable = ofPanel_stream, 
 outputTable = SampleStream, 
 useSystemTime=true, 
 keyColumn = `ID_1,
 useSessionStartTime=true
)

The definition of the input table is as follows:

ofpanel_colnames = [
 "TimeStamp_1",
 'ID_1', 'UpperLimit_1', 'LowerLimit_1',
 'PreOpenInt_1',
 'OpenPrice_1', 'HighPrice_1', 'LowPrice_1', 'LastPrice_1',
 'BidPrice_1', 'BidVol_1', 'AskPrice_1', 'AskVol_1',
 'Volume_1', 'Amount_1', 'OpenInt_1',
 'ClosePrice_1', 'SettlePrice_1',
 'ReceiveTime_1',
 'UnderlyingID',
 "TimeStamp_2",
 'ID_2', 'UpperLimit_2', 'LowerLimit_2',
 'BidPrice_2', 'BidVol_2', 'AskPrice_2', 'AskVol_2',
 'ReceiveTime_2'
]
ofpanel_colTypes = [
 TIMESTAMP, 
 SYMBOL, DOUBLE, DOUBLE, 
 DOUBLE, 
 DOUBLE, DOUBLE, DOUBLE, DOUBLE, 
 DOUBLE, INT, DOUBLE, INT, 
 INT, DOUBLE, DOUBLE, 
 DOUBLE, DOUBLE,
 NANOTIMESTAMP,
 STRING,
 TIMESTAMP, 
 SYMBOL, DOUBLE, DOUBLE, 
 DOUBLE, INT, DOUBLE, INT, 
 NANOTIMESTAMP
]
share streamTable(1:0, ofpanel_colnames, ofpanel_colTypes ) as ofPanel_stream

The output table is defined as follows:

try{dropStreamTable("SampleStream")}catch(ex){print(ex)}
share streamTable(
 1:0,
 ["LogTime","InstrumentID","TimeStamp_1","ID_1","UpperLimit_1","LowerLimit_1","PreOpenInt_1"],
 [TIMESTAMP,STRING,TIMESTAMP,STRING,DOUBLE, DOUBLE, INT]
) as SampleStream

The engine creation script is as follows:

try{dropStreamEngine(name="DataProcessor")}catch(ex){print(ex)}
engine_ = createSessionWindowEngine(
 name = 'DataProcessor', 
 sessionGap = 30*1000, // 30s response window
 metrics=<[
 last(TimeStamp_1),
 last(ID_1),
 last(UpperLimit_1),
 last(LowerLimit_1),
 last(PreOpenInt_1)
 ]>, 
 dummyTable = ofPanel_stream, 
 outputTable = SampleStream, 
 useSystemTime=true, 
 keyColumn = `ID_1,
 useSessionStartTime=true
)
asked Jul 21, 2025 at 5:23
1
  • Consider removing last(ID_1) from the metrics. Since ID_1 is specified as the keyColumn for grouping, including it in the metrics calculation might cause unexpected behavior. Commented Jul 24, 2025 at 3:45

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.