spark sql thrift server

### create data
## cat /dev/urandom | head -1 | md5sum | head -c 8
## echo "$(date +%s)"|sha256sum|base64|head -c 16;echo
## cat /dev/urandom | awk ‘NR==1{print $0|"md5sum|base64|grep -Eo ‘^.{16}‘";exit}‘
for i in {1..100000}
do
    passwd=$(echo $RANDOM| md5sum | head -c 8)
    echo "${i},${passwd}"
done >/tmp/tmpa

-- create table
use xt_cfbdm_safe;
create table tmpa (id string,name string)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘,‘
stored as textfile;

### create hql file
cat >/tmp/tmpa.q <<‘EOF‘
use xt_cfbdm_safe;
select
    cast(id%4 as int) as id
    ,count(1) as cnt
    ,count(distinct name) as diff
    ,count(distinct substr(name,1,4)) as diff2
    ,count(distinct substr(name,1,3)) as diff3
    ,count(distinct substr(name,1,2)) as diff4
    ,count(distinct substr(name,1,1)) as diff5
from tmpa
group by id%4
order by id;
EOF

-- load data
load data local inpath ‘/tmp/tmpa‘ overwrite into table tmpa;

### 创建thrift server
/usr/hdp/2.6.0.3-8/spark/sbin/start-thriftserver.sh --master yarn \
--hiveconf hive.server2.thrift.bind.host=192.168.1.77 \
--hiveconf hive.server2.thrift.port=14000

### excute job
beeline -n root -u jdbc:hive2://192.168.1.77:14000/xt_cfbdm_safe -f /tmp/tmpa.q
时间: 2024-08-06 19:45:43

spark sql thrift server的相关文章

「Spark」Spark SQL Thrift Server运行方式

Spark SQL可以使用JDBC/ODBC或命令行接口充当分布式查询引擎.这种模式,用户或者应用程序可以直接与Spark SQL交互,以运行SQL查询,无需编写任何代码. Spark SQL提供两种方式来运行SQL: 通过运行Thrift Server 直接执行Spark SQL命令行 运行Thrift Server方式 1.先运行Hive metastore nohup hive --service metastore & 2.在 hdfs-site.xml 中添加以下配置 <prope

spark 启动thrift server 支持 jdbc连接

在 ./conf下 创建 hive-site.xml 添加: <configuration> <property> <name>hive.metastore.client.connect.retry.delay</name> <value>5</value> </property> <property> <name>hive.metastore.client.socket.timeout</n

Apache Spark 2.2.0 中文文档 - Spark SQL, DataFrames and Datasets Guide | ApacheCN

Spark SQL, DataFrames and Datasets Guide Overview SQL Datasets and DataFrames 开始入门 起始点: SparkSession 创建 DataFrames 无类型的Dataset操作 (aka DataFrame 操作) Running SQL Queries Programmatically 全局临时视图 创建Datasets RDD的互操作性 使用反射推断Schema 以编程的方式指定Schema Aggregatio

Spark 官方文档(5)——Spark SQL,DataFrames和Datasets 指南

Spark版本:1.6.2 概览 Spark SQL用于处理结构化数据,与Spark RDD API不同,它提供更多关于数据结构信息和计算任务运行信息的接口,Spark SQL内部使用这些额外的信息完成特殊优化.可以通过SQL.DataFrames API.Datasets API与Spark SQL进行交互,无论使用何种方式,SparkSQL使用统一的执行引擎记性处理.用户可以根据自己喜好,在不同API中选择合适的进行处理.本章中所有用例均可以在spark-shell.pyspark shel

Spark1.1.0 Spark SQL Programming Guide

Spark SQL Programming Guide Overview Getting Started Data Sources RDDs Inferring the Schema Using Reflection Programmatically Specifying the Schema Parquet Files Loading Data Programmatically Configuration JSON Datasets Hive Tables Performance Tuning

如何使用Spark SQL 的JDBC server

简介 Spark SQL  provides JDBC connectivity, which is useful for connecting business intelligence (BI) tools to a Spark cluster and for sharing a cluster across multipleusers. The JDBC server runs as a standalone Spark driver program that can be shared

spark结构化数据处理:Spark SQL、DataFrame和Dataset

本文讲解Spark的结构化数据处理,主要包括:Spark SQL.DataFrame.Dataset以及Spark SQL服务等相关内容.本文主要讲解Spark 1.6.x的结构化数据处理相关东东,但因Spark发展迅速(本文的写作时值Spark 1.6.2发布之际,并且Spark 2.0的预览版本也已发布许久),因此请随时关注Spark SQL官方文档以了解最新信息. 文中使用Scala对Spark SQL进行讲解,并且代码大多都能在spark-shell中运行,关于这点请知晓. 概述 相比于

第57课:Spark SQL on Hive配置及实战

1,首先需要安装hive,参考http://lqding.blog.51cto.com/9123978/1750967 2,在spark的配置目录下添加配置文件,让Spark可以访问hive的metastore. [email protected]:/usr/local/spark/spark-1.6.0-bin-hadoop2.6/conf# vi hive-site.xml <configuration> <property>   <name>hive.metast

Spark SQL CLI 实现分析

背景 本文主要介绍了Spark SQL里目前的CLI实现,代码之后肯定会有不少变动,所以我关注的是比较核心的逻辑.主要是对比了Hive CLI的实现方式,比较Spark SQL在哪块地方做了修改,哪些地方与Hive CLI是保持一致的.可以先看下总结一节里的内容. Spark SQL的hive-thriftserver项目里是其CLI实现代码,下面先说明Hive CLI的主要实现类和关系,再说明Spark SQL CLI的做法. Hive CLI 核心启动类是org.apache.hive.se