Package org.teiid.translator.jdbc.pi
Class PIExecutionFactory
- java.lang.Object
-
- org.teiid.translator.ExecutionFactory<DataSource,Connection>
-
- org.teiid.translator.jdbc.JDBCExecutionFactory
-
- org.teiid.translator.jdbc.pi.PIExecutionFactory
-
@Translator(name="osisoft-pi", description="A translator for OsiSoft PI database") public class PIExecutionFactory 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
static String
PI
-
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 PIExecutionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
getMetadata(MetadataFactory metadataFactory, Connection conn)
Implement to provide metadata to the metadata for use by the engine.MetadataProcessor<Connection>
getMetadataProcessor()
Get a MetadataProcessor for the translator to read the metadata.SQLConversionVisitor
getSQLConversionVisitor()
Create theSQLConversionVisitor
that will perform translation.List<String>
getSupportedFunctions()
Get list of all supported function names.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.void
start()
Initialize the connector with supplied configurationboolean
supportsBatchedUpdates()
Whether the source supportsBatchedUpdates
boolean
supportsBulkUpdate()
Whether the source supports updates with multiple value setsboolean
supportsConvert(int fromType, int toType)
Used for fine grained control of convert/cast pushdown.boolean
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
supportsInsertWithQueryExpression()
boolean
supportsLateralJoin()
boolean
supportsLateralJoinCondition()
boolean
supportsOnlyLateralJoinProcedure()
boolean
supportsProcedureTable()
boolean
supportsRowLimit()
Gets whether the connector can limit the number of rows returned by a query.boolean
supportsSelectWithoutFrom()
List<?>
translate(LanguageObject obj, 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
translateLiteralDate(Date dateValue)
Subclasses should override this method to provide a different sql translation of the literal date 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
useAsInGroupAlias()
Indicates whether group alias should be of the form "...FROM groupA AS X" or "...FROM groupA X".boolean
useSelectLimit()
Returns whether the limit clause is applied to the select clause.-
Methods inherited from class org.teiid.translator.jdbc.JDBCExecutionFactory
addSourceComment, afterInitialConnectionObtained, bindValue, closeConnection, convertObject, createDirectExecution, createMetadataProcessor, createProcedureExecution, createResultSetExecution, createTempTable, createUpdateExecution, executeStoredProcedure, formatDateValue, formatDateValue, getCommentFormat, getConnection, getCreateTemporaryTablePostfix, getCreateTemporaryTableString, getCreateTempTableSQL, getDatabaseCalendar, getDatabaseTimeZone, getDatabaseVersion, getDefaultNullOrder, getDefaultSupportedFunctions, getDialect, getFunctionModifiers, getHibernateDialectClassName, getLateralKeyword, getLikeRegexString, getMaxPreparedInsertBatchSize, getRemovePushdownCharacters, getSetOperationString, getSourceComment, getStructRetrieval, getTemporaryTableName, getTimestampNanoPrecision, getVersion, hasTimeType, 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, supportsAggregatesAvg, supportsAggregatesCount, supportsAggregatesCountStar, supportsAggregatesDistinct, supportsAggregatesMax, supportsAggregatesMin, supportsAggregatesSum, supportsAliasedTable, supportsBooleanExpressions, supportsCompareCriteriaEquals, supportsCompareCriteriaOrdered, supportsCorrelatedSubqueries, supportsDependentJoins, supportsExistsCriteria, supportsFullDependentJoins, supportsGeneratedKeys, supportsGeneratedKeys, supportsGroupBy, supportsHaving, supportsInCriteria, supportsInCriteriaSubquery, supportsIsNullCriteria, supportsLikeCriteria, supportsLikeCriteriaEscapeCharacter, supportsNotCriteria, supportsOrCriteria, supportsOrderByUnrelated, supportsProcedureParameterExpression, supportsQuantifiedCompareCriteriaAll, supportsQuantifiedCompareCriteriaSome, supportsScalarSubqueries, supportsSearchedCaseExpressions, supportsSelectExpression, supportsSelfJoins, supportsSetQueryOrderBy, supportsUnions, tempTableRequiresTransaction, translateCommand, translateGeographyLiteral, translateGeographyParameter, translateGeographySelect, translateGeometryLiteral, translateGeometryParameter, translateGeometrySelect, translateLiteralBinaryType, translateLiteralBoolean, useBindingsForDependentJoin, useBindVariables, useColumnNamesForGeneratedKeys, useCommentsInSourceQuery, useNBindingType, useParensForJoins, useParensForSetQueries, usePreparedStatements, useScientificNotation, usesDatabaseVersion, 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, supportsCommonTableExpressions, supportsCompareCriteriaOrderedExclusive, supportsCorrelatedSubqueryLimit, supportsDirectQueryProcedure, supportsElementaryOlapOperations, supportsExcept, supportsFormatLiteral, supportsFullOuterJoins, supportsGeographyType, supportsGroupByMultipleDistinctAggregates, supportsGroupByRollup, supportsInnerJoins, supportsIntersect, supportsIsDistinctCriteria, supportsLikeRegex, supportsListAgg, supportsMultipleOpenExecutions, supportsNativeQueries, supportsOnlyCorrelatedSubqueries, supportsOnlyFormatLiterals, supportsOnlyLiteralComparison, supportsOnlyRelationshipStyleJoins, supportsOnlySingleTableGroupBy, supportsOnlyTimestampAddLiteral, supportsOrderBy, supportsOrderByNullOrdering, supportsOrderByWithExtendedGrouping, supportsOuterJoins, supportsPartialFiltering, supportsRecursiveCommonTableExpressions, supportsRowOffset, supportsScalarSubqueryProjection, supportsSelectDistinct, supportsSelectExpressionArrayType, supportsSetQueryLimitOffset, supportsSimilarTo, supportsStringAgg, supportsSubqueryCommonTableExpressions, supportsSubqueryInOn, supportsUpsert, supportsWindowDistinctAggregates, supportsWindowFrameClause, supportsWindowFunctionCumeDist, supportsWindowFunctionNthValue, supportsWindowFunctionNtile, supportsWindowFunctionPercentRank, supportsWindowOrderByWithAggregates, useAnsiJoin
-
-
-
-
Field Detail
-
PI
public static String PI
-
convert
protected ConvertModifier convert
-
-
Method Detail
-
start
public void start() throws TranslatorException
Description copied from class:ExecutionFactory
Initialize the connector with supplied configuration- Overrides:
start
in classJDBCExecutionFactory
- Throws:
TranslatorException
-
supportsSelectWithoutFrom
public boolean supportsSelectWithoutFrom()
- Overrides:
supportsSelectWithoutFrom
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if the translator support SELECT without a FROM 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
-
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>
-
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>
-
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
-
supportsBatchedUpdates
public boolean supportsBatchedUpdates()
Description copied from class:ExecutionFactory
Whether the source supportsBatchedUpdates
- Overrides:
supportsBatchedUpdates
in classJDBCExecutionFactory
-
supportsBulkUpdate
public boolean supportsBulkUpdate()
Description copied from class:ExecutionFactory
Whether the source supports updates with multiple value sets- Overrides:
supportsBulkUpdate
in classJDBCExecutionFactory
-
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
-
useSelectLimit
public boolean useSelectLimit()
Description copied from class:JDBCExecutionFactory
Returns whether the limit clause is applied to the select clause.- Overrides:
useSelectLimit
in classJDBCExecutionFactory
- Returns:
- true if the limit clause is part of the select
-
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)
Description copied from class:JDBCExecutionFactory
Subclasses should override this method to provide a different sql translation of the literal date value. By default, a date literal is represented as:{d '2002-12-31'}
- 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
-
getMetadata
public void getMetadata(MetadataFactory metadataFactory, Connection conn) throws TranslatorException
Description copied from class:ExecutionFactory
Implement to provide metadata to the metadata for use by the engine. This is the primary method of creating metadata for dynamic VDBs.- Overrides:
getMetadata
in classJDBCExecutionFactory
conn
- may be null if the source is not required- Throws:
TranslatorException
- to indicate a recoverable error, otherwise a RuntimeException- See Also:
ExecutionFactory.isSourceRequiredForMetadata()
-
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:
-
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
-
translate
public List<?> translate(LanguageObject obj, 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. Override with care.- Overrides:
translate
in classJDBCExecutionFactory
- Returns:
- list of translated parts
-
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
-
supportsLateralJoin
public boolean supportsLateralJoin()
- Overrides:
supportsLateralJoin
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if the source supports lateral join
-
supportsLateralJoinCondition
public boolean supportsLateralJoinCondition()
- Overrides:
supportsLateralJoinCondition
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if the source supports lateral join conditions
-
supportsOnlyLateralJoinProcedure
public boolean supportsOnlyLateralJoinProcedure()
- Overrides:
supportsOnlyLateralJoinProcedure
in classExecutionFactory<DataSource,Connection>
- Returns:
- true if lateral joins are restricted to only procedures / table valued functions
-
supportsProcedureTable
public boolean supportsProcedureTable()
- Overrides:
supportsProcedureTable
in classExecutionFactory<DataSource,Connection>
- 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
-
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
-
-