Skip to content

feat(library-udf): add TableFFT function for table model#17942

Open
dahyvuun wants to merge 1 commit into
apache:masterfrom
dahyvuun:feature/table-fft
Open

feat(library-udf): add TableFFT function for table model#17942
dahyvuun wants to merge 1 commit into
apache:masterfrom
dahyvuun:feature/table-fft

Conversation

@dahyvuun

Copy link
Copy Markdown

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:

  • been self-reviewed.
    • concurrent read
    • concurrent write
    • concurrent read and write
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods.
  • added or updated version, license, or notice information
  • added comments explaining the "why" and the intent of the code wherever would not be obvious
    for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold
    for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

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)

- 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
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