[FLINK-39604][table] Show state and PTF capabilities in DESCRIBE FUNCTION EXTENDED#28114
Draft
nateab wants to merge 1 commit intoapache:masterfrom
Draft
[FLINK-39604][table] Show state and PTF capabilities in DESCRIBE FUNCTION EXTENDED#28114nateab wants to merge 1 commit intoapache:masterfrom
nateab wants to merge 1 commit intoapache:masterfrom
Conversation
Collaborator
f69104b to
d4cdae5
Compare
d4cdae5 to
305d449
Compare
…TION EXTENDED Append rows to DESCRIBE FUNCTION EXTENDED that surface metadata already accessible at definition time but not previously rendered: - state entries (with type and TTL) — for PTFs and user-defined aggregate functions whose accumulator declares a StateTypeStrategy. - PTF capability flags — when kind == PROCESS_TABLE, three additional rows: accepts system arguments (whether the framework auto-injects uid / on_time), emits updates (ChangelogFunction implementation), uses timers (presence of an onTimer method). Per-argument trait info was considered but rejected because it is already encoded in the signature row. Output schema is unchanged: still (info name, info value); rows are appended only when applicable.
305d449 to
929b477
Compare
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.
What is the purpose of the change
Extend
DESCRIBE FUNCTION EXTENDEDto surface function metadata that previously had no introspection path from SQL: state entries (with type and TTL) and three PTF capability flags.JIRA: FLINK-39604
DESCRIBE FUNCTIONshipped under FLINK-35822 before the PTF infrastructure (FLIP-440 / FLINK-36705) and has not been touched since. TheEXTENDEDform already callsFunctionDefinition#getTypeInference(...)to render thesignaturerow, but it ignoresgetStateTypeStrategies(),disableSystemArguments(), theChangelogFunctioninterface, and the presence of anonTimermethod — all class-level facts the user can't otherwise see.Per-argument trait info was considered but rejected because it is already encoded in the
signaturerow (e.g.f(input => {TABLE, SET SEMANTIC TABLE, OPTIONAL PARTITION BY})).Brief change log
DescribeFunctionOperation: new privatebuildPtfMetadataRows(FunctionDefinition, TypeInference)helper appends:state: <name>rows (type + TTL, best-effort viainferType(null)/getTimeToLive(null)) — applies to PTFs and aggregate functions (the accumulator surfaces asstate: acc).kind == PROCESS_TABLE:accepts system arguments—!disableSystemArguments()(whetheruid/on_timeare auto-injected).is changelog function—definition instanceof ChangelogFunction(whether the PTF implements the interface that lets it emit+U/-U/-D).uses timers— reusesExtractionUtils.collectMethods(cls, UserDefinedFunctionHelper.PROCESS_TABLE_ON_TIMER), the same lookup the planner uses.DescribeFunctionTestPtf,DescribeFunctionTestMinimalPtf,DescribeFunctionTestAgg(new): three small test fixtures inflink-sql-client/src/test/java/.../cli/utils/, reachable on the test classpath via FQN. Together they cover bothtrueandfalsefor each of the three capability flags, plus state entries on both a PTF and an aggregate.function.qgolden: three new blocks registermy_ptf,my_minimal_ptf, andmy_aggand assert theirDESCRIBE FUNCTION EXTENDEDoutput. Existingtemp_upperudf/SUMblocks unchanged.Output schema
Unchanged: still
(info name, info value). Additional rows appended only when applicable. No new SQL syntax.Example (PTF, all capabilities present)
Example (Minimal PTF, no capabilities)
Example (Aggregate)
For non-PTF / non-stateful functions (most scalar UDFs, SUM, etc.) the output is unchanged from today.
Verifying this change
flink-table-api-java:./mvnw test -pl flink-table/flink-table-api-java— all tests pass.flink-sql-client:./mvnw test -pl flink-table/flink-sql-client -Dtest=CliClientITCase— all 14 tests pass with the three new function blocks infunction.q.Does this pull request potentially affect one of the following parts?
@Public(Evolving): no (the helper is private and the class is@Internal)Documentation
DESCRIBE FUNCTION EXTENDED)Out of scope (deliberately)
signaturerow, which already encodes name, type, and traits viaf(arg => TYPE {TRAITS}).DESCRIBE FUNCTION ... SHOW STATE) — would require a FLIP.(info name, info value).ChangelogFunction#getChangelogMode(ChangelogContext)andChangelogModeStrategy#inferChangelogMode(...)both require call-time context, so only the staticinstanceofboolean is exposed here. The labelis changelog function(rather thanemits updates) reflects that this is a class-level check, not a runtime fact.