隨筆 - 6  文章 - 129  trackbacks - 0
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(14)

          隨筆檔案(6)

          文章分類(467)

          文章檔案(423)

          相冊

          收藏夾(18)

          JAVA

          搜索

          •  

          積分與排名

          • 積分 - 827199
          • 排名 - 49

          最新評論

          閱讀排行榜

          評論排行榜


          public class FirstSparkSql {
          public static void main(String[] args) {


          String masterMode = "local";//spark://master:7077

          SparkConf conf = new SparkConf();
          //conf.set("spark.executor.memory", "1024m");
          conf.setAppName("First Spark SQL");
          conf.setMaster(masterMode);
          //解決異常:IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI
          conf.set("spark.sql.warehouse.dir","D:\\temp_files");

          JavaSparkContext sc = new JavaSparkContext(conf);

          SparkSession spark = SparkSession.builder().config(conf).getOrCreate();
          Dataset<Row> df = spark.read().json("hdfs://master:9000/user/spark/input/persons.txt");
          df.show();
          sc.stop();
          }
          }


          posted on 2018-03-21 11:31 Ke 閱讀(1135) 評論(0)  編輯  收藏 所屬分類: spark
          主站蜘蛛池模板: 全南县| 德庆县| 铜川市| 五河县| 枞阳县| 浮山县| 夏河县| 资阳市| 迭部县| 滦平县| 七台河市| 合江县| 新丰县| 民勤县| 贞丰县| 曲松县| 平武县| 永泰县| 汪清县| 长乐市| 依安县| 交城县| 察哈| 仁怀市| 林口县| 武邑县| 安龙县| 义马市| 交口县| 海南省| 安庆市| 沐川县| 杭锦旗| 普兰县| 论坛| 朝阳市| 莱芜市| 榆中县| 毕节市| 西安市| 防城港市|