public class LensRDDClient extends Object
Create RDD from a Lens query. User can poll returned query handle with isReadyForRDD() until the RDD is ready to be used.
Example -LensRDDClient client = new LensRDDClient(javaSparkContext); QueryHandle query = client.createLensRDDAsync("SELECT msr1 from TEST_CUBE WHERE ...", conf); while (!client.isReadyForRDD(query)) { Thread.sleep(1000); } JavaRDD<ResultRow> rdd = client.getRDD(query).toJavaRDD(); // Consume RDD here - rdd.map(...);
Alternatively in blocking mode
JavaRDD<ResultRow> rdd = client.createLensRDD("SELECT msr1 from TEST_CUBE WHERE ...", conf);
Modifier and Type | Class and Description |
---|---|
static class |
LensRDDClient.LensRDDResult
Container object to store the RDD and corresponding Lens query handle.
|
Constructor and Description |
---|
LensRDDClient(org.apache.spark.api.java.JavaSparkContext sparkContext)
Create an RDD client with given spark Context.
|
LensRDDClient(org.apache.spark.api.java.JavaSparkContext sparkContext,
LensClient lensClient)
Instantiates a new lens rdd client.
|
LensRDDClient(org.apache.spark.SparkContext sc)
Create an RDD client with given spark Context.
|
LensRDDClient(org.apache.spark.SparkContext sparkContext,
LensClient lensClient)
Instantiates a new lens rdd client.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelRDD(QueryHandle queryHandle)
Allow cancelling underlying query in case of non blocking RDD creation.
|
LensRDDClient.LensRDDResult |
createLensRDD(String query)
Blocking call to create an RDD from a Lens query.
|
QueryHandle |
createLensRDDAsync(String query)
API for non blocking use.
|
LensRDDClient.LensRDDResult |
getRDD(QueryHandle queryHandle)
Get the RDD created for the query.
|
boolean |
isReadyForRDD(QueryHandle queryHandle)
Check if the RDD is created.
|
public LensRDDClient(org.apache.spark.api.java.JavaSparkContext sparkContext)
sparkContext
- the spark contextpublic LensRDDClient(org.apache.spark.SparkContext sc)
sc
- the scpublic LensRDDClient(org.apache.spark.api.java.JavaSparkContext sparkContext, LensClient lensClient)
sparkContext
- the spark contextlensClient
- the lens clientpublic LensRDDClient(org.apache.spark.SparkContext sparkContext, LensClient lensClient)
sparkContext
- the spark contextlensClient
- the lens clientpublic QueryHandle createLensRDDAsync(String query) throws LensAPIException
query
- the queryLensAPIException
- the lens exceptionpublic boolean isReadyForRDD(QueryHandle queryHandle) throws LensException
queryHandle
- the query handleLensException
- the lens exceptionpublic void cancelRDD(QueryHandle queryHandle) throws LensException
queryHandle
- the query handleLensException
- the lens exceptionpublic LensRDDClient.LensRDDResult getRDD(QueryHandle queryHandle) throws LensException
queryHandle
- the query handleLensException
- the lens exceptionpublic LensRDDClient.LensRDDResult createLensRDD(String query) throws LensAPIException, LensException
query
- the queryLensException
- the lens exceptionLensAPIException
Copyright © 2014–2016 Apache Software Foundation. All rights reserved.