我可以在 Bigquery JS UDF 中使用 `TextEncoder` 吗? [英] Can I use `TextEncoder` in Bigquery JS UDF?

查看:57
本文介绍了我可以在 Bigquery JS UDF 中使用 `TextEncoder` 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 Bigquery 中使用一些 Rust wasm 代码作为 UDF,为了将 Java String 传递给 Rust 代码,需要 TextEncoderTextDecoder方便地这样做.正如这里提到的

您也可以通过这样的查询尝试一下:

<小时>

(想知道,rb62 的目标是什么?)

I am trying to use some Rust wasm code in Bigquery as UDF, and in order to pass on Java String to Rust code the TextEncoder and TextDecoder would be needed to conveniently doing that. As it mentioned here Passing a JavaScript string to a Rust function compiled to WebAssembly

But when I try out some of my code on BigQuery, I encountered an error saying TextEncoder is not defined.

You can try it out as well with a query like this: https://github.com/liufuyang/rb62-wasm/blob/master/try-3-old.sql

While a working version without using TextEncoder is at https://github.com/liufuyang/rb62-wasm/blob/master/try-3.sql

解决方案

That means the object is not defined.

As an option, bring your own TextEncoder.

For example, take your try-3-old.sql, and then add this line at the end of the JS UDF definition:

return main();
'''
OPTIONS (library="gs://fh-bigquery/js/inexorabletash.encoding.js");

And now it works:


(wondering, what's the goal with rb62?)

这篇关于我可以在 Bigquery JS UDF 中使用 `TextEncoder` 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆