Package org.teiid.translator.phoenix
Class PhoenixExecutionFactory
- java.lang.Object
-
- org.teiid.translator.ExecutionFactory<DataSource,Connection>
-
- org.teiid.translator.jdbc.JDBCExecutionFactory
-
- org.teiid.translator.phoenix.PhoenixExecutionFactory
-
- Direct Known Subclasses:
HBaseExecutionFactory
@Translator(name="phoenix", description="A translator for Phoenix/HBase") public class PhoenixExecutionFactory 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 static StringPHOENIXstatic VersionV_4_8-
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 PhoenixExecutionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbindValue(PreparedStatement pstmt, Object param, Class<?> paramType, int i)Sets prepared statement parameter i with param.protected JDBCMetadataProcessorcreateMetadataProcessor()JDBCUpdateExecutioncreateUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)CharactergetRequiredLikeEscape()The required escape character or null if all are supported.PhoenixSQLConversionVisitorgetSQLConversionVisitor()Create theSQLConversionVisitorthat will perform translation.List<String>getSupportedFunctions()Get list of all supported function names.voidinitCapabilities(Connection connection)Will be called byExecutionFactory.start()with a null connection if a source connection is notExecutionFactory.isSourceRequiredForCapabilities()ObjectretrieveValue(ResultSet results, int columnIndex, Class<?> expectedType)The Phoenix driver has issues using a calendar object.voidstart()Initialize the connector with supplied configurationbooleansupportsInsertWithQueryExpression()booleansupportsRowLimit()Gets whether the connector can limit the number of rows returned by a query.booleansupportsRowOffset()Gets whether the connector supports a SQL clause (similar to the LIMIT with an offset) that can return result sets that start in the middle of the resulting rows returned by a querybooleansupportsScalarSubqueryProjection()If a scalar subquery can be projected.booleansupportsUpsert()List<?>translate(LanguageObject obj, ExecutionContext context)Adding a specific workaround for just Pheonix and BigDecimal.List<?>translateCommand(Command command, ExecutionContext context)Return a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.List<?>translateLimit(Limit limit, ExecutionContext context)Return a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.StringtranslateLiteralBoolean(Boolean booleanValue)Subclasses should override this method to provide a different sql translation of the literal boolean value.StringtranslateLiteralDate(Date dateValue)It doesn't appear that the time component is needed, but for consistency with their documentation, we'll add it.StringtranslateLiteralTime(Time timeValue)A date component is required, so create a new Timestamp insteadStringtranslateLiteralTimestamp(Timestamp timestampValue)Subclasses should override this method to provide a different sql translation of the literal timestamp value.protected booleanusesDatabaseVersion()-
Methods inherited from class org.teiid.translator.jdbc.JDBCExecutionFactory
addSourceComment, afterInitialConnectionObtained, closeConnection, convertObject, createDirectExecution, createProcedureExecution, createResultSetExecution, createTempTable, executeStoredProcedure, formatDateValue, formatDateValue, getCommentFormat, getConnection, getCreateTemporaryTablePostfix, getCreateTemporaryTableString, getCreateTempTableSQL, getDatabaseCalendar, getDatabaseTimeZone, getDatabaseVersion, getDefaultNullOrder, getDefaultSupportedFunctions, getDialect, getFunctionModifiers, getHibernateDialectClassName, getLateralKeyword, getLikeRegexString, getMaxPreparedInsertBatchSize, getMetadata, getMetadataProcessor, getRemovePushdownCharacters, getSetOperationString, getSourceComment, getStructRetrieval, getTemporaryTableName, getTimestampNanoPrecision, getVersion, hasTimeType, intializeConnectionAfterCancel, isCharacterType, isDefaultTimeZone, isEnableDependentJoins, isExtendedAscii, isNonAscii, isNonAscii, isNonAsciiFunction, isSourceRequired, isSourceRequiredForCapabilities, isTrimStrings, loadedTemporaryTable, obtainedConnection, preserveNullTyping, registerFunctionModifier, registerSpecificTypeOfOutParameter, replaceElementName, retrieveGeographyValue, retrieveGeographyValue, retrieveGeometryValue, retrieveGeometryValue, retrieveValue, setCommentFormat, setDatabaseTimeZone, setDatabaseVersion, setDatabaseVersion, setEnableDependentJoins, setFetchSize, setMaxPreparedInsertBatchSize, setRemovePushdownCharacters, setStructRetrieval, setTrimStrings, setUseBindingsForDependentJoin, setUseBindVariables, setUseCommentsInSourceQuery, supportsAggregatesAvg, supportsAggregatesCount, supportsAggregatesCountStar, supportsAggregatesDistinct, supportsAggregatesMax, supportsAggregatesMin, supportsAggregatesSum, supportsAliasedTable, supportsBatchedUpdates, supportsBooleanExpressions, supportsBulkUpdate, supportsCompareCriteriaEquals, supportsCompareCriteriaOrdered, supportsCorrelatedSubqueries, supportsDependentJoins, supportsExistsCriteria, supportsFullDependentJoins, supportsGeneratedKeys, supportsGeneratedKeys, supportsGroupBy, supportsHaving, supportsInCriteria, supportsInCriteriaSubquery, supportsInlineViews, supportsIsNullCriteria, supportsLikeCriteria, supportsLikeCriteriaEscapeCharacter, supportsNotCriteria, supportsOrCriteria, supportsOrderByUnrelated, supportsProcedureParameterExpression, supportsQuantifiedCompareCriteriaAll, supportsQuantifiedCompareCriteriaSome, supportsScalarSubqueries, supportsSearchedCaseExpressions, supportsSelectExpression, supportsSelfJoins, supportsSetQueryOrderBy, supportsUnions, tempTableRequiresTransaction, translateGeographyLiteral, translateGeographyParameter, translateGeographySelect, translateGeometryLiteral, translateGeometryParameter, translateGeometrySelect, translateLiteralBinaryType, useAsInGroupAlias, useBindingsForDependentJoin, useBindVariables, useColumnNamesForGeneratedKeys, useCommentsInSourceQuery, useNBindingType, useParensForJoins, useParensForSetQueries, usePreparedStatements, useScientificNotation, 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, 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, supportsCommonTableExpressions, supportsCompareCriteriaOrderedExclusive, supportsConvert, supportsCorrelatedSubqueryLimit, supportsDirectQueryProcedure, supportsElementaryOlapOperations, supportsExcept, supportsFormatLiteral, supportsFullOuterJoins, supportsFunctionsInGroupBy, supportsGeographyType, supportsGroupByMultipleDistinctAggregates, supportsGroupByRollup, supportsInnerJoins, supportsIntersect, supportsIsDistinctCriteria, supportsLateralJoin, supportsLateralJoinCondition, supportsLikeRegex, supportsListAgg, supportsMultipleOpenExecutions, supportsNativeQueries, supportsOnlyCorrelatedSubqueries, supportsOnlyFormatLiterals, supportsOnlyLateralJoinProcedure, supportsOnlyLiteralComparison, supportsOnlyRelationshipStyleJoins, supportsOnlySingleTableGroupBy, supportsOnlyTimestampAddLiteral, supportsOrderBy, supportsOrderByNullOrdering, supportsOrderByWithExtendedGrouping, supportsOuterJoins, supportsPartialFiltering, supportsProcedureTable, supportsRecursiveCommonTableExpressions, supportsSelectDistinct, supportsSelectExpressionArrayType, supportsSelectWithoutFrom, supportsSetQueryLimitOffset, supportsSimilarTo, supportsStringAgg, supportsSubqueryCommonTableExpressions, supportsSubqueryInOn, supportsWindowDistinctAggregates, supportsWindowFrameClause, supportsWindowFunctionCumeDist, supportsWindowFunctionNthValue, supportsWindowFunctionNtile, supportsWindowFunctionPercentRank, supportsWindowOrderByWithAggregates, useAnsiJoin
-
-
-
-
Method Detail
-
start
public void start() throws TranslatorExceptionDescription copied from class:ExecutionFactoryInitialize the connector with supplied configuration- Overrides:
startin classJDBCExecutionFactory- Throws:
TranslatorException
-
getSupportedFunctions
public List<String> getSupportedFunctions()
Description copied from class:ExecutionFactoryGet list of all supported function names. Arithmetic functions have names like "+".- Overrides:
getSupportedFunctionsin classJDBCExecutionFactory- See Also:
for a listing of system pushdown functions. Note that not all system functions are listed as some functions will use a common name such as CONCAT vs. the || operator, and other functions will be rewritten and not pushed down, such as SPACE. Note: User defined functions should be specified fully qualified.
-
initCapabilities
public void initCapabilities(Connection connection) throws TranslatorException
Description copied from class:ExecutionFactoryWill be called byExecutionFactory.start()with a null connection if a source connection is notExecutionFactory.isSourceRequiredForCapabilities()- Overrides:
initCapabilitiesin classJDBCExecutionFactory- Throws:
TranslatorException
-
createUpdateExecution
public JDBCUpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn) throws TranslatorException
- Overrides:
createUpdateExecutionin classJDBCExecutionFactory- Throws:
TranslatorException
-
getSQLConversionVisitor
public PhoenixSQLConversionVisitor getSQLConversionVisitor()
Description copied from class:JDBCExecutionFactoryCreate theSQLConversionVisitorthat will perform translation. Typical custom JDBC connectors will not need to create custom conversion visitors, rather implementors should override existingJDBCExecutionFactorymethods.- Overrides:
getSQLConversionVisitorin classJDBCExecutionFactory- Returns:
- the
SQLConversionVisitor
-
bindValue
public void bindValue(PreparedStatement pstmt, Object param, Class<?> paramType, int i) throws SQLException
Description copied from class:JDBCExecutionFactorySets 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:
bindValuein classJDBCExecutionFactory- Throws:
SQLException
-
supportsInsertWithQueryExpression
public boolean supportsInsertWithQueryExpression()
Description copied from class:ExecutionFactorySupport indicates that the connector can accept INSERTs with values specified by aSetQueryorSelect- Overrides:
supportsInsertWithQueryExpressionin classJDBCExecutionFactory
-
translateLiteralBoolean
public String translateLiteralBoolean(Boolean booleanValue)
Description copied from class:JDBCExecutionFactorySubclasses 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:
translateLiteralBooleanin classJDBCExecutionFactory- Parameters:
booleanValue- Boolean value, never null- Returns:
- Translated string
-
translate
public List<?> translate(LanguageObject obj, ExecutionContext context)
Adding a specific workaround for just Pheonix and BigDecimal.- Overrides:
translatein classJDBCExecutionFactory- Returns:
- list of translated parts
-
translateLiteralDate
public String translateLiteralDate(Date dateValue)
It doesn't appear that the time component is needed, but for consistency with their documentation, we'll add it.- Overrides:
translateLiteralDatein classJDBCExecutionFactory- Parameters:
dateValue- Date value, never null- Returns:
- Translated string
-
translateLiteralTime
public String translateLiteralTime(Time timeValue)
A date component is required, so create a new Timestamp instead- Overrides:
translateLiteralTimein classJDBCExecutionFactory- Parameters:
timeValue- Time value, never null- Returns:
- Translated string
-
translateLiteralTimestamp
public String translateLiteralTimestamp(Timestamp timestampValue)
Description copied from class:JDBCExecutionFactorySubclasses 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:
translateLiteralTimestampin classJDBCExecutionFactory- Parameters:
timestampValue- Timestamp value, never null- Returns:
- Translated string
-
retrieveValue
public Object retrieveValue(ResultSet results, int columnIndex, Class<?> expectedType) throws SQLException
The Phoenix driver has issues using a calendar object. it throws an npe on a null value and also has https://issues.apache.org/jira/browse/PHOENIX-869- Overrides:
retrieveValuein classJDBCExecutionFactory- Returns:
- the value
- Throws:
SQLException
-
createMetadataProcessor
protected JDBCMetadataProcessor createMetadataProcessor()
- Overrides:
createMetadataProcessorin classJDBCExecutionFactory- See Also:
JDBCExecutionFactory.getMetadataProcessor()
-
getRequiredLikeEscape
public Character getRequiredLikeEscape()
Description copied from class:ExecutionFactoryThe required escape character or null if all are supported.- Overrides:
getRequiredLikeEscapein classExecutionFactory<DataSource,Connection>- Returns:
-
translateCommand
public List<?> translateCommand(Command command, ExecutionContext context)
Description copied from class:JDBCExecutionFactoryReturn a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.- Overrides:
translateCommandin classJDBCExecutionFactory- Returns:
- a list of translated parts
-
translateLimit
public List<?> translateLimit(Limit limit, ExecutionContext context)
Description copied from class:JDBCExecutionFactoryReturn a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.- Overrides:
translateLimitin classJDBCExecutionFactory- Returns:
- a list of translated parts
-
supportsRowLimit
public boolean supportsRowLimit()
Description copied from class:ExecutionFactoryGets whether the connector can limit the number of rows returned by a query.- Overrides:
supportsRowLimitin classExecutionFactory<DataSource,Connection>
-
supportsScalarSubqueryProjection
public boolean supportsScalarSubqueryProjection()
Description copied from class:ExecutionFactoryIf a scalar subquery can be projected.- Overrides:
supportsScalarSubqueryProjectionin classExecutionFactory<DataSource,Connection>- Returns:
-
supportsUpsert
public boolean supportsUpsert()
- Overrides:
supportsUpsertin classExecutionFactory<DataSource,Connection>- Returns:
- true if the source supports upsert
-
usesDatabaseVersion
protected boolean usesDatabaseVersion()
- Overrides:
usesDatabaseVersionin classJDBCExecutionFactory
-
supportsRowOffset
public boolean supportsRowOffset()
Description copied from class:ExecutionFactoryGets whether the connector supports a SQL clause (similar to the LIMIT with an offset) that can return result sets that start in the middle of the resulting rows returned by a query- Overrides:
supportsRowOffsetin classExecutionFactory<DataSource,Connection>
-
-