feat(library-udf): add TableFFT function for table model#17942
Open
dahyvuun wants to merge 1 commit into
Open
Conversation
- Implement TableFFT implementing TableFunction interface - Support result parameter: real, imag, abs, angle - Reuse DoubleFFT_1D from JTransforms library - Add unit tests for sine wave peak frequency and DC component Closes apache#17939
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
What is this PR?
Implements TableFFT, a new TableFunction that brings FFT (Fast Fourier Transform) support to the IoTDB table model, as requested in #17939.
Design Decisions
Implements TableFunction interface following the existing RepeatExample pattern in library-udf
Reuses DoubleFFT_1D from JTransforms (already a dependency — no new libs added)
Input values are accumulated in process() and FFT is computed in finish(), since FFT requires the full signal
Outputs n/2 frequency bins (single-sided spectrum for real-valued input)
Supports result parameter (real, imag, abs, angle) consistent with the existing tree model UDTFFFT
Usage
SELECT * FROM TABLE(
table_fft(
TABLE(SELECT time, device_id, value FROM vibration ORDER BY time)
PARTITION BY device_id,
result => 'abs'
)
);
This PR has:
for an unfamiliar reader.
for code coverage.
Key changed/added classes (or packages if there are too many classes) in this PR
library-udf/src/main/java/org/apache/iotdb/library/frequency/TableFFT.java (new)
library-udf/src/test/java/org/apache/iotdb/library/TableFFTTest.java (new)