Hello all,
I am trying to access hive tables using SparkSQL. Then will feed to the MlLib of Spark for sentiment analysis. I have check the Stanford NLP library which performs sentiment analysis.
I am currently stuck at the usage of MlLib of Spark and the training data with the Stanford NLP to give sentiments in Java. I am trying to give the same output as in the demo: http://nlp.stanford.edu:8080/sentiment/rntnDemo.html
The output must be a tree structure which I can feed to Tableau tool for visualisation. I need to visualise tableau data exactly the way it is in the referenced link.
Here is the code for accessing the Hive Table:
import org.apache.spark.sql.SparkSession;
public class queryhive {
public static void main(String[] args)
{
SparkSession spark = SparkSession
.builder()
.appName("Java Spark Hive Example")
.master("local[*]")
.config("hive.metastore.uris", "thrift://localhost:9083")
.enableHiveSupport()
.getOrCreate();
try
{
Dataset<Row> df = spark.sql("select * from health1 where srno=1");
df.show();
}
catch (Exception AnalysisException)
{
System.out.print("\nTable is not found\n");
}
}
}
}
Thanks in advance