[#17939] Implement FFT table function for table model#18006
Open
DaZuiZui wants to merge 3 commits into
Open
Conversation
dc535ca to
2faa54b
Compare
Contributor
Author
|
Updated this PR for the latest review comments:
Tests run locally with JDK 21:
|
Contributor
Author
|
Follow-up update:
Pushed as a normal follow-up commit (no force push). Tests run locally with JDK 21:
|
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.
Description
FFT table-valued function
This PR implements the v1 built-in
FFT/ffttable-valued function for the table model.The function accepts a required
DATAtable argument with set semantics andORDER BY time, plus optionalSAMPLE_INTERVAL,N, andNORMarguments. It transforms all numeric input columns excepttimeand partition columns, emits the full complex spectrum, and returnsfrequency_index,frequency, and<column>_real/<column>_imagcolumns. When partition columns exist, they are kept at the front of the output schema.The FFT implementation uses JTransforms
DoubleFFT_1D.Nsupports default partition length, truncation, and zero padding.NORMsupportsbackward,forward, andortho.SAMPLE_INTERVALcan be supplied as a duration literal; otherwise the interval is inferred from the partition time range.Analyzer, planner, and validation
The function is registered as a built-in table function and gets analyzer/planner handling similar to
M4where needed so the output column order matches the table-function contract.Validation covers:
DATAmust haveORDER BY timein ascending order.SAMPLE_INTERVAL, if provided, must be positive.N, if provided, must be positive.NORMmust be one ofbackward,forward, orortho.SAMPLE_INTERVALis omitted, at least two rows are required to infer it.Tests
This PR adds focused unit coverage for the FFT processor, analyzer/planner coverage for built-in table-function recognition and schema handling, and a table-model IT covering normal execution and failure cases.
Tested locally with:
This PR has:
Key changed/added classes (or packages if there are too many classes) in this PR
org.apache.iotdb.commons.udf.builtin.relational.tvf.FFTTableFunctionorg.apache.iotdb.commons.queryengine.plan.relational.function.TableBuiltinTableFunctionorg.apache.iotdb.db.queryengine.plan.relational.analyzer.StatementAnalyzerorg.apache.iotdb.db.queryengine.plan.relational.planner.RelationPlannerorg.apache.iotdb.commons.udf.builtin.relational.tvf.FFTTableFunctionTestorg.apache.iotdb.db.queryengine.plan.relational.analyzer.TableFunctionTestorg.apache.iotdb.relational.it.db.it.IoTDBFFTTableFunctionITRelated to #17939.