Runtime exception occurs while executing query, "select /#Math/round(lt.EventId,10) from /Concepts/LogTiming lt".

Runtime exception occurs while executing query, "select /#Math/round(lt.EventId,10) from /Concepts/LogTiming lt".

book

Article ID: KB0084742

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Resolution:
Description:
==========
The documentation says that any built in functon with a q can be used in a query. I am able to use /#DateTime/ and /#String/ functios but not /#Math/ or /#Number functions.  I am wondering why?

Environment:
==========
BusinessEvents 5.0.0

Symptoms:
=========
Query:
select /#Math/round(lt.EventId,10) from /Concepts/LogTiming lt;

Error:
2011 Jun 21 10:10:28:525 GMT +8 192.168.69.49 Error [com.tibco.cep.runtime.service.debug.DebuggerService] - [runtime.service] [inference-class] Got runtime exception while executing Rule be.gen.Rules.QueryCreation_math(Rules.QueryCreation_math) Action be.gen.Rules.QueryCreation_math$QueryCreation_math_a@2596c1 Objects &ltbe.gen.Events.TRYEvent@id=6>
java.lang.RuntimeException: com.tibco.cep.query.api.QueryException: com.tibco.cep.query.exception.ParseException: Line:1 Position:9 Error:mismatched input 'Math' expecting set null
    at com.tibco.cep.query.functions.QueryFunctions.create(QueryFunctions.java:95)
    at be.gen.RuleFunctions.ObjectTestQueryUtilObject$.TestQueryUtil(ObjectTestQueryUtilObject$.java:20)
    at be.gen.RuleFunctions.TestQueryUtil.invoke(TestQueryUtil.java:13)
    at com.tibco.cep.query.functions.QueryUtilFunctions.callRF(QueryUtilFunctions.java:102)
    at com.tibco.cep.query.functions.QueryUtilFunctions.invokeFunctionInQuerySession(QueryUtilFunctions.java:83)
    at be.gen.Rules.QueryCreation_math$QueryCreation_math_a.execute(QueryCreation_math.java:49)
    at com.tibco.cep.kernel.core.rete.ReteWM.a(SourceFile:305)
    at com.tibco.cep.kernel.core.rete.ReteWM.do(SourceFile:283)
    at com.tibco.cep.kernel.core.rete.ReteWM.assertObject(SourceFile:1522)
    at com.tibco.cep.runtime.session.impl.RuleSessionImpl.assertObject(RuleSessionImpl.java:1214)
    at com.tibco.cep.runtime.service.debug.DebugTaskImpl.run(DebugTaskImpl.java:97)
    at com.tibco.cep.runtime.service.debug.DebuggerService.processTask(DebuggerService.java:221)
    at com.tibco.cep.runtime.service.debug.DebuggerService.run(DebuggerService.java:202)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: com.tibco.cep.query.api.QueryException: com.tibco.cep.query.exception.ParseException: Line:1 Position:9 Error:mismatched input 'Math' expecting set null
    at com.tibco.cep.query.service.impl.QueryImpl.&ltinit>(QueryImpl.java:107)
    at com.tibco.cep.query.service.impl.QueryRuleSessionImpl.createQuery(QueryRuleSessionImpl.java:219)
    at com.tibco.cep.query.functions.QueryFunctions.create(QueryFunctions.java:86)
    ... 15 more
Caused by: com.tibco.cep.query.exception.ParseException: Line:1 Position:9 Error:mismatched input 'Math' expecting set null
    at com.tibco.cep.query.ast.parser.ParserUtil.parse(ParserUtil.java:74)
    at com.tibco.cep.query.ast.parser.ParserUtil.getAST(ParserUtil.java:88)
    at com.tibco.cep.query.service.impl.QueryImpl.parseOql(QueryImpl.java:156)
    at com.tibco.cep.query.service.impl.QueryImpl.&ltinit>(QueryImpl.java:93)
    ... 17 more
    
Resolution:
=========    
Remove the "#" character in front of Math. The "#" character is used to escape a set of reserved words. Math and Number are not reserved words. Refer to the BE document --> Developer's Guide --> Rule Language Grammar --> Keywords and Other Reserved Words for the list of reserved words.

Issue/Introduction

Runtime exception occurs while executing query, "select /#Math/round(lt.EventId,10) from /Concepts/LogTiming lt".