编写 udf,util.lua

function slice(rec, bin, a, b)
  local s = rec[bin]
  if type(s) == 'string' then
    return s:sub(a, b)
  end
  return nil
end

aql

aql> register module '/udfs/util.lua'
OK, 1 module added.

aql> insert into large.foo (PK, x) values ('1', "Alright I like the beat except the snare, kick and keys")
OK, 1 record affected.

aql> execute util.slice('x', 9, 23) on large.foo where PK='1'
+-------------------+
| slice             |
+-------------------+
| "I like the beat" |
+-------------------+
1 row in set (0.001 secs)

OK