Add built-in scalar function to_base64 for the IoTDB table model, supporting STRING, TEXT, and BLOB types #15977
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.
This pull request introduces a new built-in scalar function,
to_base64
, to the IoTDB query engine. The function allows encodingSTRING
,TEXT
, andBLOB
data types to Base64 format. Key changes include the implementation of the function, integration into the query engine, and comprehensive testing.Implementation of
to_base64
:Function logic and transformation:
ToBase64ColumnTransformer
class to handle Base64 encoding for supported data types (STRING
,TEXT
,BLOB
) in unary column transformations.Integration into the query engine:
ColumnTransformerBuilder
to include logic for processing theto_base64
function and returning the appropriate column transformer.TableMetadataImpl
to validate the input arguments forto_base64
and ensure only one argument of a supported type is accepted.TO_BASE64
to theTableBuiltinScalarFunction
enumeration to register the function.Testing and validation:
Unit tests for
ToBase64ColumnTransformer
:ToBase64ColumnTransformerTest
to verify functionality for supported data types (STRING
,TEXT
,BLOB
), handling of null values, multi-row transformations, and selective evaluation.Integration tests:
IoTDBToBase64FunctionTableIT
to test theto_base64
function in query scenarios, including successful transformations and error handling for unsupported types.