Search in sources :

Example 1 with HiveContext

use of org.apache.spark.sql.hive.HiveContext in project camel by apache.

the class HiveSparkProducer method process.

@Override
public void process(Exchange exchange) throws Exception {
    HiveContext hiveContext = resolveHiveContext();
    String sql = exchange.getIn().getBody(String.class);
    DataFrame resultFrame = hiveContext.sql(sql);
    exchange.getIn().setBody(getEndpoint().isCollect() ? resultFrame.collectAsList() : resultFrame.count());
}
Also used : DataFrame(org.apache.spark.sql.DataFrame) HiveContext(org.apache.spark.sql.hive.HiveContext)

Aggregations

DataFrame (org.apache.spark.sql.DataFrame)1 HiveContext (org.apache.spark.sql.hive.HiveContext)1