Hi Drill devs,
Since I recently worked on a bug fix for which I need to test with a query
and that query triggered a mysterious error:
org.objectweb.asm.tree.analysis.AnalyzerException: Expected an object
reference, but found .
The error stack was printed during drillbit running, meanwhile correct
results are still returned. But the same query will fail in unit test.
Since this error was triggered inside ScalarReplacementNode, I had to do a
little bit investigation into the ScalarReplacement which is some
optimization we are doing on generated java byte code. Basically it was
about changing how local variables are defined and then replace their
references around the code accordingly. But since in some cases Drill is
not doing the replacement correctly, we may eventually get some invalid
byte codes. So we added a mechanism to allow Drill to handle these errors:
if Drill capture some exception during this process, under the "TRY" mode
we configured for actual drillbit, we will fall back to "not trying" this
scalar replacement and drill can still run the query and return results.
But in unit tests, we are using "ON" mode( -Dorg.apache.drill.exec.
exec.compile.ClassTransformer.scalar_replacement=on") , the same sql will
fail in unit tests.
Since we are doing this byte code modification, I am curious about what is
the benefit of this Scalar replacement, if we fall back to original
results, what do we lose? Do we have performance number to justify this
ScalarReplacement? If there were some documents/discussions and performance
tests for it previously, could you please point me to them?