Bug #3372
Unexpected usage of standalone unknown value.
100%
History
#1 Updated by Ovidiu Maxiniuc over 6 years ago
FWD jumps to login screen in customer application. Searched logs and found the following exception listed as the root cause:
Caused by: java.lang.IllegalStateException: Unexpected usage of standalone unknown value. at com.goldencode.p2j.persist.HQLPreprocessor.simplifyUnknowns(HQLPreprocessor.java:3666) at com.goldencode.p2j.persist.HQLPreprocessor.mainWalk(HQLPreprocessor.java:2811) at com.goldencode.p2j.persist.HQLPreprocessor.preprocess(HQLPreprocessor.java:1212) at com.goldencode.p2j.persist.HQLPreprocessor.<init>(HQLPreprocessor.java:901) at com.goldencode.p2j.persist.HQLPreprocessor.get(HQLPreprocessor.java:723) at com.goldencode.p2j.persist.CompoundQuery$Optimizer.isServerJoinPossible(CompoundQuery.java:3365) at com.goldencode.p2j.persist.CompoundQuery$Optimizer.<init>(CompoundQuery.java:3143) at com.goldencode.p2j.persist.CompoundQuery$Optimizer.<init>(CompoundQuery.java:3113) at com.goldencode.p2j.persist.CompoundQuery.optimize(CompoundQuery.java:1884) at com.goldencode.p2j.persist.CompoundQuery.open(CompoundQuery.java:676) at com.goldencode.p2j.persist.QueryWrapper.open(QueryWrapper.java:624) [generated-code] at com.goldencode.p2j.util.Block.body(Block.java:604) at com.goldencode.p2j.util.BlockManager.processBody(BlockManager.java:6985) at com.goldencode.p2j.util.BlockManager.topLevelBlock(BlockManager.java:6776) at com.goldencode.p2j.util.BlockManager.internalProcedure(BlockManager.java:369) at com.goldencode.p2j.util.BlockManager.internalProcedure(BlockManager.java:355) ... 563 more
Investigations¶
The where
expression looks like:
upper(atable.f1) = 'A-CONSTANT' and upper(atable.f2) = ? and upper(atable.f3) = '' and upper(atable.f4) = ? and upper(atable.f5) = toString(?, '9999999999')
The problem lies in the list of parameters that HQLPreprocessor
receives: they are all unknown
s (2 characters and an integer). The first two parameters seem to be successfully converted to IS NULL
tests, but the last one fails the validation tests because of the more complex expression involving rtrim
and toString
functions.
#2 Updated by Ovidiu Maxiniuc over 6 years ago
After further investigations I learned that the rtrim
was injected after collecting toString
node to list of unknown nodes. HQLPreprocessor
expected that the parent all nodes marked as unknown
to have a binary op node (when adding to unknowns
set, FWD goes up the tree and selects the whole function chain).
Solution¶
I decided to skip the injection of rtrim
if the node is marked as unknown
. The result would also be unknown and the extra node just complicate the analysis. The application behaves normally with this patch.
#3 Updated by Eric Faulhaber over 6 years ago
Ovidiu Maxiniuc wrote:
I decided to skip the injection of
rtrim
if the node is marked asunknown
. The result would also be unknown and the extra node just complicate the analysis. The application behaves normally with this patch.
This sounds like a reasonable fix. Please put this into task branch 3296a if it does not have a home yet.
#4 Updated by Eric Faulhaber over 6 years ago
Eric Faulhaber wrote:
Please put this into task branch 3296a if it does not have a home yet.
Sorry, I meant 3369a.
#5 Updated by Ovidiu Maxiniuc over 6 years ago
- Status changed from New to WIP
- Assignee set to Ovidiu Maxiniuc
Fix committed revision 11206 in 3369a.
#6 Updated by Greg Shah over 6 years ago
- % Done changed from 0 to 100
- Status changed from WIP to Closed
Branch 3369a was merged to trunk as revision 11206.