Bug #10302
checkUniqueFind in FQLPreprocessor doesn't work properly
0%
History
#1 Updated by Andrei Plugaru about 1 year ago
While working on #8279, I tried to understand how many AdaptiveQuery s have the where clause matching an unique index and the fields mandatory. In order to do that, I am calling getUniqueIndexLookup on the fqlp of the components. The problem is that getUniqueIndexLookup returns null for the FQLPreprocessor s of the components in AdaptiveQuery.execute.
The cause for that seems to be the matches from FQLPreprocessor.checkUniqueFind. For this query: for each tt2 where tt2.id = 1, it seems that rvalType for the match is PROPERTY, even though it would need to be NUM_LITERAL or SUBST. The cause is the called constructor for PropertyMatch:
private PropertyMatch(String alias,
String property,
String secondAlias,
String secondProperty,
int operator)
{
this.alias = alias;
this.property = property;
this.secondAlias = secondAlias;
this.secondProperty = secondProperty;
this.rval = null;
this.operator = operator;
this.rvalType = HQLParserTokenTypes.PROPERTY;
this.isAliasFirst = false;
this.substIndex = -1;
}
There is also a constructor which doesn't hard codes the
rvalType, however it is not called in my scenario.#2 Updated by Andrei Plugaru 12 months ago
While working on another task, I probably discovered a functional issue in FWD caused by the problem reported in this task.
DEF TEMP-TABLE tt1 FIELD a AS INT FIELD b AS INT FIELD c AS INT index idx as unique a.
create tt1.
tt1.a = ?.
tt1.b = 2.
tt1.c = 3.
create tt1.
tt1.a = ?.
tt1.b = 1.
tt1.c = 1.
for each tt1 where tt1.a = ? by tt1.b:
message tt1.b. // OE: 1 2; FWD: 1 2
end.
message 'inverse'.
for each tt1 where tt1.a = ? by tt1.b desc:
message tt1.b. // OE: 1 2; FWD: 2 1
end.
The problem seems to also be that getUniqueIndexLookup returns null even if it shouldn't.