DaZuiZui opened a new pull request, #18006:
URL: https://github.com/apache/iotdb/pull/18006

   ## Description
   
   ### FFT table-valued function
   
   This PR implements the v1 built-in `FFT` / `fft` table-valued function for 
the table model.
   
   The function accepts a required `DATA` table argument with set semantics and 
`ORDER BY time`, plus optional `SAMPLE_INTERVAL`, `N`, and `NORM` arguments. It 
transforms all numeric input columns except `time` and partition columns, emits 
the full complex spectrum, and returns `frequency_index`, `frequency`, and 
`<column>_real` / `<column>_imag` columns. When partition columns exist, they 
are kept at the front of the output schema.
   
   The FFT implementation uses JTransforms `DoubleFFT_1D`. `N` supports default 
partition length, truncation, and zero padding. `NORM` supports `backward`, 
`forward`, and `ortho`. `SAMPLE_INTERVAL` can 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 `M4` where needed so the output column 
order matches the table-function contract.
   
   Validation covers:
   
   - `DATA` must have `ORDER BY time` in ascending order.
   - `SAMPLE_INTERVAL`, if provided, must be positive.
   - `N`, if provided, must be positive.
   - `NORM` must be one of `backward`, `forward`, or `ortho`.
   - At least one numeric transform column is required.
   - Runtime data must be strictly increasing by time and numeric transform 
values must not be null.
   - If `SAMPLE_INTERVAL` is 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:
   
   ```bash
   JAVA_HOME=$(/usr/libexec/java_home -v 21) ./mvnw test -pl 
iotdb-core/node-commons -am -Dtest=FFTTableFunctionTest -DfailIfNoTests=false 
-Dsurefire.failIfNoSpecifiedTests=false
   JAVA_HOME=$(/usr/libexec/java_home -v 21) ./mvnw test -pl 
iotdb-core/datanode -am -Dtest=TableFunctionTest -DfailIfNoTests=false 
-Dsurefire.failIfNoSpecifiedTests=false
   JAVA_HOME=$(/usr/libexec/java_home -v 21) ./mvnw verify -DskipUTs 
-Dit.test=IoTDBFFTTableFunctionIT -DfailIfNoTests=false 
-Dfailsafe.failIfNoSpecifiedTests=false -pl integration-test -am 
-PTableSimpleIT -P with-integration-tests
   ```
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
   - [x] added Javadocs for most classes and all non-trivial methods.
   - [x] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [x] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for code coverage.
   - [x] added integration tests.
   - [x] been tested in a test IoTDB cluster.
   
   <hr>
   
   ##### Key changed/added classes (or packages if there are too many classes) 
in this PR
   
   - `org.apache.iotdb.commons.udf.builtin.relational.tvf.FFTTableFunction`
   - 
`org.apache.iotdb.commons.queryengine.plan.relational.function.TableBuiltinTableFunction`
   - 
`org.apache.iotdb.db.queryengine.plan.relational.analyzer.StatementAnalyzer`
   - `org.apache.iotdb.db.queryengine.plan.relational.planner.RelationPlanner`
   - `org.apache.iotdb.commons.udf.builtin.relational.tvf.FFTTableFunctionTest`
   - 
`org.apache.iotdb.db.queryengine.plan.relational.analyzer.TableFunctionTest`
   - `org.apache.iotdb.relational.it.db.it.IoTDBFFTTableFunctionIT`
   
   Related to #17939.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to