BenJFan opened a new issue #1557:
URL: https://github.com/apache/incubator-seatunnel/issues/1557


   ### Search before asking
   
   - [X] I had searched in the 
[feature](https://github.com/apache/incubator-seatunnel/issues?q=is%3Aissue+label%3A%22Feature%22)
 and found no similar feature requirement.
   
   
   ### Description
   
   ## Target
   In order to realize the rapid development of plug-ins, the convenience and 
speed of developing plug-ins are increased. Supports the multilingualization of 
plug-ins, so that plug-in developers can quickly develop plug-ins in languages 
they are familiar with. To help SeaTunnel rapidly expand its capabilities, here 
are a few ways to achieve multilingualism.
   ## GraalVM
   ### Simple Design
   > Python is used as an example here, and the same is true for other 
languages such as Javascript
   
   Using the capabilities of GraalVM, SeaTunnel defines a specific Connector 
Python interface. The interface developer implements the corresponding Python 
code file, and calls the Python Connector logic implemented by the developer 
through the Graal SDK. Then convert to the common data format of SeaTunnel 
platform.
   
    
   ```Python
   // Python interface
   
   def open():
       pass
   
   def get_data(info):
       pass
   ```
   
   ``` Java 
   // Java Demo
   private static final String PYTHON_SOURCE = /* ... */;
   private Context polyglotContext = 
Context.newBuilder("python").allowAllAccess(true).build();
   
   private Row getData(String info) {
      polyglotContext.eval("python", PYTHON_SOURCE);
      Value getDataFunction = 
polyglotContext.getBindings("python").getMember("get_data");
      return getDataFunction.execute(info).as(Row.class);
   }
   
   ```
   
   ### Problem
   1. Since it runs on a Flink/Spark cluster, all nodes in the cluster need to 
run GraalVM to support multiple languages
   2. License problem, we use GraalVM SDK (UPL), User use Graal VM (GPL2). Does 
this affect the license of our project?
   3. At least use JDK 11
   
   ### Reference
   1. https://github.com/oracle/graal
   2. https://blogs.oracle.com/javamagazine/post/java-graalvm-polyglot-python-r
   3. 
https://blogs.oracle.com/java/post/apache-sparklightning-fast-on-graalvm-enterprise
   ## Jython
   ### Simple Design
   Same with GraalVM, We can call python file in Java code, but we don't need 
install GraalVM, just use default vm is enough
   ### Problem
   1. Jython only support python version is 2.x, 3.x doesn't supported.
   2. Jython is slow than GraalVM
   ### Reference
   1. https://www.jython.org/
   ## Nashorn
   > Java 8 default javascript engine
   ### Simple Design
   Same with Jython, can call javascript file in Java code.
   ### Problem
   ### Reference
   1. https://www.oracle.com/technical-resources/articles/java/jf14-nashorn.html
   ## Dependency
   We should package Java/Python/Javascript dependency in release package, 
Including connector used dependency.
   
   
   ### Usage Scenario
   
   _No response_
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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]


Reply via email to