Any idea what I might be doing wrong. I am new to spark and I cannot
proceed forward from here:
-------------------------------------------------------------------
JavaSparkContext sc = new JavaSparkContext("local[*]", "test spark-mongodb
java");
SQLContext sqlContext = new SQLContext(sc);
Map options = new HashMap();
options.put("host", "host:port");
options.put("database", "database");
options.put("collection", "collectionName");
options.put("credentials", "username,database,password");
System.out.println("Check1");
DataFrame df =
sqlContext.read().format("com.stratio.datasource.mongodb").options(options).load();
df.registerTempTable("collectionName");
df.show();
----------------------------------------------------------------------
On Fri, Jun 10, 2016 at 3:36 PM, Umair Janjua <[email protected]>
wrote:
> Hi my code,
> When i run this program is gets stuck at
> sqlContext.read().format("com.stratio.datasource.mongodb").options(options).load();
> line and then it does not proceed forward. Nothing happens after that. What
> should I do? How can I debug it. I am stuck here. Please any hint would be
> appreciated.
>
>
> -----------------------------------------------------------------------------------------
> JavaSparkContext sc = new JavaSparkContext("local[*]", "test
> spark-mongodb java");
> SQLContext sqlContext = new SQLContext(sc);
>
> Map options = new HashMap();
> options.put("host", "host:port");
> options.put("database", "database");
> options.put("collection", "collectionName");
> options.put("credentials", "username,database,password");
>
> System.out.println("Check1");
> DataFrame df =
> sqlContext.read().format("com.stratio.datasource.mongodb").options(options).load();
>
> sqlContext.sql("SELECT * FROM collectionName");
> System.out.println("Check2");
> df.count();
> System.out.println("Check DataFrame Count: " + df.count());
> System.out.println("Check3");
> df.registerTempTable("collectionName");
> df.show();
>
>
> -----------------------------------------------------------------------------------------
>
> The above code only gets printed till Check1 and then it gets stuck and
> nothing happens.
>
> Cheers
>