private static void submitScalaProgram ( QdsClient client ) throws Exception { String sampleProgram = "println(\"hello world\")" ; SparkCommandBuilder sparkBuilder = client . command ( ) . spark ( ) ; // Give a name to the command. (Optional) sparkBuilder . name ( "spark-scala-test" ) ; //Setting the program here sparkBuilder . program ( sampleProgram ) ; //setting the language here sparkBuilder . language ( "scala" ) ; CommandResponse commandResponse = sparkBuilder . invoke ( ) . get ( ) ; ResultLatch resultLatch = new ResultLatch ( client , commandResponse . getId ( ) ) ; ResultValue resultValue = resultLatch . awaitResult ( ) ; System . out . println ( resultValue . getResults ( ) ) ; String s = client . command ( ) . logs ( "" + commandResponse . getId ( ) ) . invoke ( ) . get ( ) ; System . err . println ( s ) ; }
An Example of submitting Spark Command as a Scala program . Similarly we can submit Spark Command as a SQL query R program and Java program .