unexpected AST node from where (id1,id2) in ((1,2), (3,4))

Description

ANSI SQL allows: WHERE ((id1, id2)) IN ((1,2), (3,4)); but the HQL parser throws org.hibernate.hql.ast.QuerySyntaxException (see stack trace below). I've fixed this by modifying hql.g and sql-gen.g (attached below). Note that these mods caused a NullPointerException due to use of LA(0) in weakKeywords() (see HHH-1885) that I worked around by adding LT(0) != null
before the LA(0) call; however, this does NOT fix the underlying problem [the use of LA(0)]

org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: {vector} [select new com.timestock.tess.data.objects.StatsAggregationData(b.id,b.user,b.transet,b.tranunit,b.userGroup,b.transetGroup,...) from com.timestock.tess.data.objects.StatsTranSetUserGroupInterval b where b.intervalStartTime >= :startTime and b.intervalStartTime < :endTime and (b.transet,b.userGroup) in ((0,0),(600000000000000030,600000000000000137))
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:209)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:178)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:134)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:113)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1602)
at com.timestock.tess.util.StatisticsAggregation.getDatabaseRows(StatisticsAggregation.java:410)
at com.timestock.tess.util.StatisticsAggregation.getDatabaseRows(StatisticsAggregation.java:334)
at com.timestock.tess.util.StatisticsAggregation.getAggregatedRows(StatisticsAggregation.java:222)
at com.timestock.tess.util.TranSetAggregation.AggregateGroup(TranSetAggregation.java:259)
at com.timestock.tess.util.TranSetAggregation.AggregateGroupHourly(TranSetAggregation.java:69)
at com.timestock.tess.services.processors.StatsProcessor.doIntervalAggregation(StatsProcessor.java:732)
at com.timestock.tess.services.processors.StatsProcessor.doIntervalAggregations(StatsProcessor.java:705)
at com.timestock.tess.services.processors.StatsProcessor.processStats(StatsProcessor.java:418)
at com.timestock.tess.services.collectors.StatsCollector$StatisticsCollector.run(StatsCollector.java:559)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: <AST>:0:0: unexpected AST node: {vector}
at org.hibernate.hql.antlr.SqlGeneratorBase.inList(SqlGeneratorBase.java:3016)
at org.hibernate.hql.antlr.SqlGeneratorBase.exoticComparisonExpression(SqlGeneratorBase.java:2831)
at org.hibernate.hql.antlr.SqlGeneratorBase.comparisonExpr(SqlGeneratorBase.java:1203)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:851)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanOp(SqlGeneratorBase.java:2541)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:831)
at org.hibernate.hql.antlr.SqlGeneratorBase.whereExpr(SqlGeneratorBase.java:724)
at org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:184)
at org.hibernate.hql.antlr.SqlGeneratorBase.statement(SqlGeneratorBase.java:117)
at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:203)
... 19 more

Environment

Hibernate 3.1.2 Postgres 8.1.2

Attachments

Assignee

Unassigned

Reporter

Brian Cox

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure