Natea Eshetu Beshada created FLINK-39604:
--------------------------------------------
Summary: Extend DESCRIBE FUNCTION EXTENDED to support PTF fields
Key: FLINK-39604
URL: https://issues.apache.org/jira/browse/FLINK-39604
Project: Flink
Issue Type: Improvement
Components: Table SQL / API
Affects Versions: 2.2.0
Reporter: Natea Eshetu Beshada
Assignee: Natea Eshetu Beshada
DESCRIBE FUNCTION EXTENDED was introduced in FLINK-35822 before Process Table
Functions (PTFs) landed under FLIP-440 (FLINK-36705 and follow-ups). As a
result, none of the metadata that makes a PTF distinctive is shown today.
Currently, DescribeFunctionOperation#execute emits, under the EXTENDED branch,
only:
- kind
- requirements
- is deterministic
- supports constant folding
- signature
It calls FunctionDefinition#getTypeInference(...) solely to render the
signature, ignoring the PTF-specific data already available on the same
TypeInference instance:
- TypeInference#getStaticArguments() — per-argument traits such as
ROW_SEMANTIC_TABLE / SET_SEMANTIC_TABLE, OPTIONAL_PARTITION_BY,
PASS_COLUMNS_THROUGH, SUPPORT_UPDATES, REQUIRE_UPDATE_BEFORE,
REQUIRE_FULL_DELETE, REQUIRE_ON_TIME.
- TypeInference#getStateTypeStrategies() — named state entries with their
declared types and TTL (from @StateHint(ttl = ...)).
This makes it hard for users to introspect PTFs from SQL — e.g. to confirm a
function carries state, what its TTL is, or whether an argument requires ON
TIME.
Proposed Changes
When DESCRIBE FUNCTION EXTENDED targets a function whose TypeInference exposes
static arguments and/or state entries, append additional rows to the existing
(info name, info value) result, e.g.:
{{
+-----------------------------+-----------------------------------------------+}}
{{ | info name | info value
|}}
{{
+-----------------------------+-----------------------------------------------+}}
{{ | kind | PROCESS_TABLE
|}}
{{ | requirements | []
|}}
{{ | is deterministic | true
|}}
{{ | supports constant folding | false
|}}
{{ | signature | f(input => <ROW...>, on_time =>
<TIMESTAMP>) |}}
{{ | argument: input | type=ROW<...>, traits=[SET_SEMANTIC_TABLE,
|}}
{{ | | OPTIONAL_PARTITION_BY, SUPPORT_UPDATES]
|}}
{{ | argument: on_time | type=TIMESTAMP_LTZ(3),
traits=[REQUIRE_ON_TIME]|}}
{{ | state: counter | type=BIGINT, ttl=1 d
|}}
{{
+-----------------------------+-----------------------------------------------+}}
The two-column output schema is unchanged; only new rows are added, and only
when the underlying TypeInference carries that metadata. No new SQL syntax.
Out of Scope
- New columns or a new SQL keyword (e.g. DESCRIBE FUNCTION ... STATE). Can be
considered separately if needed; would require a FLIP.
- Changes to non-EXTENDED DESCRIBE FUNCTION output.
Acceptance Criteria
- New rows produced for PTFs and any other functions whose TypeInference
exposes static arguments / state.
- No change in output for scalar/aggregate/table functions that don't expose
this metadata.
- Tests in DescribeFunctionOperationTest (or equivalent) cover a PTF with
state + traited arguments.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)