okumin commented on code in PR #5856:
URL: https://github.com/apache/hive/pull/5856#discussion_r2152218530
##########
pom.xml:
##########
@@ -420,9 +420,14 @@
<version>${commons-math3.version}</version>
</dependency>
<dependency>
- <groupId>org.openjdk.nashorn</groupId>
- <artifactId>nashorn-core</artifactId>
- <version>${nashorn.version}</version>
+ <groupId>org.graalvm.js</groupId>
+ <artifactId>js-scriptengine</artifactId>
+ <version>${graalvm.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.graalvm.js</groupId>
+ <artifactId>js</artifactId>
+ <version>${graalvm.version}</version>
Review Comment:
Both libraries are licensed as UPL. It's fine as it's classified as
[Category A](https://www.apache.org/legal/resolved.html).
- https://mvnrepository.com/artifact/org.graalvm.js/js-scriptengine/23.0.8
- https://mvnrepository.com/artifact/org.graalvm.js/js/23.0.8
##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/PartitionTree.java:
##########
@@ -258,21 +254,20 @@ List<Partition> getPartitionsByFilter(final String
filter) throws MetaException
return new ArrayList<>(parts.values());
}
List<Partition> result = new ArrayList<>();
- ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
- if (se == null) {
- LOG.error("JavaScript script engine is not found, therefore partition
filtering "
- + "for temporary tables is disabled.");
- return result;
- }
- for (Map.Entry<String, Partition> entry : parts.entrySet()) {
- se.put("partitionName", entry.getKey());
- se.put("values", entry.getValue().getValues());
- try {
- if ((Boolean)se.eval(filter)) {
- result.add(entry.getValue());
+ try (GraalJSScriptEngine se = GraalJSScriptEngine.create(null,
+ Context.newBuilder().allowExperimentalOptions(true)
+ .option("js.nashorn-compat", "true")
+ .allowAllAccess(true))) {
Review Comment:
I'm checking this document.
https://www.graalvm.org/latest/reference-manual/js/NashornMigrationGuide/
I guess `allowAllAccess(true)` is redundant:
https://github.com/oracle/graaljs/blob/release/graal-vm/23.0/graal-js/src/com.oracle.truffle.js.scriptengine/src/com/oracle/truffle/js/scriptengine/GraalJSScriptEngine.java#L346
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]