public class StreamerUtil extends Object
| Constructor and Description |
|---|
StreamerUtil() |
| Modifier and Type | Method and Description |
|---|---|
static TypedProperties |
appendKafkaProps(FlinkStreamerConfig config) |
static void |
checkRequiredProperties(TypedProperties props,
List<String> checkPropNames) |
static HoodieTableMetaClient |
createMetaClient(org.apache.flink.configuration.Configuration conf)
Creates the meta client.
|
static HoodieTableMetaClient |
createMetaClient(String basePath,
org.apache.hadoop.conf.Configuration hadoopConf)
Creates the meta client.
|
static Option<Transformer> |
createTransformer(List<String> classNames) |
static HoodieFlinkWriteClient |
createWriteClient(org.apache.flink.configuration.Configuration conf)
Creates the Flink write client.
|
static HoodieFlinkWriteClient |
createWriteClient(org.apache.flink.configuration.Configuration conf,
org.apache.flink.api.common.functions.RuntimeContext runtimeContext)
Creates the Flink write client.
|
static HoodieFlinkWriteClient |
createWriteClient(org.apache.flink.configuration.Configuration conf,
org.apache.flink.api.common.functions.RuntimeContext runtimeContext,
boolean loadFsViewStorageConfig)
Creates the Flink write client.
|
static boolean |
fileExists(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path) |
static TypedProperties |
flinkConf2TypedProperties(org.apache.flink.configuration.Configuration conf)
Converts the give
Configuration to TypedProperties. |
static String |
generateBucketKey(String partitionPath,
String fileId)
Generates the bucket ID using format {partition path}_{fileID}.
|
static String |
getAuxiliaryPath(org.apache.flink.configuration.Configuration conf)
Returns the auxiliary path.
|
static HoodieWriteConfig |
getHoodieClientConfig(org.apache.flink.configuration.Configuration conf)
Mainly used for tests.
|
static HoodieWriteConfig |
getHoodieClientConfig(org.apache.flink.configuration.Configuration conf,
boolean loadFsViewStorageConfig) |
static HoodieWriteConfig |
getHoodieClientConfig(org.apache.flink.configuration.Configuration conf,
boolean enableEmbeddedTimelineService,
boolean loadFsViewStorageConfig) |
static String |
getLastCompletedInstant(HoodieTableMetaClient metaClient) |
static String |
getLastPendingInstant(HoodieTableMetaClient metaClient) |
static String |
getLastPendingInstant(HoodieTableMetaClient metaClient,
boolean reloadTimeline) |
static org.apache.avro.Schema |
getLatestTableSchema(String path,
org.apache.hadoop.conf.Configuration hadoopConf) |
static long |
getMaxCompactionMemoryInBytes(org.apache.flink.configuration.Configuration conf)
Returns the max compaction memory in bytes with given conf.
|
static HoodiePayloadConfig |
getPayloadConfig(org.apache.flink.configuration.Configuration conf)
Returns the payload config with given configuration.
|
static TypedProperties |
getProps(FlinkStreamerConfig cfg) |
static org.apache.avro.Schema |
getSourceSchema(org.apache.flink.configuration.Configuration conf) |
static org.apache.avro.Schema |
getSourceSchema(FlinkStreamerConfig cfg) |
static org.apache.avro.Schema |
getTableAvroSchema(HoodieTableMetaClient metaClient,
boolean includeMetadataFields) |
static boolean |
haveSuccessfulCommits(HoodieTableMetaClient metaClient)
Returns whether there are successful commits on the timeline.
|
static HoodieTableMetaClient |
initTableIfNotExists(org.apache.flink.configuration.Configuration conf)
Initialize the table if it does not exist.
|
static HoodieTableMetaClient |
initTableIfNotExists(org.apache.flink.configuration.Configuration conf,
org.apache.hadoop.conf.Configuration hadoopConf)
Initialize the table if it does not exist.
|
static long |
instantTimeDiffSeconds(String newInstantTime,
String oldInstantTime)
Returns the time interval in seconds between the given instant time.
|
static boolean |
isValidFile(org.apache.hadoop.fs.FileStatus fileStatus)
Returns whether the give file is in valid hoodie format.
|
static Option<String> |
medianInstantTime(String highVal,
String lowVal)
Returns the median instant time between the given two instant time.
|
static HoodieTableMetaClient |
metaClientForReader(org.apache.flink.configuration.Configuration conf,
org.apache.hadoop.conf.Configuration hadoopConf)
Creates the meta client for reader.
|
static DFSPropertiesConfiguration |
readConfig(org.apache.hadoop.conf.Configuration hadoopConfig,
org.apache.hadoop.fs.Path cfgPath,
List<String> overriddenProps)
Read config from properties file (`--props` option) and cmd line (`--hoodie-conf` option).
|
static boolean |
tableExists(String basePath,
org.apache.hadoop.conf.Configuration hadoopConf)
Returns whether the hoodie table exists under given path
basePath. |
public static TypedProperties appendKafkaProps(FlinkStreamerConfig config)
public static TypedProperties getProps(FlinkStreamerConfig cfg)
public static org.apache.avro.Schema getSourceSchema(FlinkStreamerConfig cfg)
public static org.apache.avro.Schema getSourceSchema(org.apache.flink.configuration.Configuration conf)
public static DFSPropertiesConfiguration readConfig(org.apache.hadoop.conf.Configuration hadoopConfig, org.apache.hadoop.fs.Path cfgPath, List<String> overriddenProps)
public static HoodieWriteConfig getHoodieClientConfig(org.apache.flink.configuration.Configuration conf)
public static HoodieWriteConfig getHoodieClientConfig(org.apache.flink.configuration.Configuration conf, boolean loadFsViewStorageConfig)
public static HoodieWriteConfig getHoodieClientConfig(org.apache.flink.configuration.Configuration conf, boolean enableEmbeddedTimelineService, boolean loadFsViewStorageConfig)
public static HoodiePayloadConfig getPayloadConfig(org.apache.flink.configuration.Configuration conf)
public static TypedProperties flinkConf2TypedProperties(org.apache.flink.configuration.Configuration conf)
Configuration to TypedProperties.
The default values are also set up.conf - The flink configurationpublic static void checkRequiredProperties(TypedProperties props, List<String> checkPropNames)
public static HoodieTableMetaClient initTableIfNotExists(org.apache.flink.configuration.Configuration conf) throws IOException
conf - the configurationIOException - if errors happens when writing metadatapublic static HoodieTableMetaClient initTableIfNotExists(org.apache.flink.configuration.Configuration conf, org.apache.hadoop.conf.Configuration hadoopConf) throws IOException
conf - the configurationIOException - if errors happens when writing metadatapublic static boolean tableExists(String basePath, org.apache.hadoop.conf.Configuration hadoopConf)
basePath.public static String generateBucketKey(String partitionPath, String fileId)
public static HoodieTableMetaClient metaClientForReader(org.apache.flink.configuration.Configuration conf, org.apache.hadoop.conf.Configuration hadoopConf)
The streaming pipeline process is long-running, so empty table path is allowed, the reader would then check and refresh the meta client.
StreamReadMonitoringFunctionpublic static HoodieTableMetaClient createMetaClient(String basePath, org.apache.hadoop.conf.Configuration hadoopConf)
public static HoodieTableMetaClient createMetaClient(org.apache.flink.configuration.Configuration conf)
public static HoodieFlinkWriteClient createWriteClient(org.apache.flink.configuration.Configuration conf, org.apache.flink.api.common.functions.RuntimeContext runtimeContext)
This expects to be used by client, the driver should start an embedded timeline server.
public static HoodieFlinkWriteClient createWriteClient(org.apache.flink.configuration.Configuration conf, org.apache.flink.api.common.functions.RuntimeContext runtimeContext, boolean loadFsViewStorageConfig)
This expects to be used by client, set flag loadFsViewStorageConfig to use
remote filesystem view storage config, or an in-memory filesystem view storage is used.
public static HoodieFlinkWriteClient createWriteClient(org.apache.flink.configuration.Configuration conf) throws IOException
This expects to be used by the driver, the client can then send requests for files view.
The task context supplier is a constant: the write token is always '0-1-0'.
IOExceptionpublic static Option<String> medianInstantTime(String highVal, String lowVal)
public static long instantTimeDiffSeconds(String newInstantTime, String oldInstantTime)
public static Option<Transformer> createTransformer(List<String> classNames) throws IOException
IOExceptionpublic static boolean isValidFile(org.apache.hadoop.fs.FileStatus fileStatus)
public static String getLastPendingInstant(HoodieTableMetaClient metaClient)
public static String getLastPendingInstant(HoodieTableMetaClient metaClient, boolean reloadTimeline)
public static String getLastCompletedInstant(HoodieTableMetaClient metaClient)
public static boolean haveSuccessfulCommits(HoodieTableMetaClient metaClient)
metaClient - The meta clientpublic static long getMaxCompactionMemoryInBytes(org.apache.flink.configuration.Configuration conf)
public static org.apache.avro.Schema getTableAvroSchema(HoodieTableMetaClient metaClient, boolean includeMetadataFields) throws Exception
Exceptionpublic static org.apache.avro.Schema getLatestTableSchema(String path, org.apache.hadoop.conf.Configuration hadoopConf)
public static boolean fileExists(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
public static String getAuxiliaryPath(org.apache.flink.configuration.Configuration conf)
Copyright © 2022 The Apache Software Foundation. All rights reserved.