zoukankan      html  css  js  c++  java
  • Zeppelin的入门使用系列之使用Zeppelin来运行Spark SQL(四)

      不多说,直接上干货!

    前期博客

    Zeppelin的入门使用系列之使用Zeppelin来创建临时表UserTable(三)

    1、 运行年龄统计的Spark SQL

      (1)  输入Spark SQL时,必须在第一行输入%sql 。  %sql主要是告诉Zeppelin的解释器(Interpreter),后续输入的命令是Spark SQL。

    %sql
    select  age,count(*)  counts
    from  UserTable
    group by age
    order  by age

      (2) 、显示年龄统计的柱形图

      可以选择不同图标来显示不同的图形,例如单击“柱形图”图标来显示柱形图

    2、 运行性别统计的Spark SQL

       (1)  、在新的段落里,先输入%sql再按Enter键,然后输入下列Spark SQL

    %sql
    select  gender,count(*)  counts
    from UserTable
    group by gender

       (2)显示性别统计的饼图

      可以选择不同图标来显示不同的图形,例如单击“饼图”图标来显示饼图

     

    3、按照职业统计

      (1)、在新的段落输入Spark SQL中

    %sql
    select  occupation,
    count(*)  counts
    from UserTablee
    group  by  occupation
    order by counts

      

      (2)、显示职业统计的饼图

      可以选择不同图标来显示不同的图形,例如单击“饼图”图标来显示饼图

  • 相关阅读:
    新的起点,虽半步即天涯
    自定义函数
    冒泡排序 数字去重
    for 循环练习题
    for 循环练习题(2)
    for 循环 乘法口诀表
    js基础标签用法
    网页格式布局 流式布局
    样式表属性
    框架
  • 原文地址:https://www.cnblogs.com/zlslch/p/7466858.html
Copyright © 2011-2022 走看看