先下载tpcds-kit(有Linux和macOS),根据其文档生成数据和查询的sql。
进入tools目录,创建下面的脚本gendata.sh,在tools上级目录下先创建data目录,然后生成1TB
#!/bin/bash
for i in {1..10}; do
./dsdgen -scale 1000 -dir ../data -parallel 10 -child $i &
done
然后hive-testbench,在ddl-tpcds/text/alltables.sql中有建表语句(用hive建表)。
建完表后LOAD DATA local INPATH "/Users/ding/tools/tpcds-kit/data/web_site.dat" OVERWRITE INTO TABLE tpcds.web_site;导入数据到对应表里。
写test.sh和trino-tpcds.sh两个脚本跑99条sql(q72可能失败,可将其删除)
test.sh如下
#!/bin/bash
for sql in `find tpcds-queries -type f`
do
sh trino-tpcds.sh ${sql}
done
trino-tpcds.sh如下
#!/bin/bash
echo $1:
java -jar trino-cli-406-executable.jar --server IP_ADDRESS:8080 --catalog hive --schema tpcds -f $1 --progress
echo "$1 end"
执行命令nohup sh test.sh &
nohup会将命令的输出结果重定向到nohup.out中,然后vim nohup.out,通过搜索tpcds-queries关键字查看每条sql的运行时间

本文介绍了如何在Linux和macOS环境下使用tpcds-kit生成TPC-DS数据和SQL查询,通过hive-testbench创建表并导入数据。作者提供了test.sh和trino-tpcds.sh脚本执行99条SQL,使用nohup进行异步运行,并分析查询时间。
8750

被折叠的 条评论
为什么被折叠?



