cube.js dremio-odbc-cubejs-driver TypeError: Do not know how to serialize a BigInt 问题

因为cube.js cache 部分使用了json 进行key 的存储,但是因为odbc 部分数据类型会有bigint,cube.js 会报错

解决方法

通过hack 的模式

const CubejsServer = require('@cubejs-backend/server');
const cubejs = require("./cube")
const server = new CubejsServer(cubejs);
BigInt.prototype.toJSON = function() { return this.toString() }
function start(){
    server
    .listen()
    .then(({ version, port }) => {
      console.log(`🚀 Cube.js server (${version}) is listening on ${port}`);
    })
    .catch((e) => {
      console.error('Fatal error during server start: ');
      console.error(e.stack || e);
    });
}
 
start()

说明

以上是关于bigint 的,因为没有经过完整的测试,其他类型可能会有类似的问题,可以参考解决

参考资料

https://github.com/GoogleChromeLabs/jsbi/issues/30
https://github.com/rongfengliang/cubejs-dremio-odbc-driver
https://docs.dremio.com/software/drivers/arrow-flight-sql-odbc-driver/#downloading-and-installing-on-macos
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json

posted on   荣锋亮  阅读(340)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2022-03-02 dremio 社区版目前依赖的一些闭源包
2022-03-02 dremio 源码分析学习的几个方便工具
2022-03-02 dremio CTAS 以及DROP 功能简单说明
2022-03-02 dremio 社区flight 格式化扩展说明
2021-03-02 sijms/go-ora 1.0 发布了,使用buffer提升了系统的性能
2020-03-02 pg pg_stat_statements 扩展使用
2019-03-02 pghoard 面向云存储的pg 备份&&恢复工具

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示