You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
load hbase.t_mbl_user_version_info
where `spark.table.schema`="userid:String,osversion:String,toolversion:String"
and `hbase.table.schema`=":rowkey,info:osversion,info:toolversion"
and `hbase.zookeeper.quorum`="localhost:2181"
as tb;
load jdbc.ai_log_count
where driver="com.mysql.jdbc.Driver"
and url="jdbc:mysql://localhost/db?characterEncoding=utf8"
and user="root"
and password="***"
as tb;
保存数据
save append tb as jdbc.aatest_delete;
文件操作 (其中formate可为:json、orc、csv、parquet、text)
加载数据
load format.`path` as tb;
保存数据
save tb as formate.`path` partitionBy uid coalesce 2;
Kafka
离线
load kafka.`topicName`
where maxRatePerPartition="200"
and `group.id`="consumerGroupId"
as tb;
select * from tb;
参数
说明
默认值
autoCommitOffset
是否提交offset
false
实时
load kafka.`mc-monitor`
where startingoffsets="latest"
and failOnDataLoss="false"
and `spark.job.mode`="stream"
as tb1;
register watermark.tb1
where eventTimeCol="timestamp"
and delayThreshold="10 seconds"
select window.end as time_end,
count(1) as count
from tb1 a
group by window(a.timestamp,"10 seconds","10 seconds")
as tb2;
save tb2 as json.`/tmp/abc6`
where outputMode="Append"
and streamName="Stream"
and duration="10"
and sendDingDingOnTerminated="true"
and `mail.receiver`="3146635263@qq.com"
and checkpointLocation="/tmp/cp/cp16";
参数
说明
默认值
spark.job.mode
任务模式(batch:离线任务,stream:实时任务)
batch
mail.receiver
任务失败邮件通知(多个邮箱逗号分隔)
无
sendDingDingOnTerminated
钉钉Robot通知
false
实时任务失败会自动重启,可以通过streamJobMaxAttempts配置(默认3次)。
动态注册UDF函数
register udf.`myupper`
where func="
def apply(name:String)={
name.toUpperCase
}
";
load jsonStr.'
{"name":"ufo"}
{"name":"uu"}
{"name":"HIN"}
' as tb1;
select myupper(name) as newName from tb1;
IQL (项目地址:https://github.com/teeyog/IQL)
README-EN
基于SparkSQL实现了一套即席查询服务,具有如下特性:
支持的数据源:hdfs、hive、hbase、kafka、mysql、es、mongo
支持的文件格式:parquet、csv、orc、json、text、xml
在Structured Streaming支持的Sink之外还增加了对Hbase、MySQL、es的支持
Quickstart
HBase
加载数据
保存数据
MySQL
文件操作 (其中formate可为:json、orc、csv、parquet、text)
Kafka
动态注册UDF函数
include(import等效)语法,通过路径引入脚本片段
参考
StreamingPro之MLSQL
spark sql在喜马拉雅的使用之xql
The text was updated successfully, but these errors were encountered: