The configuration is
from:https://github.com/apache/ignite/blob/master/examples/config/example-default.xml.

The code runs well with spark local[*].But it throws exception when I run it
with my spark standalone cluster  which has a master node and a worker
node.The exception is in the sql execution stage.The listTables method runs
well.

Here is my code:
       /**
         * Ignite config file.
         */
        private static final String CONFIG = "example-ignite.xml";

        /**
         * Test cache name.
         */
        private static final String CACHE_NAME = "testCache";

        /**
         * @throws IOException  */
        public static void main(String args[]) throws AnalysisException,
IOException {

                //setupServerAndData();
                Ignite ignite = Ignition.start(CONFIG);
                CacheConfiguration<?, ?> ccfg = new
CacheConfiguration<>(CACHE_NAME).setSqlSchema("PUBLIC");

        IgniteCache<?, ?> cache = ignite.getOrCreateCache(ccfg);
                
                //Creating Ignite-specific implementation of Spark session.
                IgniteSparkSession igniteSession = IgniteSparkSession.builder()
                                .appName("Spark Ignite catalog example")
                                .master("spark://my_computer_ip:7077")
                                //.master("local[*]")
                                .config("spark.executor.instances", "2")
                                .config("spark.serializer",
"org.apache.spark.serializer.KryoSerializer")
                                .config("spark.sql.adaptive.enabled",true)
                                .config("spark.sql.cbo.enabled",true)
                                .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();

                //Selecting data through Spark SQL engine.
                Dataset<Row> df = igniteSession.sql("select count(*) from my 
test_table");
                System.out.println(df.count());
                Ignition.stop(false);
        }



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to