LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Index out of bounds 16/16

    Employee
    Posted 07-17-2012 01:43

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: zon

    Hi,

    I was running a filter node, and got the error:

    ERROR processing data:
    index out of bounds: 16 / 16

    Installing log (07/17/2012 09:13:28) ...
    2012-07-17 09:20:14; Level: 2; Type: 0; Desc: "index out of bounds: 16 / 16"; File: "../../../include/jigsaw\JtArray.h"; Line: 323; Context: "JtArray<>::GetAt()"
    2012-07-17 09:20:14; Level: 2; Type: 0; Desc: "...exception seen in operator <get-at>"; File: "..\expert\ExprOperator.cpp"; Line: 34; Context: "Salmon::NED::ExprOperator::apply()"
    2012-07-17 09:20:14; Level: 2; Type: 0; Desc: "...exception seen in expression (get-at ...) starting on line 8"; File: "..\expert\Combination_Expr.cpp"; Line: 210; Context: "Salmon::NED::Combination_Expr::evaluate()"
    2012-07-17 09:20:14; Level: 2; Type: 0; Desc: "...exception seen in operator <replace>"; File: "..\expert\ExprOperator.cpp"; Line: 34; Context: "Salmon::NED::ExprOperator::apply()"
    2012-07-17 09:20:14; Level: 2; Type: 0; Desc: "...exception seen in expression (replace ...) starting on line 8"; File: "..\expert\Combination_Expr.cpp"; Line: 210; Context: "Salmon::NED::Combination_Expr::evaluate()"
    2012-07-17 09:20:14; Level: 2; Type: 0; Desc: "...exception seen"; File: ".\BrainScriptSet_ExprStmt.cpp"; Line: 80; Context: "BrainScriptSet_ExprStmt::_evaluate()"
    2012-07-17 09:20:14; Level: 2; Type: 0; Desc: "...exception seen in statement 'bs-set', line 8"; File: "..\expert\ExprStatement.cpp"; Line: 56; Context: "Salmon::NED::Statement_Expr::evaluate()"
    2012-07-17 09:20:14; Level: 2; Type: 0; Desc: "...exception seen in context: { 0(in1):3514936 }"; File: ".\ExprTableIo.cpp"; Line: 255; Context: "Salmon::ExprTableIo::processInputRows()"
    Uninstalling log (07/17/2012 09:20:14) ...

    I don't understand the issue. Can you help?

    Cheers,
    Natanael Moreira


  • 2.  RE: Index out of bounds 16/16

    Employee
    Posted 07-17-2012 02:19

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Can you post the code that you are using which encounters this error?

    It looks like you are referencing the index of a character within a string, or the index of an element within a list beyond the end of the string/list.


  • 3.  RE: Index out of bounds 16/16

    Employee
    Posted 07-17-2012 03:20

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: zon

    Originally posted by: Tim Meagher
    					

    Can you post the code that you are using which encounters this error?

    It looks like you are referencing the index of a character within a string, or the index of an element within a list beyond the end of the string/list.

    Here is the code:

    #Cria��o dos campos originais do ficheiro de Media��o
    DataList = DATA.substr(8).split(",")
    PRODUCT_INSTANCE_ID = DataList.getItem(0).replace("\"", "")
    EVENT_START_DATETIME = DataList.getItem(2).replace("\"", "")
    BA = DataList.getItem(13).replace("\"","")
    ORIGIN = DataList.getItem(14).replace("\"","")
    ORIGIN_COST_CODE = DataList.getItem(15).replace("\"","")
    DESTINATION = DataList.getItem(16).replace("\"","")
    COST_CODE= DataList.getItem(17).replace("\"","")
    DURATION = DataList.getItem(18).replace("\"","").int()
    OPERATOR = DataList.getItem(20).replace("\"","")

    #Cria��o dos campos auxiliares para c�lculo
    EVENT_START_DATE = EVENT_START_DATETIME.left(10).date("CCYY/MM/DD")
    EVENT_START_YEAR = year(EVENT_START_DATE)
    EVENT_START_MONTH = month(EVENT_START_DATE)
    EVENT_START_DAY = day(EVENT_START_DATE)
    EVENT_START_TIME = EVENT_START_DATETIME.substr(11,8).time("HH-MM-SS")
    EVENT_START_HOUR = hours(EVENT_START_TIME)
    EVENT_START_MINUTE = minutes(EVENT_START_TIME)
    EVENT_START_SECOND = seconds(EVENT_START_TIME)
    EVENT_STARTDATETIME = timestamp(date(EVENT_START_YEAR, EVENT_START_MONTH, EVENT_START_DAY), time(EVENT_START_HOUR, EVENT_START_MINUTE, EVENT_START_SECOND))
    BAINST_ID = BA+PRODUCT_INSTANCE_ID
    RECORD_ID = BAINST_ID+EVENT_STARTDATETIME+ORIGIN+DESTINATION
    EVENT_END_DATE = dateTimeAdjust(EVENT_STARTDATETIME,DURATION,"secon ds")
    EVENT_END_DAY = day(EVENT_END_DATE)
    EVENT_END_HOUR = hours(EVENT_END_DATE)
    EVENT_END_MINUTE = minutes(EVENT_END_DATE)
    EVENT_END_SECOND = seconds(EVENT_END_DATE)



    #Escreve os dados
    emit PRODUCT_INSTANCE_ID,
    BAINST_ID,
    RECORD_ID,
    EVENT_STARTDATETIME,
    EVENT_START_DATE,
    EVENT_START_YEAR,
    EVENT_START_MONTH,
    EVENT_START_DAY,
    EVENT_START_TIME,
    EVENT_START_HOUR,
    EVENT_START_MINUTE,
    EVENT_START_SECOND,
    EVENT_END_DAY,
    EVENT_END_HOUR,
    EVENT_END_MINUTE,
    EVENT_END_SECOND,
    EVENT_END_DATE,
    BA,
    ORIGIN,
    ORIGIN_COST_CODE,
    DESTINATION,
    COST_CODE,
    DURATION,
    OPERATOR
    where EVENT_START_MONTH == 6


  • 4.  RE: Index out of bounds 16/16

    Employee
    Posted 07-17-2012 04:43

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    It looks like the variable "DataList" contains less elements than you are expecting.
    Which in turn implies that the "DATA" field doesn't always contain as many comma separated entries as you are expecting.
    Therefore, when it tries to get the 16th item, it is failing.

    Tim.


  • 5.  RE: Index out of bounds 16/16

    Employee
    Posted 07-17-2012 08:35

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: zon

    Originally posted by: Tim Meagher
    					

    It looks like the variable "DataList" contains less elements than you are expecting.
    Which in turn implies that the "DATA" field doesn't always contain as many comma separated entries as you are expecting.
    Therefore, when it tries to get the 16th item, it is failing.

    Tim.
    Is there any way of take out those records, were it has less elements, without turning out error?
    It is hundreds of files, so is difficult to me to determine which has the problem.

    Cheers,
    Natanael Moreira


  • 6.  RE: Index out of bounds 16/16

    Employee
    Posted 07-17-2012 12:07

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Probably the simplest way is to create a second output on the filter node, call it "ErrorRecords" or something.
    Then change your code to be something like the following:

    DataList = DATA.substr(8).split(",")

    errorRecord = DataList.len() < 21

    if (not errorRecord) then {
    #The rest of the code for manipulating the data here
    }

    output 1 {
    emit PRODUCT_INSTANCE_ID,
    # the rest of your emit code here
    where not errorRecord and EVENT_START_MONTH == 6
    }

    output 2 {
    emit DATA
    where errorRecord
    }

    you might need to initialize some of the variables for the errorRecord case ... I don't think so though.

    Tim.