aljoscha commented on a change in pull request #12606:
URL: https://github.com/apache/flink/pull/12606#discussion_r440076840
##########
File path: docs/dev/table/types.md
##########
@@ -1125,9 +1131,110 @@ equivalent to `ROW<myField INT, myOtherField BOOLEAN>`.
**Bridging to JVM Types**
-| Java Type | Input | Output | Remarks |
-|:----------------------------|:-----:|:------:|:------------------------|
-|`org.apache.flink.types.Row` | X | X | *Default* |
+| Java Type | Input | Output | Remarks
|
+|:-------------------------------------|:-----:|:------:|:-------------------------|
+|`org.apache.flink.types.Row` | X | X | *Default*
|
+|`org.apache.flink.table.data.RowData` | X | X | Internal data
structure. |
+
+### User-Defined Data Types
+
+<span class="label label-danger">Attention</span> User-defined data types are
not fully supported yet. They are
+currently (as of Flink 1.11) only exposed as unregistered structured types in
parameters and return types of functions.
+
+A structured type is similar to an object in an object-oriented programming
language. It contains
+zero, one or more attributes. Each attribute consists of a name and a type.
+
+There are two kinds of structured types:
+
+- Types that are stored in a catalog and are identified by a _catalog
identifer_ (like `cat.db.MyType`). Those
+are equal to the SQL standard definition of structured types.
+
+- Anonymously defined, unregistered types (usually reflectively extracted)
that are identified by
+an _implementation class_ (like `com.myorg.model.MyType`). Those are useful
when programmatically
+defining a table program. They enable reusing existing JVM classes without
manually defining the
+schema of a data type again.
+
+#### Registered Structured Types
+
+Currently, registered structured types are not supported. Thus, they cannot be
stored in a catalog
+or referenced in a `CREATE TABLE` DDL.
+
+#### Unregistered Structured Types
+
+Unregistered structured types can be created from regular POJOs (Plain Old
Java Objects) using automatic reflective extraction.
+
+The implementation class of a structured type must meet the following
requirements:
+- The class must be globally accessible which means it must be declared
`public`, `static`, and not `abstract`.
+- The class must offer a default constructor with zero arguments or a full
constructor that assigns all
+fields.
+- All fields of the class must be readable by either `public` declaration or a
getter that follows common
+coding style such as `getField()`, `isField()`, `field()`.
+- All fields of the class must be writable by either `public` declaration,
fully assigning constructor,
+or a setter that follows common coding style such as `setField(...)`,
`field(...)`.
+- All fields must be mapped to a data type either implicitly via reflective
extraction or explicitly
+using the `@DataTypeHint` [annotations](#data-type-annotations).
+- Fields that are declared `static` or `transient` are ignored.
+
+The reflective extraction supports arbitrary nesting of fields as long as a
field type does not
+(transitively) uses itself.
Review comment:
```suggestion
(transitively) refer to itself.
```
##########
File path: docs/dev/table/types.md
##########
@@ -1160,6 +1267,48 @@ DataTypes.BOOLEAN()
|`java.lang.Boolean` | X | X | *Default* |
|`boolean` | X | (X) | Output only if type is not nullable. |
+#### `RAW`
+
+Data type of an arbitrary serialized type. This type is a black box within the
table ecosystem
+and is only deserialized at the edges.
+
+The raw type is an extension to the SQL standard.
+
+**Declaration**
+
+<div class="codetabs" markdown="1">
+
+<div data-lang="SQL" markdown="1">
+{% highlight text %}
+RAW('class', 'snapshot')
+{% endhighlight %}
+</div>
+
+<div data-lang="Java/Scala" markdown="1">
+{% highlight java %}
+DataTypes.RAW(class, serializer)
+
+DataTypes.RAW(class)
+{% endhighlight %}
+</div>
+
+</div>
+
+The type can be declared using `RAW('class', 'snapshot')` where `class` is the
originating class and
+`snapshot` is the serialized `TypeSerializerSnapshot` in Base64 encoding.
Usually, the type string is not
+declared directly but is generated while persisting the type.
+
+In the API, the `RAW` type can be declared either by directly supplying a
`Class` + `TypeSerializer` or
+by passing `Class` and let the framework extract `Class` + `TypeSerializer`
from there.
Review comment:
```suggestion
by passing `Class` and letting the framework extract `Class` +
`TypeSerializer` from there.
```
##########
File path:
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/data/conversion/DataStructureConverters.java
##########
@@ -149,6 +147,10 @@
switch (logicalType.getTypeRoot()) {
case ARRAY:
return
ArrayObjectArrayConverter.create(dataType);
+ case MULTISET:
Review comment:
Why were these moved?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]