Package org.teiid.translator.prestodb
Class PrestoDBExecutionFactory
- java.lang.Object
-
- org.teiid.translator.ExecutionFactory<DataSource,Connection>
-
- org.teiid.translator.jdbc.JDBCExecutionFactory
-
- org.teiid.translator.prestodb.PrestoDBExecutionFactory
-
- Direct Known Subclasses:
AthenaExecutionFactory
@Translator(name="prestodb", description="PrestoDB custom translator") public class PrestoDBExecutionFactory 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 Version
V_0_153
-
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 PrestoDBExecutionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected JDBCMetadataProcessor
createMetadataProcessor()
Deprecated.ProcedureExecution
createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
MetadataProcessor<Connection>
getMetadataProcessor()
Get a MetadataProcessor for the translator to read the metadata.List<String>
getSupportedFunctions()
Get list of all supported function names.void
initCapabilities(Connection connection)
Will be called byExecutionFactory.start()
with a null connection if a source connection is notExecutionFactory.isSourceRequiredForCapabilities()
boolean
isSourceRequiredForMetadata()
Flag that indicates if a underlying source connection required for this execution factory to return metadatavoid
start()
Initialize the connector with supplied configurationboolean
supportsAggregatesEnhancedNumeric()
Support indicates connector can accept STDDEV_POP, STDDEV_VAR, VAR_POP, VAR_SAMPboolean
supportsArrayType()
The engine uses array types for dependent joins and for array expression.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
supportsElementaryOlapOperations()
boolean
supportsExcept()
Support indicates that the connector supports the EXCEPT of two queries.boolean
supportsExistsCriteria()
Support indicates connector accepts the EXISTS criteriaboolean
supportsFunctionsInGroupBy()
Support indicates that the connector supports non-column expressions in GROUP BY, such as:SELECT dayofmonth(theDate), COUNT(*) FROM table GROUP BY dayofmonth(theDate)
boolean
supportsInlineViews()
Support indicates connector can accept inline views (subqueries in the FROM clause).boolean
supportsIntersect()
Support indicates that the connector supports the INTERSECT of two queries.boolean
supportsOnlyLiteralComparison()
boolean
supportsOrderByNullOrdering()
Returns whether the database supports explicit null ordering.boolean
supportsRowLimit()
Gets whether the connector can limit the number of rows returned by a query.boolean
supportsRowOffset()
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 queryboolean
supportsSelectWithoutFrom()
boolean
supportsSubqueryInOn()
Refines subquery support.String
translateLiteralDate(Date dateValue)
Base on https://prestodb.io/docs/current/functions/datetime.html, the support format are date '2012-08-08', time '01:00', timestamp '2012-08-08 01:00'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.protected boolean
usesDatabaseVersion()
-
Methods inherited from class org.teiid.translator.jdbc.JDBCExecutionFactory
addSourceComment, afterInitialConnectionObtained, bindValue, closeConnection, convertObject, createDirectExecution, createResultSetExecution, createTempTable, createUpdateExecution, executeStoredProcedure, formatDateValue, formatDateValue, getCommentFormat, getConnection, getCreateTemporaryTablePostfix, getCreateTemporaryTableString, getCreateTempTableSQL, getDatabaseCalendar, getDatabaseTimeZone, getDatabaseVersion, getDefaultNullOrder, getDefaultSupportedFunctions, getDialect, getFunctionModifiers, getHibernateDialectClassName, getLateralKeyword, getLikeRegexString, getMaxPreparedInsertBatchSize, getMetadata, getRemovePushdownCharacters, getSetOperationString, getSourceComment, getSQLConversionVisitor, getStructRetrieval, getTemporaryTableName, getTimestampNanoPrecision, getVersion, hasTimeType, intializeConnectionAfterCancel, isCharacterType, isDefaultTimeZone, isEnableDependentJoins, isExtendedAscii, isNonAscii, isNonAscii, isNonAsciiFunction, isSourceRequired, isSourceRequiredForCapabilities, isTrimStrings, loadedTemporaryTable, obtainedConnection, registerFunctionModifier, registerSpecificTypeOfOutParameter, replaceElementName, retrieveGeographyValue, retrieveGeographyValue, retrieveGeometryValue, retrieveGeometryValue, retrieveValue, retrieveValue, setCommentFormat, setDatabaseTimeZone, setDatabaseVersion, setDatabaseVersion, setEnableDependentJoins, setFetchSize, setMaxPreparedInsertBatchSize, setRemovePushdownCharacters, setStructRetrieval, setTrimStrings, setUseBindingsForDependentJoin, setUseBindVariables, setUseCommentsInSourceQuery, supportsAggregatesAvg, supportsAggregatesCount, supportsAggregatesCountStar, supportsAggregatesDistinct, supportsAggregatesMax, supportsAggregatesMin, supportsAggregatesSum, supportsAliasedTable, supportsBooleanExpressions, supportsCompareCriteriaEquals, supportsCompareCriteriaOrdered, supportsDependentJoins, supportsFullDependentJoins, supportsGeneratedKeys, supportsGeneratedKeys, supportsGroupBy, supportsHaving, supportsInCriteria, supportsInCriteriaSubquery, supportsInsertWithQueryExpression, supportsIsNullCriteria, supportsLikeCriteria, supportsLikeCriteriaEscapeCharacter, supportsNotCriteria, supportsOrCriteria, supportsOrderByUnrelated, supportsProcedureParameterExpression, supportsQuantifiedCompareCriteriaAll, supportsQuantifiedCompareCriteriaSome, supportsScalarSubqueries, supportsSearchedCaseExpressions, supportsSelectExpression, supportsSelfJoins, supportsSetQueryOrderBy, supportsUnions, tempTableRequiresTransaction, translate, translateCommand, translateGeographyLiteral, translateGeographyParameter, translateGeographySelect, translateGeometryLiteral, translateGeometryParameter, translateGeometrySelect, translateLimit, translateLiteralBinaryType, translateLiteralBoolean, 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, getRequiredLikeEscape, getSupportedJoinCriteria, getTransactionSupport, getTypeFacility, isCopyLobs, isForkable, isImmutable, 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, supportsArrayAgg, supportsCompareCriteriaOrderedExclusive, supportsCorrelatedSubqueryLimit, supportsDirectQueryProcedure, supportsFormatLiteral, supportsFullOuterJoins, supportsGeographyType, supportsGroupByMultipleDistinctAggregates, supportsGroupByRollup, supportsInnerJoins, supportsIsDistinctCriteria, supportsLateralJoin, supportsLateralJoinCondition, supportsLikeRegex, supportsListAgg, supportsMultipleOpenExecutions, supportsNativeQueries, supportsOnlyCorrelatedSubqueries, supportsOnlyFormatLiterals, supportsOnlyLateralJoinProcedure, supportsOnlySingleTableGroupBy, supportsOnlyTimestampAddLiteral, supportsOrderBy, supportsOrderByWithExtendedGrouping, supportsOuterJoins, supportsPartialFiltering, supportsProcedureTable, supportsRecursiveCommonTableExpressions, supportsScalarSubqueryProjection, supportsSelectDistinct, supportsSelectExpressionArrayType, supportsSetQueryLimitOffset, supportsSimilarTo, supportsStringAgg, supportsSubqueryCommonTableExpressions, supportsUpsert, supportsWindowDistinctAggregates, supportsWindowFrameClause, supportsWindowFunctionCumeDist, supportsWindowFunctionNthValue, supportsWindowFunctionNtile, supportsWindowFunctionPercentRank, supportsWindowOrderByWithAggregates
-
-
-
-
Field Detail
-
V_0_153
public static final Version V_0_153
-
-
Method Detail
-
createProcedureExecution
public ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn) throws TranslatorException
- Overrides:
createProcedureExecution
in classJDBCExecutionFactory
- Throws:
TranslatorException
-
useAnsiJoin
public boolean useAnsiJoin()
Description copied from class:ExecutionFactory
Whether the source prefers to use ANSI style joins.- Overrides:
useAnsiJoin
in classExecutionFactory<DataSource,Connection>
-
createMetadataProcessor
@Deprecated protected JDBCMetadataProcessor createMetadataProcessor()
Deprecated.- Overrides:
createMetadataProcessor
in classJDBCExecutionFactory
- See Also:
JDBCExecutionFactory.getMetadataProcessor()
-
getMetadataProcessor
public MetadataProcessor<Connection> 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:
-
isSourceRequiredForMetadata
public boolean isSourceRequiredForMetadata()
Description copied from class:ExecutionFactory
Flag that indicates if a underlying source connection required for this execution factory to return metadata- Overrides:
isSourceRequiredForMetadata
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if required
-
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
-
usesDatabaseVersion
protected boolean usesDatabaseVersion()
- Overrides:
usesDatabaseVersion
in classJDBCExecutionFactory
-
initCapabilities
public void initCapabilities(Connection connection) throws TranslatorException
Description copied from class:ExecutionFactory
Will be called byExecutionFactory.start()
with a null connection if a source connection is notExecutionFactory.isSourceRequiredForCapabilities()
- Overrides:
initCapabilities
in classJDBCExecutionFactory
- Throws:
TranslatorException
-
start
public void start() throws TranslatorException
Description copied from class:ExecutionFactory
Initialize the connector with supplied configuration- Overrides:
start
in classJDBCExecutionFactory
- Throws:
TranslatorException
-
getSupportedFunctions
public List<String> getSupportedFunctions()
Description copied from class:ExecutionFactory
Get list of all supported function names. Arithmetic functions have names like "+".- Overrides:
getSupportedFunctions
in 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.
-
translateLiteralDate
public String translateLiteralDate(Date dateValue)
Base on https://prestodb.io/docs/current/functions/datetime.html, the support format are date '2012-08-08', time '01:00', timestamp '2012-08-08 01:00'- Overrides:
translateLiteralDate
in classJDBCExecutionFactory
- Parameters:
dateValue
- Date 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
-
supportsSelectWithoutFrom
public boolean supportsSelectWithoutFrom()
- Overrides:
supportsSelectWithoutFrom
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if the translator support SELECT without a FROM clause
-
supportsSubqueryInOn
public boolean supportsSubqueryInOn()
Description copied from class:ExecutionFactory
Refines subquery support.- Overrides:
supportsSubqueryInOn
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if subqueries are supported in the on clause.
-
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
-
supportsExistsCriteria
public boolean supportsExistsCriteria()
Description copied from class:ExecutionFactory
Support indicates connector accepts the EXISTS criteria- Overrides:
supportsExistsCriteria
in classJDBCExecutionFactory
-
supportsOnlyLiteralComparison
public boolean supportsOnlyLiteralComparison()
- Overrides:
supportsOnlyLiteralComparison
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if only Literal comparisons (equality, ordered, like, etc.) are supported for non-join conditions.
-
supportsOrderByNullOrdering
public boolean supportsOrderByNullOrdering()
Description copied from class:ExecutionFactory
Returns whether the database supports explicit null ordering.- Overrides:
supportsOrderByNullOrdering
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if nulls first/last can be specified
-
supportsAggregatesEnhancedNumeric
public boolean supportsAggregatesEnhancedNumeric()
Description copied from class:ExecutionFactory
Support indicates connector can accept STDDEV_POP, STDDEV_VAR, VAR_POP, VAR_SAMP- Overrides:
supportsAggregatesEnhancedNumeric
in classExecutionFactory<DataSource,Connection>
-
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>
-
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>
-
supportsRowOffset
public boolean supportsRowOffset()
Description copied from class:ExecutionFactory
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 query- Overrides:
supportsRowOffset
in classExecutionFactory<DataSource,Connection>
-
supportsFunctionsInGroupBy
public boolean supportsFunctionsInGroupBy()
Description copied from class:ExecutionFactory
Support indicates that the connector supports non-column expressions in GROUP BY, such as:
SELECT dayofmonth(theDate), COUNT(*) FROM table GROUP BY dayofmonth(theDate)
- Overrides:
supportsFunctionsInGroupBy
in classExecutionFactory<DataSource,Connection>
-
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
-
supportsCommonTableExpressions
public boolean supportsCommonTableExpressions()
- Overrides:
supportsCommonTableExpressions
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if the WITH clause is supported
-
supportsElementaryOlapOperations
public boolean supportsElementaryOlapOperations()
- Overrides:
supportsElementaryOlapOperations
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if Elementary OLAP operations are supported including window functions and inline window specifications that include simple expressions in partitioning and ordering
-
supportsArrayType
public boolean supportsArrayType()
Description copied from class:ExecutionFactory
The engine uses array types for dependent joins and for array expression.- Overrides:
supportsArrayType
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if an array type is supported.
-
supportsCorrelatedSubqueries
public boolean supportsCorrelatedSubqueries()
Description copied from class:ExecutionFactory
Support indicates connector can accept correlated subqueries wherever subqueries are accepted- Overrides:
supportsCorrelatedSubqueries
in classJDBCExecutionFactory
-
-