Conversation
|
Documentation preview: |
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
|
Hi @idegtiarenko, I've created a changelog YAML for you. |
|
While this is open we might add couple more functions as well. This digests are defined and used in ES: Following algorithms seems to be available in several JVMs I checked: |
|
|
||
| private static final HashFunction MD5 = HashFunction.create("MD5"); | ||
|
|
||
| @FunctionInfo(returnType = "keyword", description = "Computes MD5 hash of the input.") |
There was a problem hiding this comment.
We can add the md5Hash test as an examples = @Example(...) here
|
|
||
| @Override | ||
| public Expression replaceChildren(List<Expression> newChildren) { | ||
| return new Md5(source(), field); |
There was a problem hiding this comment.
| return new Md5(source(), field); | |
| return new Md5(source(), newChildren.get(0)); |
Edit: Oh, looks like EsqlNodeSubclassTests.testReplaceChildren failed successfully with this in CI
|
|
||
| private static final HashFunction MD5 = HashFunction.create("MD5"); | ||
|
|
||
| @FunctionInfo(returnType = "keyword", description = "Computes MD5 hash of the input.") |
There was a problem hiding this comment.
| @FunctionInfo(returnType = "keyword", description = "Computes MD5 hash of the input.") | |
| @FunctionInfo(returnType = "keyword", description = "Computes the MD5 hash of the input.") |
| } | ||
|
|
||
| static List<TestCaseSupplier> createHashFunctionTestCases(String algorithm) { | ||
| return List.of(createHashFunctionTestCase(algorithm, DataType.KEYWORD), createHashFunctionTestCase(algorithm, DataType.TEXT)); |
There was a problem hiding this comment.
You can use TestCaseSupplier.forUnaryStrings(...) instead of manually creating the TestCaseSuppliers. It will also take care of both KEYWORD and TEXT types
There was a problem hiding this comment.
I would add some extra test cases, to double check both the:
- One with a FROM command
- Something like
FROM x | EVAL input = "...", hash = MD5(input)? Trying to "break" thereplaceChildren()comment bug with it MD5(123::keyword)- Maybe having MD5() as a STATS grouping
|
|
||
| private static final HashFunction MD5 = HashFunction.create("MD5"); | ||
|
|
||
| @FunctionInfo(returnType = "keyword", description = "Computes MD5 hash of the input.") |
|
|
||
| @Override | ||
| public Expression replaceChildren(List<Expression> newChildren) { | ||
| return new Md5(source(), field); |
|
Let's get this in - this will be handy for security queries! |
nik9000
left a comment
There was a problem hiding this comment.
LGTM. Could you link the other new hash functions in? Maybe add an example for them?
| include::layout/length.asciidoc[] | ||
| include::layout/locate.asciidoc[] | ||
| include::layout/ltrim.asciidoc[] | ||
| include::layout/md5.asciidoc[] |
There was a problem hiding this comment.
Can you link the other new functions?
💚 Backport successful
|
This change adds md5, sha1 and sha256 hash functions.
This change adds infrastructure to add more hash functions easier as well as
md5implementation to demonstrate it.