private static void submitSQLQuery ( QdsClient client ) throws Exception { String sampleSqlQuery = "select * from default_qubole_airline_origin_destination limit 100" ; SparkCommandBuilder sparkBuilder = client . command ( ) . spark ( ) ; // Give a name to the command. (Optional) sparkBuilder . name ( "spark-sql-test" ) ; // Setting the sql query sparkBuilder . sql ( sampleSqlQuery ) ; 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 SQL query .