Skip to content
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

Add format function #14281

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

FearfulTomcat27
Copy link
Contributor

This pull request introduces a new FORMAT function to the IoTDB query engine, along with the necessary infrastructure to support it. The primary changes include the addition of the FormatColumnTransformer class, updates to the TableBuiltinScalarFunction enum, and modifications to various files to incorporate the new function.

Major Changes:

New Functionality:

  • Added the FormatColumnTransformer class to handle the FORMAT function in query transformations. (iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/unary/scalar/FormatColumnTransformer.java)

Integration with Query Engine:

  • Updated the TableBuiltinScalarFunction enum to include the new FORMAT function. (iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/unary/scalar/TableBuiltinScalarFunction.java)
  • Modified the ColumnTransformerBuilder to create a FormatColumnTransformer when the FORMAT function is used. (iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/relational/ColumnTransformerBuilder.java) [1] [2]
  • Added validation in TableMetadataImpl to ensure the first argument of the FORMAT function is a char type. (iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java)

Utility Enhancements:

  • Added methods in DateTimeUtils to convert timestamps to LocalDateTime and ZonedDateTime, which are used by the FormatColumnTransformer. (iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/DateTimeUtils.java)

Testing:

  • Created a new integration test class IoTDBFormatFunctionTableIT to test the FORMAT function with various data types. (integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBFormatFunctionTableIT.java)##

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant