This is an automated email from the ASF dual-hosted git repository.
luoc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push:
new 087b8e3c4d DRILL-8035: Update Janino to 3.1.7 version
087b8e3c4d is described below
commit 087b8e3c4d02dd29c5357c2514d20d3a4f9180b6
Author: Volodymyr Vysotskyi <[email protected]>
AuthorDate: Sat Mar 5 10:57:57 2022 +0200
DRILL-8035: Update Janino to 3.1.7 version
---
.../drill/exec/compile/ClassTransformer.java | 2 +-
.../drill/exec/compile/JaninoClassCompiler.java | 22 +++++++++-------------
.../exec/compile/bytecode/ReplacingBasicValue.java | 18 ++++++++++--------
.../drill/exec/expr/fn/FunctionInitializer.java | 4 ++--
.../apache/drill/exec/expr/fn/ImportGrabber.java | 11 ++++++-----
.../drill/exec/expr/fn/MethodGrabbingVisitor.java | 2 +-
exec/jdbc-all/pom.xml | 2 +-
pom.xml | 2 +-
8 files changed, 31 insertions(+), 32 deletions(-)
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java
index e2ce9222e0..640cd0ebbf 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java
@@ -240,7 +240,7 @@ public class ClassTransformer {
Map<String, Pair<byte[], ClassNode>> classesToMerge = Maps.newHashMap();
for (byte[] clazz : implementationClasses) {
totalBytecodeSize += clazz.length;
- final ClassNode node = AsmUtil.classFromBytes(clazz,
ClassReader.EXPAND_FRAMES);
+ ClassNode node = AsmUtil.classFromBytes(clazz,
ClassReader.SKIP_FRAMES);
if (!AsmUtil.isClassOk(logger, "implementationClasses", node)) {
throw new IllegalStateException("Problem found with
implementationClasses");
}
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java
index 0bce966181..787d681ac4 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java
@@ -19,11 +19,11 @@ package org.apache.drill.exec.compile;
import java.io.IOException;
import java.io.StringReader;
-import java.util.HashMap;
+import java.util.Arrays;
import java.util.Map;
+import java.util.stream.Collectors;
import org.apache.drill.exec.compile.ClassTransformer.ClassNames;
-import org.apache.drill.exec.exception.ClassTransformationException;
import org.codehaus.commons.compiler.CompileException;
import org.codehaus.janino.ClassLoaderIClassLoader;
import org.codehaus.janino.IClassLoader;
@@ -36,7 +36,7 @@ import org.codehaus.janino.util.ClassFile;
class JaninoClassCompiler extends AbstractClassCompiler {
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(JaninoClassCompiler.class);
- private IClassLoader compilationClassLoader;
+ private final IClassLoader compilationClassLoader;
public JaninoClassCompiler(ClassLoader parentClassLoader, boolean debug) {
super(debug);
@@ -45,7 +45,7 @@ class JaninoClassCompiler extends AbstractClassCompiler {
@Override
protected byte[][] getByteCode(final ClassNames className, final String
sourceCode)
- throws CompileException, IOException, ClassNotFoundException,
ClassTransformationException {
+ throws CompileException, IOException {
ClassFile[] classFiles = doCompile(sourceCode);
byte[][] byteCodes = new byte[classFiles.length][];
@@ -60,19 +60,15 @@ class JaninoClassCompiler extends AbstractClassCompiler {
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());
- }
- return results;
+ return Arrays.stream(classFiles)
+ .collect(Collectors.toMap(ClassFile::getThisClassName,
ClassFile::toByteArray, (a, b) -> b));
}
private ClassFile[] doCompile(final String sourceCode)
- throws CompileException, IOException, ClassNotFoundException {
+ throws CompileException, IOException {
StringReader reader = new StringReader(sourceCode);
- Scanner scanner = new Scanner((String) null, reader);
- Java.CompilationUnit compilationUnit = new
Parser(scanner).parseCompilationUnit();
+ Scanner scanner = new Scanner(null, reader);
+ Java.AbstractCompilationUnit compilationUnit = new
Parser(scanner).parseAbstractCompilationUnit();
return new UnitCompiler(compilationUnit, compilationClassLoader)
.compileUnit(this.debug, this.debug,
this.debug);
}
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java
index 42c8685ef3..5654bfc11a 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java
@@ -283,14 +283,16 @@ public class ReplacingBasicValue extends BasicValue {
if (AssertionUtil.ASSERT_ENABLED) {
assert associates == other.associates;
assert flagSet == other.flagSet;
- assert associates.containsKey(this);
- assert associates.containsKey(other);
-
- // check all the other values as well
- for(ReplacingBasicValue value : associates.keySet()) {
- assert associates.get(value) == null; // we never use the value
- assert value.associates == associates;
- assert value.flagSet == flagSet;
+ if (associates != null) {
+ assert associates.containsKey(this);
+ assert associates.containsKey(other);
+
+ // check all the other values as well
+ for(ReplacingBasicValue value : associates.keySet()) {
+ assert associates.get(value) == null; // we never use the value
+ assert value.associates == associates;
+ assert value.flagSet == flagSet;
+ }
}
}
}
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java
index 2b9d2230ef..dfaf380f04 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java
@@ -150,7 +150,7 @@ public class FunctionInitializer {
// TODO: Hack to remove annotations so Janino doesn't choke. Need to
reconsider this problem...
body = body.replaceAll("@\\w+(?:\\([^\\\\]*?\\))?", "");
try {
- return new Parser(new Scanner(null, new
StringReader(body))).parseCompilationUnit();
+ return (CompilationUnit) new Parser(new Scanner(null, new
StringReader(body))).parseAbstractCompilationUnit();
} catch (CompileException e) {
throw new IOException(String.format("Failure while loading class
%s.", clazz.getName()), e);
}
@@ -159,4 +159,4 @@ public class FunctionInitializer {
}
-}
\ No newline at end of file
+}
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java
index 3e67ebf0d9..2319ae211d 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java
@@ -18,13 +18,14 @@
package org.apache.drill.exec.expr.fn;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.codehaus.janino.Java;
-import org.codehaus.janino.Java.CompilationUnit.SingleStaticImportDeclaration;
-import org.codehaus.janino.Java.CompilationUnit.SingleTypeImportDeclaration;
-import
org.codehaus.janino.Java.CompilationUnit.StaticImportOnDemandDeclaration;
-import org.codehaus.janino.Java.CompilationUnit.TypeImportOnDemandDeclaration;
+import
org.codehaus.janino.Java.AbstractCompilationUnit.SingleStaticImportDeclaration;
+import
org.codehaus.janino.Java.AbstractCompilationUnit.SingleTypeImportDeclaration;
+import
org.codehaus.janino.Java.AbstractCompilationUnit.StaticImportOnDemandDeclaration;
+import
org.codehaus.janino.Java.AbstractCompilationUnit.TypeImportOnDemandDeclaration;
import org.codehaus.janino.util.AbstractTraverser;
public class ImportGrabber {
@@ -45,7 +46,7 @@ public class ImportGrabber {
*/
public static List<String> getImports(Java.CompilationUnit compilationUnit) {
ImportGrabber visitor = new ImportGrabber();
-
compilationUnit.importDeclarations.forEach(visitor.importFinder::visitImportDeclaration);
+
Arrays.stream(compilationUnit.importDeclarations).forEach(visitor.importFinder::visitImportDeclaration);
return visitor.imports;
}
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java
index 18cc4e47cb..b1c1713c38 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java
@@ -106,7 +106,7 @@ public class MethodGrabbingVisitor {
try {
// replaces return statements and stores the result into
methodBodyBlock
methodBodyBlock.addStatements(
-
returnStatementReplacer.copyBlockStatements(methodDeclarator.optionalStatements));
+
returnStatementReplacer.copyBlockStatements(methodDeclarator.statements));
} catch (CompileException e) {
throw new RuntimeException(e);
}
diff --git a/exec/jdbc-all/pom.xml b/exec/jdbc-all/pom.xml
index d40a7d941e..e29dc5ea65 100644
--- a/exec/jdbc-all/pom.xml
+++ b/exec/jdbc-all/pom.xml
@@ -34,7 +34,7 @@
"package.namespace.prefix" equals to "oadd.". It can be overridden if
necessary within any profile -->
<properties>
<package.namespace.prefix>oadd.</package.namespace.prefix>
- <jdbc-all-jar.maxsize>49400000</jdbc-all-jar.maxsize>
+ <jdbc-all-jar.maxsize>50000000</jdbc-all-jar.maxsize>
</properties>
<dependencies>
diff --git a/pom.xml b/pom.xml
index ba8d4d5c96..d966cbc4de 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,7 +63,7 @@
<calcite.groupId>com.github.vvysotskyi.drill-calcite</calcite.groupId>
<calcite.version>1.21.0-drill-r8</calcite.version>
<avatica.version>1.17.0</avatica.version>
- <janino.version>3.0.11</janino.version>
+ <janino.version>3.1.7</janino.version>
<sqlline.version>1.12.0</sqlline.version>
<jackson.version>2.13.2.20220328</jackson.version>
<zookeeper.version>3.5.7</zookeeper.version>