Lambda functions on strings, ... #9752
ErikJansenIRefact
started this conversation in
Ideas
Replies: 1 comment
-
|
There's work being done on |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As an example we need to apply a check on Dutch BSN numbers. A BSN should be of length 9 with only numeric characters.
The second test is that a should comply with a BSN-11 test.
This is how we can now implement this in DuckDB (a column bsn exists):
list_aggregate([array_extract(bsn,x)::int*(if(x=9,-1,10-x)) for x in range(1,10,1)],'sum')%11 = 0
But if would have been perhaps more convenient to be able to iterate (as a reduce function to sum the product) over the BSN string character per character and apply a lambda function with the character and index.
Beta Was this translation helpful? Give feedback.
All reactions