All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.datastax.insight.ml.spark.hive.HiveHandler Maven / Gradle / Ivy

The newest version!
package com.datastax.insight.ml.spark.hive;

import com.datastax.insight.spec.DataSetOperator;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;

public class HiveHandler implements DataSetOperator {
    public static Dataset hsql(String... hql){
        SparkSession spark = SparkSession
                .builder()
                .appName("datastax-Insight Hive Operator")
                .getOrCreate();

        Dataset result = null;

        for(String sql : hql){
            result = spark.sql(sql);
        }

        return result;
    }

    public static Dataset hsql(String hql){
        String[] sql = hql.split(";");
        return hsql(sql);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy