public abstract class AbstractHiveQLProcessor extends AbstractSessionFactoryProcessor
| Modifier and Type | Class and Description |
|---|---|
private class |
AbstractHiveQLProcessor.ParameterHolder |
protected static class |
AbstractHiveQLProcessor.TableName |
| Modifier and Type | Field and Description |
|---|---|
(package private) static String |
ATTR_INPUT_TABLES |
(package private) static String |
ATTR_OUTPUT_TABLES |
static PropertyDescriptor |
CHARSET |
static PropertyDescriptor |
HIVE_DBCP_SERVICE |
protected static Pattern |
HIVEQL_TYPE_ATTRIBUTE_PATTERN |
protected static Pattern |
NUMBER_PATTERN |
| Constructor and Description |
|---|
AbstractHiveQLProcessor() |
| Modifier and Type | Method and Description |
|---|---|
private void |
findTableNames(Object obj,
Set<AbstractHiveQLProcessor.TableName> tableNames) |
protected Set<AbstractHiveQLProcessor.TableName> |
findTableNames(String query) |
protected String |
getHiveQL(ProcessSession session,
FlowFile flowFile,
Charset charset)
Determines the HiveQL statement that should be executed for the given FlowFile
|
private String |
normalize(String query)
Normalize query.
|
protected void |
setParameter(PreparedStatement stmt,
String attrName,
int parameterIndex,
String parameterValue,
int jdbcType)
Determines how to map the given value to the appropriate JDBC data jdbcType and sets the parameter on the
provided PreparedStatement
|
protected int |
setParameters(int base,
PreparedStatement stmt,
int paramCount,
Map<String,String> attributes)
Sets all of the appropriate parameters on the given PreparedStatement, based on the given FlowFile attributes.
|
protected Map<String,String> |
toQueryTableAttributes(Set<AbstractHiveQLProcessor.TableName> tableNames) |
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getRelationships, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTruecustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, getSupportedPropertyDescriptors, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStateful, onTriggergetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateprotected static final Pattern HIVEQL_TYPE_ATTRIBUTE_PATTERN
protected static final Pattern NUMBER_PATTERN
static String ATTR_INPUT_TABLES
static String ATTR_OUTPUT_TABLES
public static final PropertyDescriptor HIVE_DBCP_SERVICE
public static final PropertyDescriptor CHARSET
protected String getHiveQL(ProcessSession session, FlowFile flowFile, Charset charset)
session - the session that can be used to access the given FlowFileflowFile - the FlowFile whose HiveQL statement should be executedprotected int setParameters(int base,
PreparedStatement stmt,
int paramCount,
Map<String,String> attributes)
throws SQLException
stmt - the statement to set the parameters onattributes - the attributes from which to derive parameter indices, values, and typesSQLException - if the PreparedStatement throws a SQLException when the appropriate setter is calledprotected void setParameter(PreparedStatement stmt, String attrName, int parameterIndex, String parameterValue, int jdbcType) throws SQLException
stmt - the PreparedStatement to set the parameter onattrName - the name of the attribute that the parameter is coming from - for logging purposesparameterIndex - the index of the HiveQL parameter to setparameterValue - the value of the HiveQL parameter to setjdbcType - the JDBC Type of the HiveQL parameter to setSQLException - if the PreparedStatement throws a SQLException when calling the appropriate setterprotected Set<AbstractHiveQLProcessor.TableName> findTableNames(String query)
private String normalize(String query)
HivePreparedStatement.updateSql(String, HashMap) for detail.
HiveParser does not expect '?' to be in a query string, and throws an Exception if there is one.
In this normalize method, '?' is replaced to 'x' to avoid that.private void findTableNames(Object obj, Set<AbstractHiveQLProcessor.TableName> tableNames)
protected Map<String,String> toQueryTableAttributes(Set<AbstractHiveQLProcessor.TableName> tableNames)
Copyright © 2023 Apache NiFi Project. All rights reserved.