NullPointerException during optimizer tracing
The optimizer attempts to rewrite the expression
$x[position() < $n] as @subsequence($x, 1, $n - 1)@. If optimizer tracing is switched on, the attempt to display the subsequence expression fails because properties of the arithmetic expression ($n - 1) - specifically the calculator property - are not yet available.
In addition, it seems that running from the command line with the -export option has the side-effect of switching on optimizer tracing. They should be controlled separately.
#2 Updated by Michael Kay almost 4 years ago
- Status changed from In Progress to Resolved
- Applies to branch 9.8 added
- Fix Committed on Branch 9.7, 9.8 added
Fix committed on both the 9.7 and 9.8 branches.
For the NPE, I did a belt-and-braces approach: (a) immediately after generating the ArithmeticExpression, we set the calculator on it. (b) during explain() processing, we don't attempt to output the calculator code if it is not known. This is fine during explain, but could cause a problem in export; however, the calculator code should have been allocated by then.
Please register to edit this issue