aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/lambda/lambda_udf.sql
blob: aff4e456064fb9bd7435ea0ae5402e90589a3e31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* postgres can not */
/* syntax version 1 */
USE plato;

$shiftSteps = 1;
$linear = ($x, $z) -> {
  $v = 10 * $z + $x;
  $shift = ($item) -> {
      return $item << $shiftSteps
  };
  $res = Math::Floor(Math::Pi() * $shift($v));
  return $res
};

--INSERT INTO Output
SELECT t.*, $linear(cast(key as uint64), cast(subkey as uint64)) as linear FROM Input as t;