@Tags(value={"hive","metadata","jdbc","database","table"}) @CapabilityDescription(value="This processor uses a Hive JDBC connection and incoming records to generate any Hive 1.2 table changes needed to support the incoming records.") @ReadsAttributes(value=@ReadsAttribute(attribute="hive.table.management.strategy",description="This attribute is read if the \'Table Management Strategy\' property is configured to use the value of this attribute. The value of this attribute should correspond (ignoring case) to a valid option of the \'Table Management Strategy\' property.")) @WritesAttribute(attribute="output.table",description="This attribute is written on the flow files routed to the \'success\' and \'failure\' relationships, and contains the target table name.") @WritesAttribute(attribute="output.path",description="This attribute is written on the flow files routed to the \'success\' and \'failure\' relationships, and contains the path on the file system to the table (or partition location if the table is partitioned).") @WritesAttribute(attribute="mime.type",description="Sets the mime.type attribute to the MIME Type specified by the Record Writer, only if a Record Writer is specified and Update Field Names is \'true\'.") @WritesAttribute(attribute="record.count",description="Sets the number of records in the FlowFile, only if a Record Writer is specified and Update Field Names is \'true\'.") @InputRequirement(value=INPUT_REQUIRED) @RequiresInstanceClassLoading @DeprecationNotice(classNames="org.apache.nifi.processors.hive.UpdateHive3Table") public class UpdateHiveTable extends AbstractProcessor
| Modifier and Type | Class and Description |
|---|---|
private static class |
UpdateHiveTable.OutputMetadataHolder |
| Constructor and Description |
|---|
UpdateHiveTable() |
| Modifier and Type | Method and Description |
|---|---|
private UpdateHiveTable.OutputMetadataHolder |
checkAndUpdateTableSchema(Map<String,String> attributes,
Connection conn,
RecordSchema schema,
String tableName,
List<String> partitionClause,
boolean createIfNotExists,
String externalTableLocation,
String storageFormat,
boolean updateFieldNames) |
protected Collection<ValidationResult> |
customValidate(ValidationContext validationContext) |
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
private WriteResult |
updateRecords(RecordSchema inputRecordSchema,
UpdateHiveTable.OutputMetadataHolder outputMetadataHolder,
RecordReader reader,
RecordSetWriter writer) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validatestatic final String TEXTFILE
static final String SEQUENCEFILE
static final String ORC
static final String PARQUET
static final String AVRO
static final String RCFILE
static final AllowableValue TEXTFILE_STORAGE
static final AllowableValue SEQUENCEFILE_STORAGE
static final AllowableValue ORC_STORAGE
static final AllowableValue PARQUET_STORAGE
static final AllowableValue AVRO_STORAGE
static final AllowableValue RCFILE_STORAGE
static final AllowableValue CREATE_IF_NOT_EXISTS
static final AllowableValue FAIL_IF_NOT_EXISTS
static final String TABLE_MANAGEMENT_STRATEGY_ATTRIBUTE
static final AllowableValue MANAGED_TABLE
static final AllowableValue EXTERNAL_TABLE
static final AllowableValue ATTRIBUTE_DRIVEN_TABLE
static final String ATTR_OUTPUT_TABLE
static final String ATTR_OUTPUT_PATH
static final PropertyDescriptor RECORD_READER
static final PropertyDescriptor HIVE_DBCP_SERVICE
static final PropertyDescriptor TABLE_NAME
static final PropertyDescriptor CREATE_TABLE
static final PropertyDescriptor TABLE_MANAGEMENT_STRATEGY
static final PropertyDescriptor UPDATE_FIELD_NAMES
static final PropertyDescriptor RECORD_WRITER_FACTORY
static final PropertyDescriptor EXTERNAL_TABLE_LOCATION
static final PropertyDescriptor TABLE_STORAGE_FORMAT
static final PropertyDescriptor QUERY_TIMEOUT
static final PropertyDescriptor PARTITION_CLAUSE
public static final Relationship REL_SUCCESS
public static final Relationship REL_FAILURE
private List<PropertyDescriptor> propertyDescriptors
private Set<Relationship> relationships
protected void init(ProcessorInitializationContext context)
init in class AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate in class AbstractConfigurableComponentpublic void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger in class AbstractProcessorProcessExceptionprivate UpdateHiveTable.OutputMetadataHolder checkAndUpdateTableSchema(Map<String,String> attributes, Connection conn, RecordSchema schema, String tableName, List<String> partitionClause, boolean createIfNotExists, String externalTableLocation, String storageFormat, boolean updateFieldNames) throws IOException
IOExceptionprivate WriteResult updateRecords(RecordSchema inputRecordSchema, UpdateHiveTable.OutputMetadataHolder outputMetadataHolder, RecordReader reader, RecordSetWriter writer) throws IOException
IOExceptionCopyright © 2023 Apache NiFi Project. All rights reserved.