Skip to content

Commit

Permalink
add SQL LENGTH() function as alias for len() (#5486)
Browse files Browse the repository at this point in the history
  • Loading branch information
mccanne authored Nov 17, 2024
1 parent b2c46ef commit 5c1851b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion runtime/sam/expr/function/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func New(zctx *super.Context, name string, narg int) (expr.Function, field.Path,
case "grok":
argmin, argmax = 2, 3
f = newGrok(zctx)
case "len":
case "len", "length":
f = &LenFn{zctx: zctx}
case "abs":
f = &Abs{zctx: zctx}
Expand Down
2 changes: 1 addition & 1 deletion runtime/vam/expr/function/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func New(zctx *super.Context, name string, narg int) (expr.Function, field.Path,
f = &Join{zctx: zctx}
case "kind":
f = &Kind{zctx: zctx}
case "len":
case "len", "length":
f = &Len{zctx}
case "levenshtein":
argmin, argmax = 2, 2
Expand Down
9 changes: 9 additions & 0 deletions runtime/ztests/expr/function/length.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
zed: SELECT LENGTH('W3Schools.com');

vector: true

input: |
null
output: |
{length:13}

0 comments on commit 5c1851b

Please sign in to comment.