天天看点

spark-shell读取外部数据源

启动

  • spark-shell –jars a.jar,b.jar

    这种是local模式

    多个jar包之间用逗号分隔,不能有空格

  • spark-shell –jars a.jar,b.jar –master spark://ip:7077

使用方式

import cn.edu.thu.tsfile._
spark.read.tsfile("path")           
spark.read.format("cn.edu.thu.tsfile").load("hdfs://ip:9000/file1")

sql("create temprory view tsfile using cn.edu.thu.tsfile options (path \"hdfs://ip:port/file1\")")
sql("select * from tsfile").count()           

继续阅读