Package org.teiid.translator.hive
Class BaseHiveExecutionFactory
- java.lang.Object
-
- org.teiid.translator.ExecutionFactory<DataSource,Connection>
-
- org.teiid.translator.jdbc.JDBCExecutionFactory
-
- org.teiid.translator.hive.BaseHiveExecutionFactory
-
- Direct Known Subclasses:
HiveExecutionFactory
,ImpalaExecutionFactory
public class BaseHiveExecutionFactory extends JDBCExecutionFactory
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.teiid.translator.jdbc.JDBCExecutionFactory
JDBCExecutionFactory.StructRetrieval
-
Nested classes/interfaces inherited from class org.teiid.translator.ExecutionFactory
ExecutionFactory.Format, ExecutionFactory.NullOrder, ExecutionFactory.SupportedJoinCriteria, ExecutionFactory.TransactionSupport
-
-
Field Summary
Fields Modifier and Type Field Description protected ConvertModifier
convert
protected boolean
useDatabaseMetaData
-
Fields inherited from class org.teiid.translator.jdbc.JDBCExecutionFactory
DEFAULT_MAX_DEPENDENT_PREDICATES, DEFAULT_MAX_IN_CRITERIA, DEFAULT_TIME_ZONE, dialect
-
Fields inherited from class org.teiid.translator.ExecutionFactory
DEFAULT_MAX_FROM_GROUPS, DEFAULT_MAX_IN_CRITERIA_SIZE, DEFAULT_MAX_PROJECTED_COLUMNS
-
-
Constructor Summary
Constructors Constructor Description BaseHiveExecutionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected FunctionMethod
addAggregatePushDownFunction(String qualifier, String name, String returnType, String... paramTypes)
boolean
addSourceComment()
Returns true to indicate that SQL should include a comment indicating the session and request ids.void
bindValue(PreparedStatement stmt, Object param, Class<?> paramType, int i)
Sets prepared statement parameter i with param.protected JDBCMetadataProcessor
createMetadataProcessor()
Deprecated.ProcedureExecution
createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
JDBCUpdateExecution
createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
String
getLikeRegexString()
Get the predicate name for LIKE_REGEXJDBCMetadataProcessor
getMetadataProcessor()
Get a MetadataProcessor for the translator to read the metadata.SQLConversionVisitor
getSQLConversionVisitor()
Create theSQLConversionVisitor
that will perform translation.boolean
hasTimeType()
Return false to indicate that time support should be emulated with timestamps.boolean
isUseDatabaseMetaData()
boolean
requiresLeftLinearJoin()
Object
retrieveValue(CallableStatement results, int parameterIndex, Class<?> expectedType)
Retrieve the value for the given parameter indexObject
retrieveValue(ResultSet results, int columnIndex, Class<?> expectedType)
Retrieve the value on the current resultset row for the given column index.boolean
rewriteBooleanFunctions()
void
setUseDatabaseMetaData(boolean useDatabaseMetaData)
boolean
supportsBatchedUpdates()
Whether the source supportsBatchedUpdates
boolean
supportsBulkUpdate()
Whether the source supports updates with multiple value setsboolean
supportsCommonTableExpressions()
boolean
supportsConvert(int fromType, int toType)
Used for fine grained control of convert/cast pushdown.boolean
supportsCorrelatedSubqueries()
Support indicates connector can accept correlated subqueries wherever subqueries are acceptedboolean
supportsExcept()
Support indicates that the connector supports the EXCEPT of two queries.boolean
supportsExistsCriteria()
Support indicates connector accepts the EXISTS criteriaboolean
supportsHaving()
Whether the source supports the HAVING clauseboolean
supportsInCriteriaSubquery()
Support indicates connector accepts IN criteria with a subquery on the right sideboolean
supportsInlineViews()
Support indicates connector can accept inline views (subqueries in the FROM clause).boolean
supportsInsertWithQueryExpression()
boolean
supportsIntersect()
Support indicates that the connector supports the INTERSECT of two queries.boolean
supportsLikeCriteriaEscapeCharacter()
Support indicates connector accepts criteria of form (element LIKE constant ESCAPE char)boolean
supportsLikeRegex()
boolean
supportsOrderByUnrelated()
Support indicates connector accepts ORDER BY clause with columns not from the selectboolean
supportsQuantifiedCompareCriteriaAll()
Support indicates connector accepts the quantified comparison criteria that use ALLboolean
supportsQuantifiedCompareCriteriaSome()
Support indicates connector accepts the quantified comparison criteria that use SOMEboolean
supportsRowLimit()
Gets whether the connector can limit the number of rows returned by a query.boolean
supportsScalarSubqueries()
Support indicates connector can accept scalar subqueries in the SELECT, WHERE, and HAVING clausesboolean
supportsUnions()
Support indicates that the connector supports the UNION of two queries.boolean
supportsWindowFunctionNthValue()
List<?>
translateCommand(Command command, ExecutionContext context)
Return a List of translated parts (LanguageObject
s and Objects), or null if to rely on the default translation.List<?>
translateLimit(Limit limit, ExecutionContext context)
Return a List of translated parts (LanguageObject
s and Objects), or null if to rely on the default translation.String
translateLiteralBoolean(Boolean booleanValue)
Subclasses should override this method to provide a different sql translation of the literal boolean value.String
translateLiteralTime(Time timeValue)
Subclasses should override this method to provide a different sql translation of the literal time value.String
translateLiteralTimestamp(Timestamp timestampValue)
Subclasses should override this method to provide a different sql translation of the literal timestamp value.boolean
useAnsiJoin()
Whether the source prefers to use ANSI style joins.boolean
useAsInGroupAlias()
Indicates whether group alias should be of the form "...FROM groupA AS X" or "...FROM groupA X".-
Methods inherited from class org.teiid.translator.jdbc.JDBCExecutionFactory
afterInitialConnectionObtained, closeConnection, convertObject, createDirectExecution, createResultSetExecution, createTempTable, executeStoredProcedure, formatDateValue, formatDateValue, getCommentFormat, getConnection, getCreateTemporaryTablePostfix, getCreateTemporaryTableString, getCreateTempTableSQL, getDatabaseCalendar, getDatabaseTimeZone, getDatabaseVersion, getDefaultNullOrder, getDefaultSupportedFunctions, getDialect, getFunctionModifiers, getHibernateDialectClassName, getLateralKeyword, getMaxPreparedInsertBatchSize, getMetadata, getRemovePushdownCharacters, getSetOperationString, getSourceComment, getStructRetrieval, getSupportedFunctions, getTemporaryTableName, getTimestampNanoPrecision, getVersion, initCapabilities, intializeConnectionAfterCancel, isCharacterType, isDefaultTimeZone, isEnableDependentJoins, isExtendedAscii, isNonAscii, isNonAscii, isNonAsciiFunction, isSourceRequired, isSourceRequiredForCapabilities, isTrimStrings, loadedTemporaryTable, obtainedConnection, preserveNullTyping, registerFunctionModifier, registerSpecificTypeOfOutParameter, replaceElementName, retrieveGeographyValue, retrieveGeographyValue, retrieveGeometryValue, retrieveGeometryValue, setCommentFormat, setDatabaseTimeZone, setDatabaseVersion, setDatabaseVersion, setEnableDependentJoins, setFetchSize, setMaxPreparedInsertBatchSize, setRemovePushdownCharacters, setStructRetrieval, setTrimStrings, setUseBindingsForDependentJoin, setUseBindVariables, setUseCommentsInSourceQuery, start, supportsAggregatesAvg, supportsAggregatesCount, supportsAggregatesCountStar, supportsAggregatesDistinct, supportsAggregatesMax, supportsAggregatesMin, supportsAggregatesSum, supportsAliasedTable, supportsBooleanExpressions, supportsCompareCriteriaEquals, supportsCompareCriteriaOrdered, supportsDependentJoins, supportsFullDependentJoins, supportsGeneratedKeys, supportsGeneratedKeys, supportsGroupBy, supportsInCriteria, supportsIsNullCriteria, supportsLikeCriteria, supportsNotCriteria, supportsOrCriteria, supportsProcedureParameterExpression, supportsSearchedCaseExpressions, supportsSelectExpression, supportsSelfJoins, supportsSetQueryOrderBy, tempTableRequiresTransaction, translate, translateGeographyLiteral, translateGeographyParameter, translateGeographySelect, translateGeometryLiteral, translateGeometryParameter, translateGeometrySelect, translateLiteralBinaryType, translateLiteralDate, useBindingsForDependentJoin, useBindVariables, useColumnNamesForGeneratedKeys, useCommentsInSourceQuery, useNBindingType, useParensForJoins, useParensForSetQueries, usePreparedStatements, useScientificNotation, usesDatabaseVersion, useSelectLimit, useStreamsForLobs, useUnicodePrefix, useWithRollup
-
Methods inherited from class org.teiid.translator.ExecutionFactory
addPushDownFunction, areLobsUsableAfterClose, createExecution, getCacheDirective, getCollationLocale, getConnection, getDirectQueryProcedureName, getExcludedCommonTableExpressionName, getInstance, getLanguageFactory, getMaxDependentInPredicates, getMaxFromGroups, getMaxInCriteriaSize, getMaxProjectedColumns, getNativeQueryProcedureName, getPushDownFunctions, getRequiredLikeEscape, getSupportedJoinCriteria, getTransactionSupport, getTypeFacility, isCopyLobs, isForkable, isImmutable, isSourceRequiredForMetadata, isThreadBound, requiresCriteria, returnsSingleUpdateCount, setCollationLocale, setCopyLobs, setDirectQueryProcedureName, setExcludedCommonTableExpressionName, setImmutable, setMaxDependentInPredicates, setMaxInCriteriaSize, setNativeQueryProcedureName, setRequiresCriteria, setSourceRequired, setSourceRequiredForMetadata, setSupportedJoinCriteria, setSupportsDirectQueryProcedure, setSupportsFullOuterJoins, setSupportsInnerJoins, setSupportsNativeQueries, setSupportsOrderBy, setSupportsOuterJoins, setSupportsSelectDistinct, setThreadBound, setTransactionSupport, supportsAdvancedOlapOperations, supportsAggregatesCountBig, supportsAggregatesEnhancedNumeric, supportsArrayAgg, supportsArrayType, supportsCompareCriteriaOrderedExclusive, supportsCorrelatedSubqueryLimit, supportsDirectQueryProcedure, supportsElementaryOlapOperations, supportsFormatLiteral, supportsFullOuterJoins, supportsFunctionsInGroupBy, supportsGeographyType, supportsGroupByMultipleDistinctAggregates, supportsGroupByRollup, supportsInnerJoins, supportsIsDistinctCriteria, supportsLateralJoin, supportsLateralJoinCondition, supportsListAgg, supportsMultipleOpenExecutions, supportsNativeQueries, supportsOnlyCorrelatedSubqueries, supportsOnlyFormatLiterals, supportsOnlyLateralJoinProcedure, supportsOnlyLiteralComparison, supportsOnlyRelationshipStyleJoins, supportsOnlySingleTableGroupBy, supportsOnlyTimestampAddLiteral, supportsOrderBy, supportsOrderByNullOrdering, supportsOrderByWithExtendedGrouping, supportsOuterJoins, supportsPartialFiltering, supportsProcedureTable, supportsRecursiveCommonTableExpressions, supportsRowOffset, supportsScalarSubqueryProjection, supportsSelectDistinct, supportsSelectExpressionArrayType, supportsSelectWithoutFrom, supportsSetQueryLimitOffset, supportsSimilarTo, supportsStringAgg, supportsSubqueryCommonTableExpressions, supportsSubqueryInOn, supportsUpsert, supportsWindowDistinctAggregates, supportsWindowFrameClause, supportsWindowFunctionCumeDist, supportsWindowFunctionNtile, supportsWindowFunctionPercentRank, supportsWindowOrderByWithAggregates
-
-
-
-
Field Detail
-
convert
protected ConvertModifier convert
-
useDatabaseMetaData
protected boolean useDatabaseMetaData
-
-
Method Detail
-
createUpdateExecution
public JDBCUpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn) throws TranslatorException
- Overrides:
createUpdateExecution
in classJDBCExecutionFactory
- Throws:
TranslatorException
-
createProcedureExecution
public ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn) throws TranslatorException
- Overrides:
createProcedureExecution
in classJDBCExecutionFactory
- Throws:
TranslatorException
-
getSQLConversionVisitor
public SQLConversionVisitor getSQLConversionVisitor()
Description copied from class:JDBCExecutionFactory
Create theSQLConversionVisitor
that will perform translation. Typical custom JDBC connectors will not need to create custom conversion visitors, rather implementors should override existingJDBCExecutionFactory
methods.- Overrides:
getSQLConversionVisitor
in classJDBCExecutionFactory
- Returns:
- the
SQLConversionVisitor
-
useAnsiJoin
public boolean useAnsiJoin()
Description copied from class:ExecutionFactory
Whether the source prefers to use ANSI style joins.- Overrides:
useAnsiJoin
in classExecutionFactory<DataSource,Connection>
-
supportsCorrelatedSubqueries
public boolean supportsCorrelatedSubqueries()
Description copied from class:ExecutionFactory
Support indicates connector can accept correlated subqueries wherever subqueries are accepted- Overrides:
supportsCorrelatedSubqueries
in classJDBCExecutionFactory
-
supportsExistsCriteria
public boolean supportsExistsCriteria()
Description copied from class:ExecutionFactory
Support indicates connector accepts the EXISTS criteria- Overrides:
supportsExistsCriteria
in classJDBCExecutionFactory
-
supportsInCriteriaSubquery
public boolean supportsInCriteriaSubquery()
Description copied from class:ExecutionFactory
Support indicates connector accepts IN criteria with a subquery on the right side- Overrides:
supportsInCriteriaSubquery
in classJDBCExecutionFactory
-
supportsLikeCriteriaEscapeCharacter
public boolean supportsLikeCriteriaEscapeCharacter()
Description copied from class:ExecutionFactory
Support indicates connector accepts criteria of form (element LIKE constant ESCAPE char)- Overrides:
supportsLikeCriteriaEscapeCharacter
in classJDBCExecutionFactory
-
supportsQuantifiedCompareCriteriaAll
public boolean supportsQuantifiedCompareCriteriaAll()
Description copied from class:ExecutionFactory
Support indicates connector accepts the quantified comparison criteria that use ALL- Overrides:
supportsQuantifiedCompareCriteriaAll
in classJDBCExecutionFactory
-
supportsQuantifiedCompareCriteriaSome
public boolean supportsQuantifiedCompareCriteriaSome()
Description copied from class:ExecutionFactory
Support indicates connector accepts the quantified comparison criteria that use SOME- Overrides:
supportsQuantifiedCompareCriteriaSome
in classJDBCExecutionFactory
-
supportsBulkUpdate
public boolean supportsBulkUpdate()
Description copied from class:ExecutionFactory
Whether the source supports updates with multiple value sets- Overrides:
supportsBulkUpdate
in classJDBCExecutionFactory
-
supportsBatchedUpdates
public boolean supportsBatchedUpdates()
Description copied from class:ExecutionFactory
Whether the source supportsBatchedUpdates
- Overrides:
supportsBatchedUpdates
in classJDBCExecutionFactory
-
translateCommand
public List<?> translateCommand(Command command, ExecutionContext context)
Description copied from class:JDBCExecutionFactory
Return a List of translated parts (LanguageObject
s and Objects), or null if to rely on the default translation.- Overrides:
translateCommand
in classJDBCExecutionFactory
- Returns:
- a list of translated parts
-
translateLimit
public List<?> translateLimit(Limit limit, ExecutionContext context)
Description copied from class:JDBCExecutionFactory
Return a List of translated parts (LanguageObject
s and Objects), or null if to rely on the default translation.- Overrides:
translateLimit
in classJDBCExecutionFactory
- Returns:
- a list of translated parts
-
addSourceComment
public boolean addSourceComment()
Description copied from class:JDBCExecutionFactory
Returns true to indicate that SQL should include a comment indicating the session and request ids.- Overrides:
addSourceComment
in classJDBCExecutionFactory
-
useAsInGroupAlias
public boolean useAsInGroupAlias()
Description copied from class:JDBCExecutionFactory
Indicates whether group alias should be of the form "...FROM groupA AS X" or "...FROM groupA X". Certain data sources (such as Oracle) may not support the first form.- Overrides:
useAsInGroupAlias
in classJDBCExecutionFactory
- Returns:
- boolean
-
hasTimeType
public boolean hasTimeType()
Description copied from class:JDBCExecutionFactory
Return false to indicate that time support should be emulated with timestamps.- Overrides:
hasTimeType
in classJDBCExecutionFactory
- Returns:
- true if database has a time type
-
getLikeRegexString
public String getLikeRegexString()
Description copied from class:JDBCExecutionFactory
Get the predicate name for LIKE_REGEX- Overrides:
getLikeRegexString
in classJDBCExecutionFactory
- Returns:
-
supportsScalarSubqueries
public boolean supportsScalarSubqueries()
Description copied from class:ExecutionFactory
Support indicates connector can accept scalar subqueries in the SELECT, WHERE, and HAVING clauses- Overrides:
supportsScalarSubqueries
in classJDBCExecutionFactory
-
supportsInlineViews
public boolean supportsInlineViews()
Description copied from class:ExecutionFactory
Support indicates connector can accept inline views (subqueries in the FROM clause).- Overrides:
supportsInlineViews
in classJDBCExecutionFactory
-
supportsUnions
public boolean supportsUnions()
Description copied from class:ExecutionFactory
Support indicates that the connector supports the UNION of two queries.- Overrides:
supportsUnions
in classJDBCExecutionFactory
-
supportsInsertWithQueryExpression
public boolean supportsInsertWithQueryExpression()
Description copied from class:ExecutionFactory
Support indicates that the connector can accept INSERTs with values specified by aSetQuery
orSelect
- Overrides:
supportsInsertWithQueryExpression
in classJDBCExecutionFactory
-
supportsIntersect
public boolean supportsIntersect()
Description copied from class:ExecutionFactory
Support indicates that the connector supports the INTERSECT of two queries.- Overrides:
supportsIntersect
in classExecutionFactory<DataSource,Connection>
-
supportsExcept
public boolean supportsExcept()
Description copied from class:ExecutionFactory
Support indicates that the connector supports the EXCEPT of two queries.- Overrides:
supportsExcept
in classExecutionFactory<DataSource,Connection>
-
supportsCommonTableExpressions
public boolean supportsCommonTableExpressions()
- Overrides:
supportsCommonTableExpressions
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if the WITH clause is supported
-
supportsRowLimit
public boolean supportsRowLimit()
Description copied from class:ExecutionFactory
Gets whether the connector can limit the number of rows returned by a query.- Overrides:
supportsRowLimit
in classExecutionFactory<DataSource,Connection>
-
translateLiteralBoolean
public String translateLiteralBoolean(Boolean booleanValue)
Description copied from class:JDBCExecutionFactory
Subclasses should override this method to provide a different sql translation of the literal boolean value. By default, a boolean literal is represented as:'0'
or'1'
.- Overrides:
translateLiteralBoolean
in classJDBCExecutionFactory
- Parameters:
booleanValue
- Boolean value, never null- Returns:
- Translated string
-
translateLiteralTime
public String translateLiteralTime(Time timeValue)
Description copied from class:JDBCExecutionFactory
Subclasses should override this method to provide a different sql translation of the literal time value. By default, a time literal is represented as:{t '23:59:59'}
SeeJDBCExecutionFactory.hasTimeType()
to represent literal times as timestamps.- Overrides:
translateLiteralTime
in classJDBCExecutionFactory
- Parameters:
timeValue
- Time value, never null- Returns:
- Translated string
-
translateLiteralTimestamp
public String translateLiteralTimestamp(Timestamp timestampValue)
Description copied from class:JDBCExecutionFactory
Subclasses should override this method to provide a different sql translation of the literal timestamp value. By default, a timestamp literal is represented as:{ts '2002-12-31 23:59:59'}
. SeeJDBCExecutionFactory.getTimestampNanoPrecision()
to control the literal precision.- Overrides:
translateLiteralTimestamp
in classJDBCExecutionFactory
- Parameters:
timestampValue
- Timestamp value, never null- Returns:
- Translated string
-
createMetadataProcessor
@Deprecated protected JDBCMetadataProcessor createMetadataProcessor()
Deprecated.- Overrides:
createMetadataProcessor
in classJDBCExecutionFactory
- See Also:
JDBCExecutionFactory.getMetadataProcessor()
-
getMetadataProcessor
public JDBCMetadataProcessor getMetadataProcessor()
Description copied from class:ExecutionFactory
Get a MetadataProcessor for the translator to read the metadata. Typically this will return a new instance.- Overrides:
getMetadataProcessor
in classJDBCExecutionFactory
- Returns:
-
retrieveValue
public Object retrieveValue(ResultSet results, int columnIndex, Class<?> expectedType) throws SQLException
Description copied from class:JDBCExecutionFactory
Retrieve the value on the current resultset row for the given column index.- Overrides:
retrieveValue
in classJDBCExecutionFactory
- Returns:
- the value
- Throws:
SQLException
-
retrieveValue
public Object retrieveValue(CallableStatement results, int parameterIndex, Class<?> expectedType) throws SQLException
Description copied from class:JDBCExecutionFactory
Retrieve the value for the given parameter index- Overrides:
retrieveValue
in classJDBCExecutionFactory
- Returns:
- the value
- Throws:
SQLException
-
bindValue
public void bindValue(PreparedStatement stmt, Object param, Class<?> paramType, int i) throws SQLException
Description copied from class:JDBCExecutionFactory
Sets prepared statement parameter i with param. Performs special handling to translate dates using the database time zone and to translate biginteger, float, and char to JDBC safe objects.- Overrides:
bindValue
in classJDBCExecutionFactory
- Throws:
SQLException
-
addAggregatePushDownFunction
protected FunctionMethod addAggregatePushDownFunction(String qualifier, String name, String returnType, String... paramTypes)
-
supportsHaving
public boolean supportsHaving()
Description copied from class:ExecutionFactory
Whether the source supports the HAVING clause- Overrides:
supportsHaving
in classJDBCExecutionFactory
-
supportsConvert
public boolean supportsConvert(int fromType, int toType)
Description copied from class:ExecutionFactory
Used for fine grained control of convert/cast pushdown. TheExecutionFactory.getSupportedFunctions()
should containSourceSystemFunctions.CONVERT
. This method can then return false to indicate a lack of specific support. The engine will does not care about an unnecessary conversion where fromType == toType. By default lob conversion is disabled.- Overrides:
supportsConvert
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if the given conversion is supported.
- See Also:
TypeFacility.RUNTIME_CODES
,TypeFacility.RUNTIME_CODES
-
isUseDatabaseMetaData
@TranslatorProperty(display="Use DatabaseMetaData", description="Use DatabaseMetaData (typical JDBC logic) for importing") public boolean isUseDatabaseMetaData()
-
setUseDatabaseMetaData
public void setUseDatabaseMetaData(boolean useDatabaseMetaData)
-
requiresLeftLinearJoin
public boolean requiresLeftLinearJoin()
-
supportsOrderByUnrelated
public boolean supportsOrderByUnrelated()
Description copied from class:ExecutionFactory
Support indicates connector accepts ORDER BY clause with columns not from the select- Overrides:
supportsOrderByUnrelated
in classJDBCExecutionFactory
- Returns:
-
supportsLikeRegex
public boolean supportsLikeRegex()
- Overrides:
supportsLikeRegex
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if the LIKE_REGEX predicate is supported
-
rewriteBooleanFunctions
public boolean rewriteBooleanFunctions()
-
supportsWindowFunctionNthValue
public boolean supportsWindowFunctionNthValue()
- Overrides:
supportsWindowFunctionNthValue
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if nth_value is supported.
defaults to
ExecutionFactory.supportsElementaryOlapOperations()
-
-