-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[FLINK-37913][table] Add built-in OBJECT_OF function #26704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...on/src/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfTypeStrategy.java
Outdated
Show resolved
Hide resolved
I think there's a checkstyle violation making the CI fail. Make sure to run |
...lanner/src/test/java/org/apache/flink/table/planner/functions/StructuredFunctionsITCase.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfInputTypeStrategy.java
Outdated
Show resolved
Hide resolved
...-runtime/src/main/java/org/apache/flink/table/runtime/functions/scalar/ObjectOfFunction.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfInputTypeStrategy.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfInputTypeStrategy.java
Outdated
Show resolved
Hide resolved
...lanner/src/test/java/org/apache/flink/table/planner/functions/StructuredFunctionsITCase.java
Show resolved
Hide resolved
...-runtime/src/main/java/org/apache/flink/table/runtime/functions/scalar/ObjectOfFunction.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfInputTypeStrategy.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfInputTypeStrategy.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfInputTypeStrategy.java
Outdated
Show resolved
Hide resolved
...on/src/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfTypeStrategy.java
Show resolved
Hide resolved
...-runtime/src/main/java/org/apache/flink/table/runtime/functions/scalar/ObjectOfFunction.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfInputTypeStrategy.java
Outdated
Show resolved
Hide resolved
...on/src/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfTypeStrategy.java
Outdated
Show resolved
Hide resolved
...on/src/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfTypeStrategy.java
Show resolved
Hide resolved
8f915c5
to
bd655e0
Compare
@twalthr There is also another case that I have prepared, but so far, it has been stashed on my branch. In the FLIP-520, you mentioned under the table API, this signature:
In SQL, this would be equivalent to: SELECT OBJECT_OF(OBJECT_OF(...))); Is this a case we should also support in SQL? Does this mean that we can construct structure types from structured types? |
...on/src/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfTypeStrategy.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfInputTypeStrategy.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfInputTypeStrategy.java
Show resolved
Hide resolved
...on/src/main/java/org/apache/flink/table/types/inference/strategies/ObjectOfTypeStrategy.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing all comments. LGTM.
…edType.resolveClass
What is the purpose of the change
This pull request implements the
OBJECT_OF
function as specified in FLIP-520 to enable creation of structured types in SQL and Table API. The function allows users to construct structured objects from key-value pairs without requiring UDFs, making structured type creation SQL-serializable and improving the overall usability of structured types in Flink.Brief change log
OBJECT_OF
function definition toBuiltInFunctionDefinitions
ObjectOfInputTypeStrategy
for input validation (odd argument count, string keys, unique field names)ObjectOfTypeStrategy
for output type inference (creates structured types)ObjectOfFunction
runtime implementation that createsRowData
from key-value pairsExpressions.java
withobjectOf()
methods for Table API supportobject_of()
function inexpressions.py
OBJECT_OF
function detailsVerifying this change
This change added tests and can be verified as follows:
ObjectOfInputTypeStrategy
to validate argument count, type validation, and field name uniquenessStructuredFunctionsITCase
to test end-to-end functionalitySELECT OBJECT_OF('com.example.User', 'name', 'Bob', 'age', 42)
objectOf(User.class, "name", "Bob", "age", 42)
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: yes (additions toExpressions.java
andBuiltInFunctionDefinitions
)Documentation