nateab opened a new pull request, #28114:
URL: https://github.com/apache/flink/pull/28114

   ## What is the purpose of the change
   
   Extend `DESCRIBE FUNCTION EXTENDED` to surface Process Table Function (PTF) 
metadata that previously had no introspection path from SQL: per-argument 
traits and state entries.
   
   JIRA: [FLINK-39604](https://issues.apache.org/jira/browse/FLINK-39604)
   
   `DESCRIBE FUNCTION` shipped under FLINK-35822 before the PTF infrastructure 
(FLIP-440 / FLINK-36705) and has not been touched since. The `EXTENDED` form 
already calls `FunctionDefinition#getTypeInference(...)` to render the 
`signature` row, but it ignores `getStaticArguments()` and 
`getStateTypeStrategies()` — which is where everything that distinguishes a PTF 
lives.
   
   ## Brief change log
   
   - `DescribeFunctionOperation`: new `buildPtfMetadataRows(TypeInference)` 
helper appends `argument: <name>` rows (type, traits, optional flag) and 
`state: <name>` rows (TTL). Wired into `execute()` inside the `EXTENDED` 
branch, reusing the same `TypeInference` already computed for the `signature` 
row.
   - `DescribeFunctionOperationTest` (new): unit tests for static args, state 
with TTL, and state without TTL.
   - `function.q` golden: updated three `temp_upperudf` blocks where the 
existing UDF — which uses static arguments — now also emits an `argument: arg0` 
row.
   
   ## Output schema
   
   Unchanged: still `(info name, info value)`. Additional rows are appended 
only when the underlying `TypeInference` carries that metadata. No new SQL 
syntax.
   
   ### Example (PTF)
   
   ```
   
+---------------------------+-------------------------------------------------------+
   |                 info name |                                            
info value |
   
+---------------------------+-------------------------------------------------------+
   | ...                       | ...                                            
       |
   |                 signature |                              my_ptf(input => 
<ROW...>) |
   |           argument: input | type=ROW (untyped), 
traits=[SET_SEMANTIC_TABLE, TABLE]|
   |            state: counter |                                          
ttl=PT24H    |
   
+---------------------------+-------------------------------------------------------+
   ```
   
   ## Verifying this change
   
   - `flink-table-api-java`: `./mvnw test -pl flink-table/flink-table-api-java` 
— all 445 tests pass, including 3 new ones in `DescribeFunctionOperationTest`.
   - `flink-sql-client`: `./mvnw test -pl flink-table/flink-sql-client 
-Dtest=CliClientITCase` — all 14 tests pass with updated `function.q` golden.
   
   ## Does this pull request potentially affect one of the following parts?
   
   - Dependencies (does it add or upgrade a dependency): **no**
   - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: **no** (the new helper is `@Internal`)
   - The serializers: **no**
   - The runtime per-record code paths (performance sensitive): **no**
   - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: **no**
   - The S3 file system connector: **no**
   
   ## Documentation
   
   - Does this pull request introduce a new feature? **no** (extension of 
existing `DESCRIBE FUNCTION EXTENDED`)
   - If yes, how is the feature documented? **N/A**
   
   ## Out of scope (deliberately)
   
   - New SQL syntax (e.g. `DESCRIBE FUNCTION ... SHOW STATE`) — would require a 
FLIP.
   - Adding columns to the result schema — output remains `(info name, info 
value)`.
   - Conditional traits resolution — only base traits via `getTraits()` are 
shown, since resolving conditional traits requires a `CallContext`.
   - State entry data type — `inferType()` also requires a `CallContext`. Could 
be added in a follow-up that synthesizes a minimal context.


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