test: add SQL file tests for aes_encrypt, aes_decrypt, try_aes_decrypt#4557
Open
andygrove wants to merge 3 commits into
Open
test: add SQL file tests for aes_encrypt, aes_decrypt, try_aes_decrypt#4557andygrove wants to merge 3 commits into
andygrove wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
N/A. This adds test coverage only. Related: #4558.
Rationale for this change
The AES functions (
aes_encrypt,aes_decrypt,try_aes_decrypt) had no Comet test coverage. They areRuntimeReplaceableand lower to aStaticInvokeofExpressionImplUtils.aesEncrypt/aesDecrypt. This test pins down their current behavior in Comet.What changes are included in this PR?
Adds
spark/src/test/resources/sql-tests/expressions/misc/aes.sql, covering GCM (default), ECB, and CBC modes; 16/24/32-byte keys; column and literal arguments; NULL inputs; andtry_aes_decrypton invalid ciphertext. Becauseaes_encryptuses a random IV for GCM/CBC (nondeterministic output), those cases are tested via round-trip (aes_decrypt(aes_encrypt(x, k), k) = x); ECB output is deterministic and compared directly.Empirical finding: all three functions currently fall back to Spark. Comet's
StaticInvokeserde only allowlists a few target methods (readSidePadding,isLuhnNumber, URL encode/decode), andaesEncrypt/aesDecryptare not among them, so the plan reportsStatic invoke expression: aesEncrypt is not supported. All queries therefore usequery spark_answer_only(results are still validated against Spark). When native support is added, they can be promoted to the defaultquerymode.How are these changes tested?
This PR is test-only. The file runs under
CometSqlFileTestSuite. Verified locally:Result: the discovered test file passes.