public class SparkSQLTest16 {
public static void main(String[] args){
SparkSession spark = SparkSession
.builder()
.appName("SparkSQLTest16")
.config("spark.some.config.option", "some-value")
.getOrCreate();
Dataset<Row> df = spark.read().json("file:///home/pyspark/test.json");
df.createOrReplaceTempView("compmtesttable");
String tmpSql = "select inst_no,max(score),min(score) " +
" from compmtesttable where age = 12 group by inst_no";
spark.sql(tmpSql).show();
spark.stop();
}
spark SQL 执行测试
于 2023-03-08 15:46:06 首次发布