Repository: ignite
Updated Branches:
  refs/heads/master 79eae51a1 -> fcc4d4a35


IGNITE-7909: Java examples for Spark Data Frames. - Fixes #3883.

Signed-off-by: Nikolay Izhikov <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fcc4d4a3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fcc4d4a3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fcc4d4a3

Branch: refs/heads/master
Commit: fcc4d4a357413eb4856ca5c72d301738568060e2
Parents: 79eae51
Author: Akmal Chaudhri <[email protected]>
Authored: Fri Apr 27 16:41:30 2018 +0300
Committer: Nikolay Izhikov <[email protected]>
Committed: Fri Apr 27 16:42:07 2018 +0300

----------------------------------------------------------------------
 .../spark/JavaIgniteCatalogExample.java         | 143 ++++++++++++++
 .../spark/JavaIgniteDataFrameExample.java       | 154 +++++++++++++++
 .../spark/JavaIgniteDataFrameWriteExample.java  | 185 +++++++++++++++++++
 .../examples/JavaIgniteDataFrameSelfTest.java   |  54 ++++++
 .../IgniteExamplesSparkSelfTestSuite.java       |   2 +
 5 files changed, 538 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fcc4d4a3/examples/src/main/spark/org/apache/ignite/examples/spark/JavaIgniteCatalogExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/spark/org/apache/ignite/examples/spark/JavaIgniteCatalogExample.java
 
b/examples/src/main/spark/org/apache/ignite/examples/spark/JavaIgniteCatalogExample.java
new file mode 100644
index 0000000..c9313f6
--- /dev/null
+++ 
b/examples/src/main/spark/org/apache/ignite/examples/spark/JavaIgniteCatalogExample.java
@@ -0,0 +1,143 @@
+/*
+ * 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.ignite.examples.spark;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.spark.sql.AnalysisException;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.ignite.IgniteSparkSession;
+
+import static org.apache.ignite.internal.util.typedef.X.println;
+
+/**
+ * 
+ */
+public class JavaIgniteCatalogExample {
+    /**
+     * Ignite config file.
+     */
+    private static final String CONFIG = "examples/config/example-ignite.xml";
+
+    /**
+     * Test cache name.
+     */
+    private static final String CACHE_NAME = "testCache";
+
+    /** */
+    public static void main(String args[]) throws AnalysisException {
+
+        setupServerAndData();
+
+        //Creating Ignite-specific implementation of Spark session.
+        IgniteSparkSession igniteSession = IgniteSparkSession.builder()
+                .appName("Spark Ignite catalog example")
+                .master("local")
+                .config("spark.executor.instances", "2")
+                .igniteConfig(CONFIG)
+                .getOrCreate();
+
+        //Adjust the logger to exclude the logs of no interest.
+        Logger.getRootLogger().setLevel(Level.ERROR);
+        Logger.getLogger("org.apache.ignite").setLevel(Level.INFO);
+
+        System.out.println("List of available tables:");
+
+        //Showing existing tables.
+        igniteSession.catalog().listTables().show();
+
+        System.out.println("PERSON table description:");
+
+        //Showing `person` schema.
+        igniteSession.catalog().listColumns("person").show();
+
+        System.out.println("CITY table description:");
+
+        //Showing `city` schema.
+        igniteSession.catalog().listColumns("city").show();
+
+        println("Querying all persons from city with ID=2.");
+
+        //Selecting data through Spark SQL engine.
+        Dataset<Row> df = igniteSession.sql("SELECT * FROM person WHERE 
CITY_ID = 2");
+
+        System.out.println("Result schema:");
+
+        df.printSchema();
+
+        System.out.println("Result content:");
+
+        df.show();
+
+        System.out.println("Querying all persons living in Denver.");
+
+        //Selecting data through Spark SQL engine.
+        Dataset<Row> df2 = igniteSession.sql("SELECT * FROM person p JOIN city 
c ON c.ID = p.CITY_ID WHERE c.NAME = 'Denver'");
+
+        System.out.println("Result schema:");
+
+        df2.printSchema();
+
+        System.out.println("Result content:");
+
+        df2.show();
+
+        Ignition.stop(false);
+    }
+
+    /** */
+    private static void setupServerAndData() {
+        //Starting Ignite.
+        Ignite ignite = Ignition.start(CONFIG);
+
+        //Creating cache.
+        CacheConfiguration<?, ?> ccfg = new 
CacheConfiguration<>(CACHE_NAME).setSqlSchema("PUBLIC");
+
+        IgniteCache<?, ?> cache = ignite.getOrCreateCache(ccfg);
+
+        //Create tables.
+        cache.query(new SqlFieldsQuery(
+                "CREATE TABLE city (id LONG PRIMARY KEY, name VARCHAR) WITH 
\"template=replicated\"")).getAll();
+
+        cache.query(new SqlFieldsQuery(
+                "CREATE TABLE person (id LONG, name VARCHAR, city_id LONG, 
PRIMARY KEY (id, city_id)) " +
+                        "WITH \"backups=1, affinityKey=city_id\"")).getAll();
+
+        cache.query(new SqlFieldsQuery("CREATE INDEX on Person 
(city_id)")).getAll();
+
+        //Inserting some data into table.
+        SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO city (id, name) 
VALUES (?, ?)");
+
+        cache.query(qry.setArgs(1L, "Forest Hill")).getAll();
+        cache.query(qry.setArgs(2L, "Denver")).getAll();
+        cache.query(qry.setArgs(3L, "St. Petersburg")).getAll();
+
+        qry = new SqlFieldsQuery("INSERT INTO person (id, name, city_id) 
values (?, ?, ?)");
+
+        cache.query(qry.setArgs(1L, "John Doe", 3L)).getAll();
+        cache.query(qry.setArgs(2L, "Jane Roe", 2L)).getAll();
+        cache.query(qry.setArgs(3L, "Mary Major", 1L)).getAll();
+        cache.query(qry.setArgs(4L, "Richard Miles", 2L)).getAll();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fcc4d4a3/examples/src/main/spark/org/apache/ignite/examples/spark/JavaIgniteDataFrameExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/spark/org/apache/ignite/examples/spark/JavaIgniteDataFrameExample.java
 
b/examples/src/main/spark/org/apache/ignite/examples/spark/JavaIgniteDataFrameExample.java
new file mode 100644
index 0000000..20bcf83
--- /dev/null
+++ 
b/examples/src/main/spark/org/apache/ignite/examples/spark/JavaIgniteDataFrameExample.java
@@ -0,0 +1,154 @@
+/*
+ * 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.ignite.examples.spark;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.spark.IgniteDataFrameSettings;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.SparkSession;
+
+import static org.apache.spark.sql.functions.col;
+
+/**
+ *
+ */
+public class JavaIgniteDataFrameExample {
+    /**
+     * Ignite config file.
+     */
+    private static final String CONFIG = "examples/config/example-ignite.xml";
+
+    /**
+     * Test cache name.
+     */
+    private static final String CACHE_NAME = "testCache";
+
+    /** */
+    public static void main(String args[]) {
+
+        setupServerAndData();
+
+        //Creating spark session.
+        SparkSession spark = SparkSession
+                .builder()
+                .appName("JavaIgniteDataFrameExample")
+                .master("local")
+                .config("spark.executor.instances", "2")
+                .getOrCreate();
+
+        // Adjust the logger to exclude the logs of no interest.
+        Logger.getRootLogger().setLevel(Level.ERROR);
+        Logger.getLogger("org.apache.ignite").setLevel(Level.INFO);
+
+        // Executing examples.
+
+        sparkDSLExample(spark);
+
+        nativeSparkSqlExample(spark);
+
+        Ignition.stop(false);
+    }
+
+    /** */
+    private static void sparkDSLExample(SparkSession spark) {
+        System.out.println("Querying using Spark DSL.");
+
+        Dataset<Row> igniteDF = spark.read()
+                .format(IgniteDataFrameSettings.FORMAT_IGNITE()) //Data source 
type.
+                .option(IgniteDataFrameSettings.OPTION_TABLE(), "person") 
//Table to read.
+                .option(IgniteDataFrameSettings.OPTION_CONFIG_FILE(), CONFIG) 
//Ignite config.
+                .load()
+                .filter(col("id").geq(2)) //Filter clause.
+                .filter(col("name").like("%M%")); //Another filter clause.
+
+        System.out.println("Data frame schema:");
+
+        igniteDF.printSchema(); //Printing query schema to console.
+
+        System.out.println("Data frame content:");
+
+        igniteDF.show(); //Printing query results to console.
+    }
+
+    /** */
+    private static void nativeSparkSqlExample(SparkSession spark) {
+        System.out.println("Querying using Spark SQL.");
+
+        Dataset<Row> df = spark.read()
+                .format(IgniteDataFrameSettings.FORMAT_IGNITE()) //Data source 
type.
+                .option(IgniteDataFrameSettings.OPTION_TABLE(), "person") 
//Table to read.
+                .option(IgniteDataFrameSettings.OPTION_CONFIG_FILE(), CONFIG) 
//Ignite config.
+                .load();
+
+        //Registering DataFrame as Spark view.
+        df.createOrReplaceTempView("person");
+
+        //Selecting data from Ignite through Spark SQL Engine.
+        Dataset<Row> igniteDF = spark.sql("SELECT * FROM person WHERE id >= 2 
AND name = 'Mary Major'");
+
+        System.out.println("Result schema:");
+
+        igniteDF.printSchema(); //Printing query schema to console.
+
+        System.out.println("Result content:");
+
+        igniteDF.show(); //Printing query results to console.
+    }
+
+    /** */
+    private static void setupServerAndData() {
+        //Starting Ignite.
+        Ignite ignite = Ignition.start(CONFIG);
+
+        //Creating first test cache.
+        CacheConfiguration<?, ?> ccfg = new 
CacheConfiguration<>(CACHE_NAME).setSqlSchema("PUBLIC");
+
+        IgniteCache<?, ?> cache = ignite.getOrCreateCache(ccfg);
+
+        //Creating SQL tables.
+        cache.query(new SqlFieldsQuery(
+                "CREATE TABLE city (id LONG PRIMARY KEY, name VARCHAR) WITH 
\"template=replicated\"")).getAll();
+
+        cache.query(new SqlFieldsQuery(
+                "CREATE TABLE person (id LONG, name VARCHAR, city_id LONG, 
PRIMARY KEY (id, city_id)) " +
+                        "WITH \"backups=1, affinity_key=city_id\"")).getAll();
+
+        cache.query(new SqlFieldsQuery("CREATE INDEX on Person 
(city_id)")).getAll();
+
+        SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO city (id, name) 
VALUES (?, ?)");
+
+        //Inserting some data to tables.
+        cache.query(qry.setArgs(1L, "Forest Hill")).getAll();
+        cache.query(qry.setArgs(2L, "Denver")).getAll();
+        cache.query(qry.setArgs(3L, "St. Petersburg")).getAll();
+
+        qry = new SqlFieldsQuery("INSERT INTO person (id, name, city_id) 
values (?, ?, ?)");
+
+        cache.query(qry.setArgs(1L, "John Doe", 3L)).getAll();
+        cache.query(qry.setArgs(2L, "Jane Roe", 2L)).getAll();
+        cache.query(qry.setArgs(3L, "Mary Major", 1L)).getAll();
+        cache.query(qry.setArgs(4L, "Richard Miles", 2L)).getAll();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fcc4d4a3/examples/src/main/spark/org/apache/ignite/examples/spark/JavaIgniteDataFrameWriteExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/spark/org/apache/ignite/examples/spark/JavaIgniteDataFrameWriteExample.java
 
b/examples/src/main/spark/org/apache/ignite/examples/spark/JavaIgniteDataFrameWriteExample.java
new file mode 100644
index 0000000..6fc1393
--- /dev/null
+++ 
b/examples/src/main/spark/org/apache/ignite/examples/spark/JavaIgniteDataFrameWriteExample.java
@@ -0,0 +1,185 @@
+/*
+ * 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.ignite.examples.spark;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.spark.IgniteDataFrameSettings;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.SaveMode;
+import org.apache.spark.sql.SparkSession;
+
+import java.util.List;
+
+import static org.apache.ignite.internal.util.IgniteUtils.resolveIgnitePath;
+import static org.apache.spark.sql.functions.col;
+import static org.apache.spark.sql.functions.reverse;
+
+/**
+ *
+ */
+public class JavaIgniteDataFrameWriteExample {
+    /**
+     * Ignite config file.
+     */
+    private static final String CONFIG = "examples/config/example-ignite.xml";
+
+    /**
+     * Test cache name.
+     */
+    private static final String CACHE_NAME = "testCache";
+
+    /** */
+    public static void main(String args[]) {
+        //Starting Ignite.
+        Ignite ignite = Ignition.start(CONFIG);
+
+        //Starting Ignite server node.
+        setupServerAndData(ignite);
+
+        //Creating spark session.
+        SparkSession spark = SparkSession
+                .builder()
+                .appName("Spark Ignite data sources write example")
+                .master("local")
+                .config("spark.executor.instances", "2")
+                .getOrCreate();
+
+        // Adjust the logger to exclude the logs of no interest.
+        Logger.getRootLogger().setLevel(Level.ERROR);
+        Logger.getLogger("org.apache.ignite").setLevel(Level.INFO);
+
+        // Executing examples.
+        System.out.println("Example of writing json file to Ignite:");
+
+        writeJSonToIgnite(ignite, spark);
+
+        System.out.println("Example of modifying existing Ignite table data 
through Data Fram API:");
+
+        editDataAndSaveToNewTable(ignite, spark);
+
+        Ignition.stop(false);
+    }
+
+    /** */
+    private static void writeJSonToIgnite(Ignite ignite, SparkSession spark) {
+        //Load content of json file to data frame.
+        Dataset<Row> personsDataFrame = spark.read().json(
+            
resolveIgnitePath("examples/src/main/resources/person.json").getAbsolutePath());
+
+        System.out.println("Json file content:");
+
+        //Printing content of json file to console.
+        personsDataFrame.show();
+
+        System.out.println("Writing Data Frame to Ignite:");
+
+        //Writing content of data frame to Ignite.
+        personsDataFrame.write()
+                .format(IgniteDataFrameSettings.FORMAT_IGNITE())
+                .option(IgniteDataFrameSettings.OPTION_CONFIG_FILE(), CONFIG)
+                .option(IgniteDataFrameSettings.OPTION_TABLE(), "json_person")
+                
.option(IgniteDataFrameSettings.OPTION_CREATE_TABLE_PRIMARY_KEY_FIELDS(), "id")
+                
.option(IgniteDataFrameSettings.OPTION_CREATE_TABLE_PARAMETERS(), 
"template=replicated")
+                .save();
+
+        System.out.println("Done!");
+
+        System.out.println("Reading data from Ignite table:");
+
+        CacheConfiguration<?, ?> ccfg = new CacheConfiguration<>(CACHE_NAME);
+
+        IgniteCache<?, ?> cache = ignite.getOrCreateCache(ccfg);
+
+        //Reading saved data from Ignite.
+        List<List<?>> data = cache.query(new SqlFieldsQuery("SELECT id, name, 
department FROM json_person")).getAll();
+
+        System.out.println(data);
+    }
+
+    /** */
+    private static void editDataAndSaveToNewTable(Ignite ignite, SparkSession 
spark) {
+        //Load content of Ignite table to data frame.
+        Dataset<Row> personDataFrame = spark.read()
+                .format(IgniteDataFrameSettings.FORMAT_IGNITE())
+                .option(IgniteDataFrameSettings.OPTION_CONFIG_FILE(), CONFIG)
+                .option(IgniteDataFrameSettings.OPTION_TABLE(), "person")
+                .load();
+
+        System.out.println("Data frame content:");
+
+        //Printing content of data frame to console.
+        personDataFrame.show();
+
+        System.out.println("Modifying Data Frame and write it to Ignite:");
+
+        personDataFrame
+                .withColumn("id", col("id").plus(42)) //Edit id column
+                .withColumn("name", reverse(col("name"))) //Edit name column
+                .write().format(IgniteDataFrameSettings.FORMAT_IGNITE())
+                .option(IgniteDataFrameSettings.OPTION_CONFIG_FILE(), CONFIG)
+                .option(IgniteDataFrameSettings.OPTION_TABLE(), "new_persons")
+                
.option(IgniteDataFrameSettings.OPTION_CREATE_TABLE_PRIMARY_KEY_FIELDS(), "id, 
city_id")
+                
.option(IgniteDataFrameSettings.OPTION_CREATE_TABLE_PARAMETERS(), "backups=1")
+                .mode(SaveMode.Overwrite) //Overwriting entire table.
+                .save();
+
+        System.out.println("Done!");
+
+        System.out.println("Reading data from Ignite table:");
+
+        CacheConfiguration<?, ?> ccfg = new CacheConfiguration<>(CACHE_NAME);
+
+        IgniteCache<?, ?> cache = ignite.getOrCreateCache(ccfg);
+
+        //Reading saved data from Ignite.
+        List<List<?>> data = cache.query(new SqlFieldsQuery("SELECT id, name, 
city_id FROM new_persons")).getAll();
+
+        System.out.println(data);
+    }
+
+    /** */
+    private static void setupServerAndData(Ignite ignite) {
+        //Creating first test cache.
+        CacheConfiguration<?, ?> ccfg = new 
CacheConfiguration<>(CACHE_NAME).setSqlSchema("PUBLIC");
+
+        IgniteCache<?, ?> cache = ignite.getOrCreateCache(ccfg);
+
+        //Creating SQL table.
+        cache.query(new SqlFieldsQuery(
+                "CREATE TABLE person (id LONG, name VARCHAR, city_id LONG, 
PRIMARY KEY (id)) " +
+                        "WITH \"backups=1\"")).getAll();
+
+        cache.query(new SqlFieldsQuery("CREATE INDEX on Person 
(city_id)")).getAll();
+
+        //Inserting some data to tables.
+        SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO person (id, name, 
city_id) values (?, ?, ?)");
+
+        cache.query(qry.setArgs(1L, "John Doe", 3L)).getAll();
+        cache.query(qry.setArgs(2L, "Jane Roe", 2L)).getAll();
+        cache.query(qry.setArgs(3L, "Mary Major", 1L)).getAll();
+        cache.query(qry.setArgs(4L, "Richard Miles", 2L)).getAll();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fcc4d4a3/examples/src/test/spark/org/apache/ignite/spark/examples/JavaIgniteDataFrameSelfTest.java
----------------------------------------------------------------------
diff --git 
a/examples/src/test/spark/org/apache/ignite/spark/examples/JavaIgniteDataFrameSelfTest.java
 
b/examples/src/test/spark/org/apache/ignite/spark/examples/JavaIgniteDataFrameSelfTest.java
new file mode 100644
index 0000000..295814d
--- /dev/null
+++ 
b/examples/src/test/spark/org/apache/ignite/spark/examples/JavaIgniteDataFrameSelfTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.ignite.spark.examples;
+
+import org.apache.ignite.examples.spark.JavaIgniteCatalogExample;
+import org.apache.ignite.examples.spark.JavaIgniteDataFrameExample;
+import org.apache.ignite.examples.spark.JavaIgniteDataFrameWriteExample;
+import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
+import org.junit.Test;
+
+/**
+ */
+public class JavaIgniteDataFrameSelfTest extends GridAbstractExamplesTest {
+    static final String[] EMPTY_ARGS = new String[0];
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testCatalogExample() throws Exception {
+        JavaIgniteCatalogExample.main(EMPTY_ARGS);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testDataFrameExample() throws Exception {
+        JavaIgniteDataFrameExample.main(EMPTY_ARGS);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testDataFrameWriteExample() throws Exception {
+        JavaIgniteDataFrameWriteExample.main(EMPTY_ARGS);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fcc4d4a3/examples/src/test/spark/org/apache/ignite/spark/testsuites/IgniteExamplesSparkSelfTestSuite.java
----------------------------------------------------------------------
diff --git 
a/examples/src/test/spark/org/apache/ignite/spark/testsuites/IgniteExamplesSparkSelfTestSuite.java
 
b/examples/src/test/spark/org/apache/ignite/spark/testsuites/IgniteExamplesSparkSelfTestSuite.java
index df1a243..6328ee2 100644
--- 
a/examples/src/test/spark/org/apache/ignite/spark/testsuites/IgniteExamplesSparkSelfTestSuite.java
+++ 
b/examples/src/test/spark/org/apache/ignite/spark/testsuites/IgniteExamplesSparkSelfTestSuite.java
@@ -19,6 +19,7 @@ package org.apache.ignite.spark.testsuites;
 
 import junit.framework.TestSuite;
 import org.apache.ignite.spark.examples.IgniteDataFrameSelfTest;
+import org.apache.ignite.spark.examples.JavaIgniteDataFrameSelfTest;
 import org.apache.ignite.spark.examples.SharedRDDExampleSelfTest;
 import org.apache.ignite.testframework.GridTestUtils;
 
@@ -42,6 +43,7 @@ public class IgniteExamplesSparkSelfTestSuite extends 
TestSuite {
 
         suite.addTest(new TestSuite(SharedRDDExampleSelfTest.class));
         suite.addTest(new TestSuite(IgniteDataFrameSelfTest.class));
+        suite.addTest(new TestSuite(JavaIgniteDataFrameSelfTest.class));
 
         return suite;
     }

Reply via email to