Rob Grzywinski
Sep 7, 2018 · 1 min read

You mention the necessity to use LegacySQL due to the lack of support of Promises in StandardSQL. I would suggest obviating the need for supporting Promises by simply using the synchronous approach to instantiating a WebAssembly instance.

The result will simply change the last few lines of the UDF:

const module = new WebAssembly.Module(bytes);
const instance = new WebAssembly.Instance(module, imports);
const exports = instance.exports;
const sum = exports._sum;

Great posts by you and Francesc!

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade