0
# Apache Flink Table Runtime
1
2
Apache Flink Table Runtime provides the essential execution infrastructure for Flink's Table API and SQL operations. This library contains classes required by task managers to execute table programs, serving as the foundational runtime layer that bridges high-level SQL and Table API constructs with Flink's distributed streaming execution engine.
3
4
## Package Information
5
6
- **Package Name**: flink-table-runtime
7
- **Package Type**: maven
8
- **Group ID**: org.apache.flink
9
- **Language**: Java
10
- **Installation**: Include as dependency in Maven/Gradle project
11
12
```xml
13
<dependency>
14
<groupId>org.apache.flink</groupId>
15
<artifactId>flink-table-runtime</artifactId>
16
<version>2.1.0</version>
17
</dependency>
18
```
19
20
## Core Imports
21
22
Most functionality is internal to Flink's runtime, but the public APIs are:
23
24
```java
25
import org.apache.flink.formats.raw.RawFormatOptions;
26
import org.apache.flink.table.runtime.typeutils.SortedMapTypeInfo;
27
```
28
29
## Basic Usage
30
31
This library is primarily intended for internal use by Flink's table runtime system. External usage is limited but includes:
32
33
```java
34
import org.apache.flink.formats.raw.RawFormatOptions;
35
import org.apache.flink.table.runtime.typeutils.SortedMapTypeInfo;
36
import org.apache.flink.api.common.typeinfo.TypeInformation;
37
import java.util.Comparator;
38
import java.util.SortedMap;
39
40
// Using raw format options for configuration
41
String endianness = RawFormatOptions.BIG_ENDIAN;
42
ConfigOption<String> charsetOption = RawFormatOptions.CHARSET;
43
44
// Creating type information for sorted maps
45
SortedMapTypeInfo<String, Integer> mapTypeInfo = new SortedMapTypeInfo<>(
46
TypeInformation.of(String.class),
47
TypeInformation.of(Integer.class),
48
String.CASE_INSENSITIVE_ORDER
49
);
50
```
51
52
## Architecture
53
54
The module is organized into these main functional areas:
55
56
- **Data Layer** - Internal data structures, binary formats, and converters for efficient data processing
57
- **Functions Layer** - Runtime function implementations for SQL operations and expressions
58
- **Operators Layer** - Stream processing operators for table operations and transformations
59
- **Formats Layer** - Data format support, currently including raw byte format processing
60
- **Utilities Layer** - Runtime utilities, type system components, and serialization support
61
62
This design enables efficient processing of both bounded and unbounded tabular datasets in distributed environments, providing the runtime foundation for Flink's unified batch and stream processing capabilities.
63
64
## Capabilities
65
66
### Raw Format Configuration
67
68
Configuration options for raw byte-based data format processing with configurable endianness and character encoding.
69
70
```java { .api }
71
public class RawFormatOptions {
72
public static final String BIG_ENDIAN = "big-endian";
73
public static final String LITTLE_ENDIAN = "little-endian";
74
public static final ConfigOption<String> ENDIANNESS;
75
public static final ConfigOption<String> CHARSET;
76
}
77
78
```
79
80
### Type System Support
81
82
Type information and utilities for sorted maps and custom type serialization.
83
84
```java { .api }
85
public class SortedMapTypeInfo<K, V> extends AbstractMapTypeInfo<K, V, SortedMap<K, V>> {
86
public SortedMapTypeInfo(
87
TypeInformation<K> keyTypeInfo,
88
TypeInformation<V> valueTypeInfo,
89
Comparator<K> keyComparator
90
);
91
92
public SortedMapTypeInfo(
93
Class<K> keyClass,
94
Class<V> valueClass,
95
Comparator<K> keyComparator
96
);
97
98
public SortedMapTypeInfo(Class<K> keyClass, Class<V> valueClass);
99
100
public Class<SortedMap<K, V>> getTypeClass();
101
public TypeSerializer<SortedMap<K, V>> createSerializer(SerializerConfig config);
102
public boolean canEqual(Object obj);
103
}
104
```
105
106
107
## Types
108
109
```java { .api }
110
// Core configuration types
111
public class ConfigOption<T> {
112
// Configuration option for various format settings
113
}
114
115
// Flink type system
116
public interface TypeInformation<T> {
117
// Type information for Flink's serialization system
118
}
119
120
// Comparator interface
121
public interface Comparator<T> {
122
// Standard Java comparator interface
123
}
124
125
// Map interface
126
public interface SortedMap<K, V> extends Map<K, V> {
127
// Standard Java sorted map interface
128
}
129
```
130
131
## Important Notes
132
133
**Limited Public API**: This library has minimal public API surface with only 2 classes marked `@PublicEvolving` (RawFormatOptions and SortedMapTypeInfo). Most functionality is marked `@Internal` and intended for use within Flink's runtime system.
134
135
**Runtime Focus**: The primary purpose is to provide execution infrastructure for Flink's Table API and SQL operations. Direct external usage is limited and primarily involves configuration and type system integration.
136
137
**Internal Implementation**: Most classes in this module serve as internal runtime infrastructure. The public APIs documented here represent the only external interfaces intended for use outside of Flink's core runtime system.
138
139
**Dependencies**: Requires core Flink table modules for proper integration with Flink's table processing ecosystem.