I am using relatively expensive computation in the custom function defined like this:
CREATE TEMP FUNCTION HMAC256(message STRING, secret STRING)
RETURNS STRING
LANGUAGE js
OPTIONS (
-- copy this Forge library file to Storage:
-- https://cdn.jsdelivr.net/npm/node-forge@0.7.0/dist/forge.min.js
-- @see https://github.com/digitalbazaar/forge
library=["gs://.../forge.min.js"]
)
AS
"""
var hmac = forge.hmac.create();
hmac.start('sha256', secret);
hmac.update(message);
return hmac.digest().toHex();
""";
SELECT HMAC256("test", "111");
-- Row f0_
-- 1 f8320c4eded4b06e99c1a884a25c80b2c88860e13b64df1eb6f0d3191023482b
Will this be more expensive compared to applying LOWER
function for example?
I cannot see anything different in the bytes billed details while HMAC256
took 4 min on my dataset compared to 14 seconds for LOWER
.
It would be awesome if price is the same. I have a feeling I miss something.