-
Notifications
You must be signed in to change notification settings - Fork 181
Implement cryptographic hash UDFs #3574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
|
A high-level question: could you explain in PR description why choose to self-implement instead of leveraging Calcite builtin functions (This question should be answered for each function in similar PRs) |
|
|
||
| Example:: | ||
|
|
||
| os> source=people | eval `SHA1('hello')` = SHA1('hello') | fields `SHA1('hello')` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please apply function on field of people index
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are corrected. Document kept unchanged.
|
|
||
| Example:: | ||
|
|
||
| os> source=people | eval `SHA2('hello',256)` = SHA2('hello',256) | fields `SHA2('hello',256)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| | 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 | | ||
| +------------------------------------------------------------------+ | ||
|
|
||
| os> source=people | eval `SHA2('hello',512)` = SHA2('hello',512) | fields `SHA2('hello',512)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
I found that |
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
|
|
||
| // Register PPL UDF operator | ||
| registerOperator(SPAN, PPLBuiltinOperators.SPAN); | ||
| registerOperator(SHA2, PPLBuiltinOperators.SHA2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with using SHA2, as it provides more functionality.
core/src/main/java/org/opensearch/sql/expression/function/udf/CryptographicFunction.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/function/udf/CryptographicFunction.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/function/udf/CryptographicFunction.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
* Implement cryptographic functions Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Implement cryptographic UDFs Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Wrap message digests with ThreadLocal to enforce thread safety Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Create documentation for cryptographic hash PPL functions Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Use calcite implementations of md5 and sha1 Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Test field values in cryptographic UDFs Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Refactor: update sha2 implementations with DigestUtils Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> --------- Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> Signed-off-by: xinyual <xinyual@amazon.com>
Description
This PR implements
SHA2with UDFs, and reuse calciteMD5,SHA1sql operators as available functions.SHA2family is not fully implemented in Calcite SQL functions - onlySHA256andSHA512are available,SHA224andSHA384are missing. Therefore, we implement our own.Issues Resolved
Resolves #3573
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.