Package org.teiid.translator.couchbase
Class CouchbaseExecutionFactory
- java.lang.Object
-
- org.teiid.translator.ExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
- org.teiid.translator.couchbase.CouchbaseExecutionFactory
-
@Translator(name="couchbase", description="Couchbase Translator, reads and writes the data to Couchbase") public class CouchbaseExecutionFactory extends ExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
-
Nested Class Summary
-
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 Map<String,FunctionModifier>
functionModifiers
-
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 CouchbaseExecutionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcedureExecution
createDirectExecution(List<Argument> arguments, Command command, ExecutionContext executionContext, RuntimeMetadata metadata, CouchbaseConnection connection)
ProcedureExecution
createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, CouchbaseConnection connection)
ResultSetExecution
createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, CouchbaseConnection connection)
UpdateExecution
createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, CouchbaseConnection connection)
ExecutionFactory.NullOrder
getDefaultNullOrder()
Returns the default null orderingList<String>
getDefaultSupportedFunctions()
Map<String,FunctionModifier>
getFunctionModifiers()
int
getMaxBulkInsertSize()
MetadataProcessor<CouchbaseConnection>
getMetadataProcessor()
Get a MetadataProcessor for the translator to read the metadata.N1QLUpdateVisitor
getN1QLUpdateVisitor()
N1QLVisitor
getN1QLVisitor()
List<String>
getSupportedFunctions()
Get list of all supported function names.boolean
isUseDouble()
void
registerFunctionModifier(String name, FunctionModifier modifier)
Object
retrieveValue(Class<?> columnType, Object value)
boolean
returnsSingleUpdateCount()
True if only a single value is returned for the update count.void
setMaxBulkInsertSize(int maxBulkInsertSize)
void
setUseDouble(boolean useDouble)
void
setValue(com.couchbase.client.java.document.json.JsonArray array, Class<?> type, Object attrValue)
void
setValue(com.couchbase.client.java.document.json.JsonObject json, String attr, Class<?> type, Object attrValue)
void
start()
Initialize the connector with supplied configurationboolean
supportsAggregatesAvg()
Support indicates connector can accept the AVG aggregate functionboolean
supportsAggregatesCount()
Support indicates connector can accept the COUNT aggregate functionboolean
supportsAggregatesCountStar()
Support indicates connector can accept the COUNT(*) aggregate functionboolean
supportsAggregatesDistinct()
Support indicates connector can accept DISTINCT within aggregate functionsboolean
supportsAggregatesMax()
Support indicates connector can accept the MAX aggregate functionboolean
supportsAggregatesMin()
Support indicates connector can accept the MIN aggregate functionboolean
supportsAggregatesSum()
Support indicates connector can accept the SUM aggregate functionboolean
supportsArrayAgg()
boolean
supportsBulkUpdate()
Whether the source supports updates with multiple value setsboolean
supportsCompareCriteriaEquals()
Support indicates connector accepts criteria of form (element = constant)boolean
supportsConvert(int fromType, int toType)
Used for fine grained control of convert/cast pushdown.boolean
supportsExcept()
Support indicates that the connector supports the EXCEPT of two queries.boolean
supportsGroupBy()
Whether the source supports an explicit GROUP BY clauseboolean
supportsHaving()
Whether the source supports the HAVING clauseboolean
supportsIntersect()
Support indicates that the connector supports the INTERSECT of two queries.boolean
supportsOnlyLiteralComparison()
boolean
supportsOrderBy()
Support indicates connector accepts ORDER BY clause, including multiple elements and ascending and descending sorts.boolean
supportsOrderByNullOrdering()
Returns whether the database supports explicit null ordering.boolean
supportsOrderByUnrelated()
Support indicates connector accepts ORDER BY clause with columns not from the selectboolean
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
supportsSearchedCaseExpressions()
Support indicates connector can accept queries with searched CASE WHEN criteria ...boolean
supportsSelectExpression()
Support indicates connector can accept expressions other than element symbols in the SELECT clause.boolean
supportsSelectWithoutFrom()
boolean
supportsUnions()
Support indicates that the connector supports the UNION of two queries.boolean
supportsUpsert()
-
Methods inherited from class org.teiid.translator.ExecutionFactory
addPushDownFunction, areLobsUsableAfterClose, closeConnection, createExecution, getCacheDirective, getCollationLocale, getConnection, getConnection, getDirectQueryProcedureName, getExcludedCommonTableExpressionName, getInstance, getLanguageFactory, getMaxDependentInPredicates, getMaxFromGroups, getMaxInCriteriaSize, getMaxProjectedColumns, getMetadata, getNativeQueryProcedureName, getPushDownFunctions, getRequiredLikeEscape, getSupportedJoinCriteria, getTransactionSupport, getTypeFacility, initCapabilities, isCopyLobs, isForkable, isImmutable, isSourceRequired, isSourceRequiredForCapabilities, isSourceRequiredForMetadata, isThreadBound, requiresCriteria, setCollationLocale, setCopyLobs, setDirectQueryProcedureName, setExcludedCommonTableExpressionName, setImmutable, setMaxDependentInPredicates, setMaxInCriteriaSize, setNativeQueryProcedureName, setRequiresCriteria, setSourceRequired, setSourceRequiredForMetadata, setSupportedJoinCriteria, setSupportsDirectQueryProcedure, setSupportsFullOuterJoins, setSupportsInnerJoins, setSupportsNativeQueries, setSupportsOrderBy, setSupportsOuterJoins, setSupportsSelectDistinct, setThreadBound, setTransactionSupport, supportsAdvancedOlapOperations, supportsAggregatesCountBig, supportsAggregatesEnhancedNumeric, supportsAliasedTable, supportsArrayType, supportsBatchedUpdates, supportsCommonTableExpressions, supportsCompareCriteriaOrdered, supportsCompareCriteriaOrderedExclusive, supportsCorrelatedSubqueries, supportsCorrelatedSubqueryLimit, supportsDependentJoins, supportsDirectQueryProcedure, supportsElementaryOlapOperations, supportsExistsCriteria, supportsFormatLiteral, supportsFullDependentJoins, supportsFullOuterJoins, supportsFunctionsInGroupBy, supportsGeographyType, supportsGroupByMultipleDistinctAggregates, supportsGroupByRollup, supportsInCriteria, supportsInCriteriaSubquery, supportsInlineViews, supportsInnerJoins, supportsInsertWithQueryExpression, supportsIsDistinctCriteria, supportsIsNullCriteria, supportsLateralJoin, supportsLateralJoinCondition, supportsLikeCriteria, supportsLikeCriteriaEscapeCharacter, supportsLikeRegex, supportsListAgg, supportsMultipleOpenExecutions, supportsNativeQueries, supportsNotCriteria, supportsOnlyCorrelatedSubqueries, supportsOnlyFormatLiterals, supportsOnlyLateralJoinProcedure, supportsOnlyRelationshipStyleJoins, supportsOnlySingleTableGroupBy, supportsOnlyTimestampAddLiteral, supportsOrCriteria, supportsOrderByWithExtendedGrouping, supportsOuterJoins, supportsPartialFiltering, supportsProcedureParameterExpression, supportsProcedureTable, supportsQuantifiedCompareCriteriaAll, supportsQuantifiedCompareCriteriaSome, supportsRecursiveCommonTableExpressions, supportsScalarSubqueries, supportsScalarSubqueryProjection, supportsSelectDistinct, supportsSelectExpressionArrayType, supportsSelfJoins, supportsSetQueryLimitOffset, supportsSetQueryOrderBy, supportsSimilarTo, supportsStringAgg, supportsSubqueryCommonTableExpressions, supportsSubqueryInOn, supportsWindowDistinctAggregates, supportsWindowFrameClause, supportsWindowFunctionCumeDist, supportsWindowFunctionNthValue, supportsWindowFunctionNtile, supportsWindowFunctionPercentRank, supportsWindowOrderByWithAggregates, useAnsiJoin, useBindingsForDependentJoin
-
-
-
-
Field Detail
-
functionModifiers
protected Map<String,FunctionModifier> functionModifiers
-
-
Method Detail
-
start
public void start() throws TranslatorException
Description copied from class:ExecutionFactory
Initialize the connector with supplied configuration- Overrides:
start
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- 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 classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- 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.
-
registerFunctionModifier
public void registerFunctionModifier(String name, FunctionModifier modifier)
-
getFunctionModifiers
public Map<String,FunctionModifier> getFunctionModifiers()
-
createResultSetExecution
public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, CouchbaseConnection connection) throws TranslatorException
- Overrides:
createResultSetExecution
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Throws:
TranslatorException
-
createProcedureExecution
public ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, CouchbaseConnection connection) throws TranslatorException
- Overrides:
createProcedureExecution
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Throws:
TranslatorException
-
createUpdateExecution
public UpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, CouchbaseConnection connection) throws TranslatorException
- Overrides:
createUpdateExecution
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Throws:
TranslatorException
-
createDirectExecution
public ProcedureExecution createDirectExecution(List<Argument> arguments, Command command, ExecutionContext executionContext, RuntimeMetadata metadata, CouchbaseConnection connection) throws TranslatorException
- Overrides:
createDirectExecution
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Throws:
TranslatorException
-
getMetadataProcessor
public MetadataProcessor<CouchbaseConnection> 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 classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Returns:
-
supportsAggregatesSum
public boolean supportsAggregatesSum()
Description copied from class:ExecutionFactory
Support indicates connector can accept the SUM aggregate function- Overrides:
supportsAggregatesSum
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
supportsAggregatesAvg
public boolean supportsAggregatesAvg()
Description copied from class:ExecutionFactory
Support indicates connector can accept the AVG aggregate function- Overrides:
supportsAggregatesAvg
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
supportsAggregatesMin
public boolean supportsAggregatesMin()
Description copied from class:ExecutionFactory
Support indicates connector can accept the MIN aggregate function- Overrides:
supportsAggregatesMin
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
supportsAggregatesMax
public boolean supportsAggregatesMax()
Description copied from class:ExecutionFactory
Support indicates connector can accept the MAX aggregate function- Overrides:
supportsAggregatesMax
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
supportsAggregatesCount
public boolean supportsAggregatesCount()
Description copied from class:ExecutionFactory
Support indicates connector can accept the COUNT aggregate function- Overrides:
supportsAggregatesCount
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
supportsAggregatesCountStar
public boolean supportsAggregatesCountStar()
Description copied from class:ExecutionFactory
Support indicates connector can accept the COUNT(*) aggregate function- Overrides:
supportsAggregatesCountStar
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
supportsAggregatesDistinct
public boolean supportsAggregatesDistinct()
Description copied from class:ExecutionFactory
Support indicates connector can accept DISTINCT within aggregate functions- Overrides:
supportsAggregatesDistinct
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
supportsArrayAgg
public boolean supportsArrayAgg()
- Overrides:
supportsArrayAgg
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Returns:
- true if array_agg is supported
-
supportsSelectExpression
public boolean supportsSelectExpression()
Description copied from class:ExecutionFactory
Support indicates connector can accept expressions other than element symbols in the SELECT clause. Specific supports for the expression type are still checked.- Overrides:
supportsSelectExpression
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
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<ConnectionFactory,CouchbaseConnection>
-
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<ConnectionFactory,CouchbaseConnection>
-
supportsOrderBy
public boolean supportsOrderBy()
Description copied from class:ExecutionFactory
Support indicates connector accepts ORDER BY clause, including multiple elements and ascending and descending sorts.- Overrides:
supportsOrderBy
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
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 classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Returns:
-
supportsOrderByNullOrdering
public boolean supportsOrderByNullOrdering()
Description copied from class:ExecutionFactory
Returns whether the database supports explicit null ordering.- Overrides:
supportsOrderByNullOrdering
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Returns:
- true if nulls first/last can be specified
-
supportsGroupBy
public boolean supportsGroupBy()
Description copied from class:ExecutionFactory
Whether the source supports an explicit GROUP BY clause- Overrides:
supportsGroupBy
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
supportsHaving
public boolean supportsHaving()
Description copied from class:ExecutionFactory
Whether the source supports the HAVING clause- Overrides:
supportsHaving
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
supportsUnions
public boolean supportsUnions()
Description copied from class:ExecutionFactory
Support indicates that the connector supports the UNION of two queries.- Overrides:
supportsUnions
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
supportsIntersect
public boolean supportsIntersect()
Description copied from class:ExecutionFactory
Support indicates that the connector supports the INTERSECT of two queries.- Overrides:
supportsIntersect
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
supportsExcept
public boolean supportsExcept()
Description copied from class:ExecutionFactory
Support indicates that the connector supports the EXCEPT of two queries.- Overrides:
supportsExcept
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
supportsSelectWithoutFrom
public boolean supportsSelectWithoutFrom()
- Overrides:
supportsSelectWithoutFrom
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Returns:
- true if the translator support SELECT without a FROM clause
-
supportsCompareCriteriaEquals
public boolean supportsCompareCriteriaEquals()
Description copied from class:ExecutionFactory
Support indicates connector accepts criteria of form (element = constant)- Overrides:
supportsCompareCriteriaEquals
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
getN1QLVisitor
public N1QLVisitor getN1QLVisitor()
-
getN1QLUpdateVisitor
public N1QLUpdateVisitor getN1QLUpdateVisitor()
-
retrieveValue
public Object retrieveValue(Class<?> columnType, Object value) throws TranslatorException
- Throws:
TranslatorException
-
setValue
public void setValue(com.couchbase.client.java.document.json.JsonObject json, String attr, Class<?> type, Object attrValue)
-
setValue
public void setValue(com.couchbase.client.java.document.json.JsonArray array, Class<?> type, Object attrValue)
-
supportsOnlyLiteralComparison
public boolean supportsOnlyLiteralComparison()
- Overrides:
supportsOnlyLiteralComparison
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Returns:
- true if only Literal comparisons (equality, ordered, like, etc.) are supported for non-join conditions.
-
supportsUpsert
public boolean supportsUpsert()
- Overrides:
supportsUpsert
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Returns:
- true if the source supports upsert
-
supportsBulkUpdate
public boolean supportsBulkUpdate()
Description copied from class:ExecutionFactory
Whether the source supports updates with multiple value sets- Overrides:
supportsBulkUpdate
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
getMaxBulkInsertSize
@TranslatorProperty(display="Max Bulk Insert Document Size", description="The max size of documents in a bulk insert. Default 100.", advanced=true) public int getMaxBulkInsertSize()
-
setMaxBulkInsertSize
public void setMaxBulkInsertSize(int maxBulkInsertSize)
-
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<ConnectionFactory,CouchbaseConnection>
- Returns:
- true if the given conversion is supported.
- See Also:
TypeFacility.RUNTIME_CODES
,TypeFacility.RUNTIME_CODES
-
getDefaultNullOrder
public ExecutionFactory.NullOrder getDefaultNullOrder()
Description copied from class:ExecutionFactory
Returns the default null ordering- Overrides:
getDefaultNullOrder
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Returns:
- the
ExecutionFactory.NullOrder
-
supportsSearchedCaseExpressions
public boolean supportsSearchedCaseExpressions()
Description copied from class:ExecutionFactory
Support indicates connector can accept queries with searched CASE WHEN criteria ... END- Overrides:
supportsSearchedCaseExpressions
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
-
returnsSingleUpdateCount
public boolean returnsSingleUpdateCount()
Description copied from class:ExecutionFactory
True if only a single value is returned for the update count. This overrides the default expectation of an update count array for bulk/batch commands. It is expected that every command is successful.- Overrides:
returnsSingleUpdateCount
in classExecutionFactory<ConnectionFactory,CouchbaseConnection>
- Returns:
-
isUseDouble
@TranslatorProperty(display="Use Double", description="Use double rather than allowing for more precise types, such as long, bigdecimal, and biginteger", advanced=true) public boolean isUseDouble()
-
setUseDouble
public void setUseDouble(boolean useDouble)
-
-