#bigdata/metabase
一、背景介绍
1、Presto版本
使用阿里云集群的版本 EMR-5.4.2,Presto的版本为338;
Facebook后续不再维护,Trino 351为首个版本
2、Metabase版本
历史版本为0.38.4,新版本为0.51.5
3、0.38.4 cast to timeStamp
select cast(now() as timestamp),now()
4、0.51.5 cast to timeStamp
![[Pasted image 20241217171529.png]]
时区问题导致了Metabase无法升级
二、基于源码做二次开发
官网driver 开发模版
https://github.com/metabase/sample-driver
1、源码修改
下载源码可以忽略版本
https://github.com/metabase/metabase.git
通过日志可以看到drivers是从 modules下copy 过来的
![[Pasted image 20241217171802.png]]
查看下文件结构图
![[Pasted image 20241217172624.png]]
2、copy presto driver 及打包
- 修改metabase-plugin.yaml
driver:
name: presto-jdbc-nine
display-name: Presto-nine
lazy-load: true
parent: sql-jdbc
init:
- step: load-namespace
namespace: metabase.driver.presto-jdbc-nine
- step: register-jdbc-driver
class: com.facebook.presto.jdbc.PrestoDriver
- 修改presto_jdbc_nine.clj
- 直接将presto-jdbc 替换为 presto-jdbc
- 将该方法中的UTC 替换为 Asia/Shanghai ![[Pasted image 20241217172825.png]]
- 修改deps.edn,添加metabase/presto-jdbc-nine
:deps
{
metabase/presto-jdbc {:local/root "presto-jdbc"}
metabase/presto-jdbc-nine {:local/root "presto-jdbc-nine"}
}}
- 修改完后,根据README中的命令执行
clojure -X:build:drivers:build/driver :driver :presto-jdbc-nine
在resource/modules查看打好的jar
![[Pasted image 20241217173640.png]]
三、Trino支持的问题
可以使用starburst曲线救国,就可以查询Trino了,暂时没有时区问题
https://www.metabase.com/docs/v0.51/developers-guide/partner-and-community-drivers
https://github.com/starburstdata/metabase-driver
四、待解决问题
Decimal问题
select cast(order_fee as double),order_fee from dws.order_info_detail where data_dt = '2024-12-01' limit 1
![[Pasted image 20241217173844.png]]
底层还是使用Facebook的jar,可能是包的问题,也有可能是版本的问题,暂时使用cast to double去解决
没有办法上传jar,有需要留言吧