@InterfaceAudience.Public @InterfaceStability.Evolving public class RegexpKuduOperationsProducer extends Object implements KuduOperationsProducer
Insert or Upsert operations per Flume Event by
parsing the event body using a regular expression. Values are
coerced to the types of the named columns in the Kudu table.
Example: If the Kudu table has the schema:
key INT32 name STRING
and producer.pattern = (?<key>\\d+),(?<name>\\w+) then
RegexpKuduOperationsProducer will parse the string:
|12345,Mike||54321,Todd|into the rows:
(key=12345, name=Mike) and (key=54321, name=Todd).
Note: This class relies on JDK7 named capturing groups, which are
documented in Pattern. The name of each capturing group must
correspond to a column name in the destination Kudu table.
RegexpKuduOperationsProducer Flume Configuration Parameters
| Property Name | Default | Required? | Description |
|---|---|---|---|
| producer.pattern | Yes | The regular expression used to parse the event body. | |
| producer.charset | utf-8 | No | The character set of the event body. |
| producer.operation | upsert | No | Operation type used to write the event to Kudu. Must be either
insert or upsert. |
| producer.skipMissingColumn | false | No |
@deprecated use producer.missingColumnPolicy
What to do if a column in the Kudu table has no corresponding capture group.
If set to true, a warning message is logged and the operation is still attempted.
If set to false, an exception is thrown and the sink will not process the
Event, causing a Flume Channel rollback.
|
| producer.skipBadColumnValue | false | No |
@deprecated use producer.badColumnValuePolicy
What to do if a value in the pattern match cannot be coerced to the required type.
If set to true, a warning message is logged and the operation is still attempted.
If set to false, an exception is thrown and the sink will not process the
Event, causing a Flume Channel rollback.
|
| producer.warnUnmatchedRows | true | No |
@deprecated use producer.unmatchedRowPolicy
Whether to log a warning about payloads that do not match the pattern. If set to
false, event bodies with no matches will be silently dropped. |
| producer.missingColumnPolicy | REJECT | No | What to do if a column in the Kudu table has no corresponding capture group. If set to REJECT, an exception is thrown and the sink will not process the
Event, causing a Flume Channel rollback.If set to WARN, a warning message is logged and the operation is still produced.If set to IGNORE, the operation is still produced without any log message.
|
| producer.badColumnValuePolicy | REJECT | No | What to do if a value in the pattern match cannot be coerced to the required type. If set to REJECT, an exception is thrown and the sink will not process the
Event, causing a Flume Channel rollback.If set to WARN, a warning message is logged and the operation is still produced,
but does not include the given column.If set to IGNORE, the operation is still produced, but does not include the given
column and does not log any message.
|
| producer.unmatchedRowPolicy | WARN | No | What to do if a payload does not match the pattern. If set to REJECT, an exception is thrown and the sink will not process the
Event, causing a Flume Channel rollback.If set to WARN, a warning message is logged and the row is skipped,
not producing an operation.If set to IGNORE, the row is skipped without any log message.
|
Pattern| Modifier and Type | Field and Description |
|---|---|
static String |
BAD_COLUMN_VALUE_POLICY_PROP |
static org.apache.kudu.flume.sink.RegexpKuduOperationsProducer.ParseErrorPolicy |
DEFAULT_BAD_COLUMN_VALUE_POLICY |
static String |
DEFAULT_ENCODING |
static org.apache.kudu.flume.sink.RegexpKuduOperationsProducer.ParseErrorPolicy |
DEFAULT_MISSING_COLUMN_POLICY |
static String |
DEFAULT_OPERATION |
static boolean |
DEFAULT_SKIP_BAD_COLUMN_VALUE
Deprecated.
|
static boolean |
DEFAULT_SKIP_MISSING_COLUMN
Deprecated.
|
static org.apache.kudu.flume.sink.RegexpKuduOperationsProducer.ParseErrorPolicy |
DEFAULT_UNMATCHED_ROW_POLICY |
static boolean |
DEFAULT_WARN_UNMATCHED_ROWS
Deprecated.
|
static String |
ENCODING_PROP |
static String |
MISSING_COLUMN_POLICY_PROP |
static String |
OPERATION_PROP |
static String |
PATTERN_PROP |
static String |
SKIP_BAD_COLUMN_VALUE_PROP
Deprecated.
|
static String |
SKIP_MISSING_COLUMN_PROP
Deprecated.
|
static String |
UNMATCHED_ROW_POLICY_PROP |
static String |
WARN_UNMATCHED_ROWS_PROP
Deprecated.
|
| Constructor and Description |
|---|
RegexpKuduOperationsProducer() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Cleans up any state.
|
void |
configure(org.apache.flume.Context context) |
List<Operation> |
getOperations(org.apache.flume.Event event)
Returns the operations that should be written to Kudu as a result of this event.
|
void |
initialize(KuduTable table)
Initializes the operations producer.
|
public static final String PATTERN_PROP
public static final String ENCODING_PROP
public static final String DEFAULT_ENCODING
public static final String OPERATION_PROP
public static final String DEFAULT_OPERATION
@Deprecated public static final String SKIP_MISSING_COLUMN_PROP
@Deprecated public static final boolean DEFAULT_SKIP_MISSING_COLUMN
@Deprecated public static final String SKIP_BAD_COLUMN_VALUE_PROP
@Deprecated public static final boolean DEFAULT_SKIP_BAD_COLUMN_VALUE
@Deprecated public static final String WARN_UNMATCHED_ROWS_PROP
@Deprecated public static final boolean DEFAULT_WARN_UNMATCHED_ROWS
public static final String MISSING_COLUMN_POLICY_PROP
public static final org.apache.kudu.flume.sink.RegexpKuduOperationsProducer.ParseErrorPolicy DEFAULT_MISSING_COLUMN_POLICY
public static final String BAD_COLUMN_VALUE_POLICY_PROP
public static final org.apache.kudu.flume.sink.RegexpKuduOperationsProducer.ParseErrorPolicy DEFAULT_BAD_COLUMN_VALUE_POLICY
public static final String UNMATCHED_ROW_POLICY_PROP
public static final org.apache.kudu.flume.sink.RegexpKuduOperationsProducer.ParseErrorPolicy DEFAULT_UNMATCHED_ROW_POLICY
public void configure(org.apache.flume.Context context)
configure in interface org.apache.flume.conf.Configurablepublic void initialize(KuduTable table)
KuduOperationsProducerinitialize in interface KuduOperationsProducertable - the KuduTable used to create Kudu Operation objectspublic List<Operation> getOperations(org.apache.flume.Event event) throws org.apache.flume.FlumeException
KuduOperationsProducergetOperations in interface KuduOperationsProducerevent - Event to convert to one or more Operationsorg.apache.flume.FlumeExceptionpublic void close()
KuduOperationsProducerclose in interface AutoCloseableclose in interface KuduOperationsProducerCopyright © 2018 The Apache Software Foundation. All rights reserved.