zoukankan      html  css  js  c++  java
  • Spark 学习之 spark-sql.sh的简单使用

      启动hadoop,启动Spark。

      造一份简单的测试数据customers.txt,为了方便,我把它放在了spark/bin目录:

    100, John Smith, Austin, TX, 78727
    200, Joe Johnson, Dallas, TX, 75201
    300, Bob Jones, Houston, TX, 77028
    400, Andy Davis, San Antonio, TX, 78227
    500, James Williams, Austin, TX, 78727
    

      启动Spark-SQL:

    ./spark-sql.sh
    

      

      将数据映射成数据库表:

    create table Customer(
    id string,
    name string,
    city string,
    company string,
    num string
    )
    ROW FORMAT DELIMITED FIELDS TERMINATED BY ','; 
    

      加载数据:

    load data local inpath './customers.txt' overwrite into table Customer;
    

      查询数据:

    select * from Customer;
    

      

      完!

  • 相关阅读:
    mmall商城用户模块开发总结
    Hadoop伪分布式安装与配置
    1.2假设空间
    1.1基本术语
    文献笔记
    文献下载
    文献管理
    文献检索
    python:函数详解2
    python:函数详解
  • 原文地址:https://www.cnblogs.com/lsnl8480/p/4734836.html
Copyright © 2011-2022 走看看