This is an automated email from the ASF dual-hosted git repository. jongyoul pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push: new 4d9cc83c29 [ZEPPELIN-5770] Remove hazelcast jet interpreter (#4412) 4d9cc83c29 is described below commit 4d9cc83c294bea6863c7521c811dc7ac9f731713 Author: 배진우 <55564829+jinwoo-...@users.noreply.github.com> AuthorDate: Fri Jul 22 18:02:51 2022 +0900 [ZEPPELIN-5770] Remove hazelcast jet interpreter (#4412) --- .github/workflows/core.yml | 2 +- .github/workflows/frontend.yml | 2 +- conf/interpreter-list | 1 - dev/create_release.sh | 2 +- docs/_includes/themes/zeppelin/_navigation.html | 1 - docs/index.md | 1 - docs/interpreter/hazelcastjet.md | 143 --------------------- hazelcastjet/README.md | 19 --- hazelcastjet/pom.xml | 73 ----------- .../hazelcastjet/HazelcastJetInterpreter.java | 33 ----- .../hazelcastjet/HazelcastJetInterpreterUtils.java | 131 ------------------- .../src/main/resources/interpreter-setting.json | 14 -- .../hazelcastjet/HazelcastJetInterpreterTest.java | 99 -------------- .../HazelcastJetInterpreterUtilsTest.java | 135 ------------------- pom.xml | 1 - zeppelin-distribution/src/bin_license/LICENSE | 1 - 16 files changed, 3 insertions(+), 655 deletions(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index bc5012f4c5..3f0c88ec2d 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -82,7 +82,7 @@ jobs: interpreter-test-non-core: runs-on: ubuntu-20.04 env: - INTERPRETERS: 'beam,hbase,pig,jdbc,file,flink-cmd,ignite,cassandra,elasticsearch,bigquery,alluxio,livy,groovy,sap,java,geode,neo4j,hazelcastjet,submarine,sparql,mongodb,influxdb,ksql' + INTERPRETERS: 'beam,hbase,pig,jdbc,file,flink-cmd,ignite,cassandra,elasticsearch,bigquery,alluxio,livy,groovy,sap,java,geode,neo4j,submarine,sparql,mongodb,influxdb,ksql' steps: - name: Checkout uses: actions/checkout@v2 diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 01c26164b2..c1c637a03f 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -19,7 +19,7 @@ env: SPARK_PRINT_LAUNCH_COMMAND: "true" SPARK_LOCAL_IP: 127.0.0.1 ZEPPELIN_LOCAL_IP: 127.0.0.1 - INTERPRETERS: '!beam,!hbase,!pig,!jdbc,!file,!flink,!ignite,!cassandra,!elasticsearch,!bigquery,!alluxio,!livy,!groovy,!sap,!java,!geode,!neo4j,!hazelcastjet,!submarine,!sparql,!mongodb' + INTERPRETERS: '!beam,!hbase,!pig,!jdbc,!file,!flink,!ignite,!cassandra,!elasticsearch,!bigquery,!alluxio,!livy,!groovy,!sap,!java,!geode,!neo4j,!submarine,!sparql,!mongodb' jobs: run-e2e-tests-in-zeppelin-web: diff --git a/conf/interpreter-list b/conf/interpreter-list index 766c66fa96..dbdac74400 100644 --- a/conf/interpreter-list +++ b/conf/interpreter-list @@ -27,7 +27,6 @@ file org.apache.zeppelin:zeppelin-file:0.10.0 HDFS fi flink org.apache.zeppelin:zeppelin-flink:0.10.0 Flink interpreter geode org.apache.zeppelin:zeppelin-geode:0.10.0 Apache Geode interpreter groovy org.apache.zeppelin:zeppelin-groovy:0.10.0 Groovy interpreter -hazelcastjet org.apache.zeppelin:zeppelin-hazelcastjet:0.10.0 Hazelcast Jet interpreter hbase org.apache.zeppelin:zeppelin-hbase:0.10.0 Hbase interpreter ignite org.apache.zeppelin:zeppelin-ignite:0.10.0 Ignite interpreter java org.apache.zeppelin:zeppelin-java:0.10.0 Java interpreter diff --git a/dev/create_release.sh b/dev/create_release.sh index a9571502b6..d35ff95104 100755 --- a/dev/create_release.sh +++ b/dev/create_release.sh @@ -98,7 +98,7 @@ function make_binary_release() { git_clone make_source_package -make_binary_release netinst "-Pweb-angular -Phadoop-2.6 -pl !beam,!hbase,!pig,!jdbc,!file,!flink,!ignite,!cassandra,!elasticsearch,!bigquery,!alluxio,!livy,!groovy,!sap,!java,!geode,!neo4j,!hazelcastjet,!submarine,!sparql,!mongodb,!ksql -am" +make_binary_release netinst "-Pweb-angular -Phadoop-2.6 -pl !beam,!hbase,!pig,!jdbc,!file,!flink,!ignite,!cassandra,!elasticsearch,!bigquery,!alluxio,!livy,!groovy,!sap,!java,!geode,!neo4j,!submarine,!sparql,!mongodb,!ksql -am" make_binary_release all "-Pweb-angular -Phadoop-2.6" # remove non release files and dirs diff --git a/docs/_includes/themes/zeppelin/_navigation.html b/docs/_includes/themes/zeppelin/_navigation.html index d7b0cb9fbc..1c93e0d764 100644 --- a/docs/_includes/themes/zeppelin/_navigation.html +++ b/docs/_includes/themes/zeppelin/_navigation.html @@ -145,7 +145,6 @@ <li><a href="{{BASE_PATH}}/interpreter/elasticsearch.html">Elasticsearch</a></li> <li><a href="{{BASE_PATH}}/interpreter/geode.html">Geode</a></li> <li><a href="{{BASE_PATH}}/interpreter/groovy.html">Groovy</a></li> - <li><a href="{{BASE_PATH}}/interpreter/hazelcastjet.html">Hazelcast Jet</a></li> <li><a href="{{BASE_PATH}}/interpreter/hbase.html">HBase</a></li> <li><a href="{{BASE_PATH}}/interpreter/hdfs.html">HDFS</a></li> <li><a href="{{BASE_PATH}}/interpreter/hive.html">Hive</a></li> diff --git a/docs/index.md b/docs/index.md index 8837b3b95b..e926aa7f48 100644 --- a/docs/index.md +++ b/docs/index.md @@ -142,7 +142,6 @@ limitations under the License. * [Flink](./interpreter/flink.html) * [Geode](./interpreter/geode.html) * [Groovy](./interpreter/groovy.html) - * [Hazelcast Jet](./interpreter/hazelcastjet.html) * [HBase](./interpreter/hbase.html) * [HDFS](./interpreter/hdfs.html) * [Hive](./interpreter/hive.html) diff --git a/docs/interpreter/hazelcastjet.md b/docs/interpreter/hazelcastjet.md deleted file mode 100644 index 06ebc888ac..0000000000 --- a/docs/interpreter/hazelcastjet.md +++ /dev/null @@ -1,143 +0,0 @@ ---- -layout: page -title: Hazelcast Jet interpreter in Apache Zeppelin -description: Build and execture Hazelcast Jet computation jobs. -group: interpreter ---- -<!-- -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. ---> - -{% include JB/setup %} - -# Hazelcast Jet interpreter for Apache Zeppelin - -<div id="toc"></div> - -## Overview -[Hazelcast Jet](https://jet.hazelcast.org) is an open source application embeddable, distributed computing engine for In-Memory Streaming and Fast Batch Processing built on top of Hazelcast In-Memory Data Grid (IMDG). -With Hazelcast IMDG providing storage functionality, Hazelcast Jet performs parallel execution to enable data-intensive applications to operate in near real-time. - -## Why Hazelcast Jet? -There are plenty of solutions which can solve some of these issues, so why choose Hazelcast Jet? -When speed and simplicity is important. - -Hazelcast Jet gives you all the infrastructure you need to build a distributed data processing pipeline within one 10Mb Java JAR: processing, storage and clustering. - -As it is built on top of Hazelcast IMDG, Hazelcast Jet comes with in-memory operational storage that’s available out-of-the box. This storage is partitioned, distributed and replicated across the Hazelcast Jet cluster for capacity and resiliency. It can be used as an input data buffer, to publish the results of a Hazelcast Jet computation, to connect multiple Hazelcast Jet jobs or as a lookup cache for data enrichment. - -## How to use the Hazelcast Jet interpreter -Basically, you can write normal java code. You should write the main method inside a class because the interpreter invoke this main to execute the code. Unlike Zeppelin normal pattern, each paragraph is considered as a separate job, there isn't any relation to any other paragraph. For example, a variable defined in one paragraph cannot be used in another one as each paragraph is a self contained java main class that is executed and the output returned to Zeppelin. - -The following is a demonstration of a word count example with the result represented as an Hazelcast IMDG IMap sink and displayed leveraging Zeppelin's built in visualization using the utility method `JavaInterpreterUtils.displayTableFromSimpleMap`. - -```java -%hazelcastjet - -import com.hazelcast.jet.Jet; -import com.hazelcast.jet.JetInstance; -import com.hazelcast.jet.core.DAG; -import com.hazelcast.jet.pipeline.Pipeline; -import com.hazelcast.jet.pipeline.Sinks; -import com.hazelcast.jet.pipeline.Sources; - -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import org.apache.zeppelin.java.JavaInterpreterUtils; - -import static com.hazelcast.jet.Traversers.traverseArray; -import static com.hazelcast.jet.aggregate.AggregateOperations.counting; -import static com.hazelcast.jet.function.DistributedFunctions.wholeItem; - -public class DisplayTableFromSimpleMapExample { - - public static void main(String[] args) { - - // Create the specification of the computation pipeline. Note - // it's a pure POJO: no instance of Jet needed to create it. - Pipeline p = Pipeline.create(); - p.drawFrom(Sources.<String>list("text")) - .flatMap(word -> - traverseArray(word.toLowerCase().split("\\W+"))) - .filter(word -> !word.isEmpty()) - .groupingKey(wholeItem()) - .aggregate(counting()) - .drainTo(Sinks.map("counts")); - - // Start Jet, populate the input list - JetInstance jet = Jet.newJetInstance(); - try { - List<String> text = jet.getList("text"); - text.add("hello world hello hello world"); - text.add("world world hello world"); - - // Perform the computation - jet.newJob(p).join(); - - // Diplay the results with Zeppelin %table - Map<String, Long> counts = jet.getMap("counts"); - System.out.println(JavaInterpreterUtils.displayTableFromSimpleMap("Word","Count", counts)); - - } finally { - Jet.shutdownAll(); - } - - } - -} -``` - -The following is a demonstration where the Hazelcast DAG (directed acyclic graph) is displayed as a graph leveraging Zeppelin's built in visualization using the utility method `HazelcastJetInterpreterUtils.displayNetworkFromDAG`. -This is particularly useful to understand how the high level Pipeline is then converted to the Jet’s low-level Core API. - -```java -%hazelcastjet - -import com.hazelcast.jet.pipeline.Pipeline; -import com.hazelcast.jet.pipeline.Sinks; -import com.hazelcast.jet.pipeline.Sources; - -import org.apache.zeppelin.hazelcastjet.HazelcastJetInterpreterUtils; - -import static com.hazelcast.jet.Traversers.traverseArray; -import static com.hazelcast.jet.aggregate.AggregateOperations.counting; -import static com.hazelcast.jet.function.DistributedFunctions.wholeItem; - -public class DisplayNetworkFromDAGExample { - - public static void main(String[] args) { - - // Create the specification of the computation pipeline. Note - // it's a pure POJO: no instance of Jet needed to create it. - Pipeline p = Pipeline.create(); - p.drawFrom(Sources.<String>list("text")) - .flatMap(word -> - traverseArray(word.toLowerCase().split("\\W+"))).setName("flat traversing") - .filter(word -> !word.isEmpty()) - .groupingKey(wholeItem()) - .aggregate(counting()) - .drainTo(Sinks.map("counts")); - - // Diplay the results with Zeppelin %network - System.out.println(HazelcastJetInterpreterUtils.displayNetworkFromDAG(p.toDag())); - - } - -} -``` - -Note -- By clicking on a node of the graph, the node type is displayed (either Source, Sink or Transform). This is also visually represented with colors (Sources and Sinks are blue, Transforms are orange). -- By clicking on an edge of the graph, the following details are shown: routing (UNICAST, PARTITIONED, ISOLATED, BROADCAST), distributed (true or false), priority (int). diff --git a/hazelcastjet/README.md b/hazelcastjet/README.md deleted file mode 100644 index a7c3800572..0000000000 --- a/hazelcastjet/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Overview -Hazelcast Jet interpreter for Apache Zeppelin - -# Architecture -Current interpreter implementation supports the static REPL. It compiles the code in memory, execute it and redirect the output to Zeppelin. - -### Technical overview - - * Upon starting an interpreter, an instance of `JavaCompiler` is created. - - * When the user runs commands with java, the `JavaParser` go through the code to get a class that contains the main method. - - * Then it replaces the class name with random class name to avoid overriding while compilation. It creates new out & err stream to get the data in new stream instead of the console, to redirect output to Zeppelin. - - * If there is any error during compilation, it can catch and redirect to Zeppelin. - - * `JavaInterpreterUtils` contains useful methods to print out Java collections and leverage Zeppelin's built in visualization. - - * `HazelcastJetInterpreterUtils` contains useful methods to print out Hazelcast specific classes (such as DAG) and leverage Zeppelin's built in visualization. diff --git a/hazelcastjet/pom.xml b/hazelcastjet/pom.xml deleted file mode 100644 index 1d7608867e..0000000000 --- a/hazelcastjet/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <artifactId>zeppelin-interpreter-parent</artifactId> - <groupId>org.apache.zeppelin</groupId> - <version>0.11.0-SNAPSHOT</version> - <relativePath>../zeppelin-interpreter-parent/pom.xml</relativePath> - </parent> - - <artifactId>zeppelin-hazelcastjet</artifactId> - <packaging>jar</packaging> - <name>Zeppelin: Hazelcast Jet interpreter</name> - - <properties> - <!--library versions--> - <interpreter.name>hazelcastjet</interpreter.name> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.zeppelin</groupId> - <artifactId>zeppelin-java</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>com.hazelcast.jet</groupId> - <artifactId>hazelcast-jet</artifactId> - <version>0.6.1</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <artifactId>maven-enforcer-plugin</artifactId> - </plugin> - <plugin> - <artifactId>maven-resources-plugin</artifactId> - </plugin> - <plugin> - <artifactId>maven-shade-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - <configuration> - <skip>false</skip> - </configuration> - </plugin> - </plugins> - </build> -</project> diff --git a/hazelcastjet/src/main/java/org/apache/zeppelin/hazelcastjet/HazelcastJetInterpreter.java b/hazelcastjet/src/main/java/org/apache/zeppelin/hazelcastjet/HazelcastJetInterpreter.java deleted file mode 100644 index 00d2418d1e..0000000000 --- a/hazelcastjet/src/main/java/org/apache/zeppelin/hazelcastjet/HazelcastJetInterpreter.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.hazelcastjet; - -import org.apache.zeppelin.java.JavaInterpreter; - -import java.util.Properties; - -/** - * Hazelcast Jet interpreter - */ -public class HazelcastJetInterpreter extends JavaInterpreter { - - public HazelcastJetInterpreter(Properties property) { - super(property); - } - -} diff --git a/hazelcastjet/src/main/java/org/apache/zeppelin/hazelcastjet/HazelcastJetInterpreterUtils.java b/hazelcastjet/src/main/java/org/apache/zeppelin/hazelcastjet/HazelcastJetInterpreterUtils.java deleted file mode 100644 index c8bcd6dfe9..0000000000 --- a/hazelcastjet/src/main/java/org/apache/zeppelin/hazelcastjet/HazelcastJetInterpreterUtils.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.hazelcastjet; - -import com.google.gson.Gson; -import com.hazelcast.jet.core.DAG; -import org.apache.zeppelin.interpreter.graph.GraphResult; -import org.apache.zeppelin.tabledata.Node; -import org.apache.zeppelin.tabledata.Relationship; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Hazelcast Jet interpreter utility methods - */ -public class HazelcastJetInterpreterUtils { - - private static final Gson gson = new Gson(); - - /** - * Convert an Hazelcast Jet DAG to %network display system - * to leverage Zeppelin's built in visualization - * @param dag DAG object to convert - * @return Zeppelin %network - */ - public static String displayNetworkFromDAG(DAG dag){ - GraphResult.Graph graph = new GraphResult.Graph(); - graph.setDirected(true); - - // Map between vertex name (from DAG) and node id (for graph) - Map<String, Integer> nodeIds = new HashMap<>(); - - // Create graph nodes based on dag vertices - List<Node> nodes = new ArrayList<>(); - AtomicInteger nodeCount = new AtomicInteger(1); - dag.forEach(v -> { - // Assign an index to the vertex name - nodeIds.put(v.getName(), nodeCount.getAndIncrement()); - Node node = new Node(); - node.setId(nodeIds.get(v.getName())); - // Define node label from vertex name - if (v.getName().toLowerCase().contains("sink")) - node.setLabel("Sink"); - else if (v.getName().toLowerCase().contains("source")) - node.setLabel("Source"); - else - node.setLabel("Transform"); - // Add node description - Map<String, Object> data = new HashMap<>(); - data.put("description", v.getName()); - node.setData(data); - nodes.add(node); - }); - graph.setNodes(nodes); - - // Set labels colors - Map<String, String> labels = new HashMap<>(); - labels.put("Source", "#00317c"); - labels.put("Transform", "#ff7600"); - labels.put("Sink", "#00317c"); - graph.setLabels(labels); - - // Map between edge name (from DAG) and relationship id (for graph) - Map<String, Integer> edgeIds = new HashMap<>(); - - // Create graph relationships - List<Relationship> rels = new ArrayList<>(); - AtomicInteger relCount = new AtomicInteger(1); - dag.forEach(v -> { - dag.getInboundEdges(v.getName()).forEach(e -> { - String edgeName = e.getSourceName() + " to " + e.getDestName(); - if (edgeIds.get(edgeName) == null) { - // Assign an index to the edge name if not found - edgeIds.put(edgeName, relCount.getAndIncrement()); - Relationship rel = new Relationship(); - rel.setId(edgeIds.get(edgeName)); - rel.setSource(nodeIds.get(e.getSourceName())); - rel.setTarget(nodeIds.get(e.getDestName())); - // Add rel data - Map<String, Object> data = new HashMap<>(); - data.put("routing", e.getRoutingPolicy().toString()); - data.put("priority", e.getPriority()); - data.put("distributed", e.isDistributed()); - rel.setData(data); - rels.add(rel); - } - }); - dag.getOutboundEdges(v.getName()).forEach(e -> { - String edgeName = e.getSourceName() + " to " + e.getDestName(); - if (edgeIds.get(edgeName) == null) { - // Assign an index to the edge name if not found - edgeIds.put(edgeName, relCount.getAndIncrement()); - Relationship rel = new Relationship(); - rel.setId(edgeIds.get(edgeName)); - rel.setSource(nodeIds.get(e.getSourceName())); - rel.setTarget(nodeIds.get(e.getDestName())); - // Add rel data - Map<String, Object> data = new HashMap<>(); - data.put("routing", e.getRoutingPolicy().toString()); - data.put("priority", e.getPriority()); - data.put("distributed", e.isDistributed()); - rel.setData(data); - rels.add(rel); - } - }); - }); - graph.setEdges(rels); - - return "%network " + gson.toJson(graph); - } - -} diff --git a/hazelcastjet/src/main/resources/interpreter-setting.json b/hazelcastjet/src/main/resources/interpreter-setting.json deleted file mode 100644 index 938bf503e0..0000000000 --- a/hazelcastjet/src/main/resources/interpreter-setting.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "group": "hazelcastjet", - "name": "hazelcastjet", - "className": "org.apache.zeppelin.hazelcastjet.HazelcastJetInterpreter", - "defaultInterpreter": true, - "properties": { - }, - "editor": { - "language": "java", - "editOnDblClick": false - } - } -] diff --git a/hazelcastjet/src/test/java/org/apache/zeppelin/hazelcastjet/HazelcastJetInterpreterTest.java b/hazelcastjet/src/test/java/org/apache/zeppelin/hazelcastjet/HazelcastJetInterpreterTest.java deleted file mode 100644 index b646941900..0000000000 --- a/hazelcastjet/src/test/java/org/apache/zeppelin/hazelcastjet/HazelcastJetInterpreterTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.hazelcastjet; - -import org.apache.zeppelin.interpreter.InterpreterContext; -import org.apache.zeppelin.interpreter.InterpreterResult; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Properties; - -import static org.junit.Assert.assertEquals; - -/** - * HazelcastJetInterpreterTest - */ -public class HazelcastJetInterpreterTest { - - private static HazelcastJetInterpreter jet; - private static InterpreterContext context; - - @BeforeClass - public static void setUp() { - Properties p = new Properties(); - jet = new HazelcastJetInterpreter(p); - jet.open(); - context = InterpreterContext.builder().build(); - } - - @AfterClass - public static void tearDown() { - jet.close(); - } - - @Test - public void testStaticRepl() { - - StringWriter writer = new StringWriter(); - PrintWriter out = new PrintWriter(writer); - out.println("public class HelloWorld {"); - out.println(" public static void main(String args[]) {"); - out.println(" System.out.println(\"This is in another java file\");"); - out.println(" }"); - out.println("}"); - out.close(); - - InterpreterResult res = jet.interpret(writer.toString(), context); - - assertEquals(InterpreterResult.Code.SUCCESS, res.code()); - assertEquals(InterpreterResult.Type.TEXT, res.message().get(0).getType()); - } - - @Test - public void testStaticReplWithoutMain() { - - StringBuffer sourceCode = new StringBuffer(); - sourceCode.append("package org.mdkt;\n"); - sourceCode.append("public class HelloClass {\n"); - sourceCode.append(" public String hello() { return \"hello\"; }"); - sourceCode.append("}"); - InterpreterResult res = jet.interpret(sourceCode.toString(), context); - assertEquals(InterpreterResult.Code.ERROR, res.code()); - } - - @Test - public void testStaticReplWithSyntaxError() { - - StringWriter writer = new StringWriter(); - PrintWriter out = new PrintWriter(writer); - out.println("public class HelloWorld {"); - out.println(" public static void main(String args[]) {"); - out.println(" System.out.prin(\"This is in another java file\");"); - out.println(" }"); - out.println("}"); - out.close(); - InterpreterResult res = jet.interpret(writer.toString(), context); - - assertEquals(InterpreterResult.Code.ERROR, res.code()); - } - -} diff --git a/hazelcastjet/src/test/java/org/apache/zeppelin/hazelcastjet/HazelcastJetInterpreterUtilsTest.java b/hazelcastjet/src/test/java/org/apache/zeppelin/hazelcastjet/HazelcastJetInterpreterUtilsTest.java deleted file mode 100644 index 600da7a293..0000000000 --- a/hazelcastjet/src/test/java/org/apache/zeppelin/hazelcastjet/HazelcastJetInterpreterUtilsTest.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.hazelcastjet; - -import com.hazelcast.jet.pipeline.Pipeline; -import com.hazelcast.jet.pipeline.Sinks; -import com.hazelcast.jet.pipeline.Sources; -import org.apache.zeppelin.interpreter.InterpreterContext; -import org.apache.zeppelin.interpreter.InterpreterResult; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Properties; - -import static com.hazelcast.jet.Traversers.traverseArray; -import static com.hazelcast.jet.aggregate.AggregateOperations.counting; -import static com.hazelcast.jet.function.DistributedFunctions.wholeItem; -import static org.junit.Assert.assertEquals; - -public class HazelcastJetInterpreterUtilsTest { - - private static final String NETWORK_RESULT_1 = "%network " + - "{\"nodes\":[" + - "{\"id\":1,\"data\":{\"description\":\"listSource(text)\"},\"label\":\"Source\"}," + - "{\"id\":2,\"data\":{\"description\":\"flat traversing\"},\"label\":\"Transform\"}," + - "{\"id\":3,\"data\":{\"description\":\"filter\"},\"label\":\"Transform\"}," + - "{\"id\":4,\"data\":{\"description\":\"group-and-aggregate-step1\"}," + - "\"label\":\"Transform\"}," + - "{\"id\":5,\"data\":{\"description\":\"group-and-aggregate-step2\"}," + - "\"label\":\"Transform\"}," + - "{\"id\":6,\"data\":{\"description\":\"mapSink(counts)\"},\"label\":\"Sink\"}]," + - "\"edges\":[" + - "{\"source\":1,\"target\":2,\"id\":1,\"data\":{\"routing\":\"UNICAST\"," + - "\"distributed\":false,\"priority\":0}}," + - "{\"source\":2,\"target\":3,\"id\":2,\"data\":{\"routing\":\"UNICAST\"," + - "\"distributed\":false,\"priority\":0}}," + - "{\"source\":3,\"target\":4,\"id\":3,\"data\":{\"routing\":\"PARTITIONED\"," + - "\"distributed\":false,\"priority\":0}}," + - "{\"source\":4,\"target\":5,\"id\":4,\"data\":{\"routing\":\"PARTITIONED\"," + - "\"distributed\":true,\"priority\":0}}," + - "{\"source\":5,\"target\":6,\"id\":5,\"data\":{\"routing\":\"UNICAST\"," + - "\"distributed\":false,\"priority\":0}}]," + - "\"labels\":{\"Sink\":\"#00317c\",\"Transform\":\"#ff7600\",\"Source\":\"#00317c\"}," + - "\"directed\":true}"; - - private static HazelcastJetInterpreter jet; - private static InterpreterContext context; - - @BeforeClass - public static void setUp() { - Properties p = new Properties(); - jet = new HazelcastJetInterpreter(p); - jet.open(); - context = InterpreterContext.builder().build(); - } - - @AfterClass - public static void tearDown() { - jet.close(); - } - - @Test - public void testDisplayNetworkFromDAGUtil() { - - Pipeline p = Pipeline.create(); - p.drawFrom(Sources.<String>list("text")) - .flatMap(word -> - traverseArray(word.toLowerCase().split("\\W+"))).setName("flat traversing") - .filter(word -> !word.isEmpty()) - .groupingKey(wholeItem()) - .aggregate(counting()) - .drainTo(Sinks.map("counts")); - - assertEquals( - NETWORK_RESULT_1, - HazelcastJetInterpreterUtils.displayNetworkFromDAG(p.toDag()) - ); - - } - - @Test - public void testStaticReplWithdisplayNetworkFromDAGUtilReturnNetworkType() { - - StringWriter writer = new StringWriter(); - PrintWriter out = new PrintWriter(writer); - out.println("import com.hazelcast.jet.pipeline.Pipeline;"); - out.println("import com.hazelcast.jet.pipeline.Sinks;"); - out.println("import com.hazelcast.jet.pipeline.Sources;"); - out.println("import org.apache.zeppelin.hazelcastjet.HazelcastJetInterpreterUtils;"); - out.println("import static com.hazelcast.jet.Traversers.traverseArray;"); - out.println("import static com.hazelcast.jet.aggregate.AggregateOperations.counting;"); - out.println("import static com.hazelcast.jet.function.DistributedFunctions.wholeItem;"); - out.println("public class HelloWorld {"); - out.println(" public static void main(String args[]) {"); - out.println(" Pipeline p = Pipeline.create();"); - out.println(" p.drawFrom(Sources.<String>list(\"text\"))"); - out.println(" .flatMap(word ->"); - out.println(" traverseArray(word.toLowerCase().split(\"\\\\W+\")))" + - ".setName(\"flat traversing\")"); - out.println(" .filter(word -> !word.isEmpty())"); - out.println(" .groupingKey(wholeItem())"); - out.println(" .aggregate(counting())"); - out.println(" .drainTo(Sinks.map(\"counts\"));"); - out.println(" System.out.println(HazelcastJetInterpreterUtils" + - ".displayNetworkFromDAG(p.toDag()));"); - out.println(" }"); - out.println("}"); - out.close(); - - InterpreterResult res = jet.interpret(writer.toString(), context); - - assertEquals(InterpreterResult.Code.SUCCESS, res.code()); - assertEquals(InterpreterResult.Type.NETWORK, res.message().get(0).getType()); - - } - -} diff --git a/pom.xml b/pom.xml index c4f5a0f92c..dd4951f187 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,6 @@ <module>sap</module> <module>java</module> <module>beam</module> - <module>hazelcastjet</module> <module>geode</module> <module>ksql</module> <module>sparql</module> diff --git a/zeppelin-distribution/src/bin_license/LICENSE b/zeppelin-distribution/src/bin_license/LICENSE index 614c6652e9..2692811edd 100644 --- a/zeppelin-distribution/src/bin_license/LICENSE +++ b/zeppelin-distribution/src/bin_license/LICENSE @@ -219,7 +219,6 @@ The following components are provided under Apache License. (Apache 2.0) frontend-plugin-core 1.3 (com.github.eirslett:frontend-plugin-core) - https://github.com/eirslett/frontend-maven-plugin/blob/frontend-plugins-1.3/LICENSE (Apache 2.0) mongo-java-driver 3.12.10 (org.mongodb:mongo-java-driver:3.12.10) - https://github.com/mongodb/mongo-java-driver/blob/master/LICENSE.txt (Apache 2.0) Neo4j Java Driver (https://github.com/neo4j/neo4j-java-driver) - https://github.com/neo4j/neo4j-java-driver/blob/1.4.3/LICENSE.txt - (Apache 2.0) Hazelcast Jet (http://jet.hazelcast.org) - https://github.com/hazelcast/hazelcast-jet/blob/master/LICENSE (Apache 2.0) RxJava (io.reactivex.rxjava2:rxjava:2.2.17) - https://github.com/ReactiveX/RxJava/blob/2.x/LICENSE (Apache 2.0) Application monitoring instrumentation facade (io.micrometer:micrometer-core:1.6.0) - https://github.com/micrometer-metrics/micrometer/blob/master/LICENSE (Apache 2.0) Application monitoring instrumentation facade (io.micrometer:micrometer-registry-prometheus:1.6.0) - https://github.com/micrometer-metrics/micrometer/blob/master/LICENSE