Github user jinfengni commented on a diff in the pull request:
https://github.com/apache/drill/pull/660#discussion_r93127937
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java
---
@@ -58,5 +56,27 @@ public JaninoClassCompiler(ClassLoader
parentClassLoader, boolean debug) {
}
@Override
+ public Map<String,byte[]> compile(final ClassNames className, final
String sourceCode)
+ throws CompileException, IOException, ClassNotFoundException {
+
+ ClassFile[] classFiles = doCompile(sourceCode);
+ Map<String,byte[]> results = new HashMap<>();
+ for(int i = 0; i < classFiles.length; i++) {
+ ClassFile classFile = classFiles[i];
+ results.put(classFile.getThisClassName(), classFile.toByteArray());
--- End diff --
Will it defeat the purpose of caching the compiled class, if the key in the
cache is the class name? The class name, if I understand correctly, is like
org.apache.drill.exec.test.generated.ProjectGenNNN, where NNN is a sequence
number. It's possible that two queries may require same generated code, but
with different sequence number. Using class name this way seems to indicate
multiple copies of code would be complied.
For now, it is fine if the purpose is for adding debugging option using
plain-old class. But it may cause some performance overhead, in the future.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---