public void addWarning(Exception warning) { if (warning == null) { return; } synchronized (this.globalState) { if (globalState.warnings == null) { globalState.warnings = new ArrayList<Exception>(1); } globalState.warnings.add(warning); if (globalState.warnings.size() > MAX_WARNINGS) { globalState.warnings.remove(0); } } if (!this.getOptions().isSanitizeMessages() || LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) { LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31105, warning.getMessage())); } }
public void addWarning(Exception warning) { if (warning == null) { return; } synchronized (this.globalState) { if (globalState.warnings == null) { globalState.warnings = new ArrayList<Exception>(1); } globalState.warnings.add(warning); if (globalState.warnings.size() > MAX_WARNINGS) { globalState.warnings.remove(0); } } if (!this.getOptions().isSanitizeMessages() || LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) { LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31105, warning.getMessage())); } }
public void addWarning(Exception warning) { if (warning == null) { return; } synchronized (this.globalState) { if (globalState.warnings == null) { globalState.warnings = new ArrayList<Exception>(1); } globalState.warnings.add(warning); } if (!this.getOptions().isSanitizeMessages() || LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) { LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31105, warning.getMessage())); } }
NullOrder teiidNullOrder = commandContext.getOptions().getDefaultNullOrder(); if (!supportsNullOrdering || (sourceNullOrder != teiidNullOrder && commandContext.getOptions().isPushdownDefaultNullOrder())) { correctNullOrdering(result, supportsNullOrdering, sourceNullOrder, commandContext.getOptions().getDefaultNullOrder());
NullOrder teiidNullOrder = commandContext.getOptions().getDefaultNullOrder(); if (!supportsNullOrdering || (sourceNullOrder != teiidNullOrder && commandContext.getOptions().isPushdownDefaultNullOrder())) { correctNullOrdering(result, supportsNullOrdering, sourceNullOrder, commandContext.getOptions().getDefaultNullOrder());
private TranslatorException handleError(Throwable t) { if (t instanceof DataNotAvailableException) { throw (DataNotAvailableException)t; } if (t instanceof RuntimeException && t.getCause() != null) { t = t.getCause(); } String msg = QueryPlugin.Util.getString("ConnectorWorker.process_failed", this.id); //$NON-NLS-1$ if (isCancelled.get()) { LogManager.logDetail(LogConstants.CTX_CONNECTOR, msg); } else { manager.logSRCCommand(this, this.requestMsg, this.securityContext, Event.ERROR, null, null); Throwable toLog = t; if (this.requestMsg.getCommandContext().getOptions().isSanitizeMessages() && !LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.DETAIL)) { toLog = ExceptionUtil.sanitize(toLog, true); } if (toLog instanceof TranslatorException || toLog instanceof TeiidProcessingException) { LogManager.logWarning(LogConstants.CTX_CONNECTOR, toLog, msg); } else { LogManager.logError(LogConstants.CTX_CONNECTOR, toLog, msg); } } if (t instanceof TranslatorException) { return (TranslatorException)t; } return new TranslatorException(t); }
private TranslatorException handleError(Throwable t) { if (t instanceof DataNotAvailableException) { throw (DataNotAvailableException)t; } if (t instanceof RuntimeException && t.getCause() != null) { t = t.getCause(); } String msg = QueryPlugin.Util.getString("ConnectorWorker.process_failed", this.id); //$NON-NLS-1$ if (isCancelled.get()) { LogManager.logDetail(LogConstants.CTX_CONNECTOR, msg); } else { manager.logSRCCommand(this, this.requestMsg, this.securityContext, Event.ERROR, null, null); Throwable toLog = t; if (this.requestMsg.getCommandContext().getOptions().isSanitizeMessages() && !LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.DETAIL)) { toLog = ExceptionUtil.sanitize(toLog, true); } if (toLog instanceof TranslatorException || toLog instanceof TeiidProcessingException) { LogManager.logWarning(LogConstants.CTX_CONNECTOR, toLog, msg); } else { LogManager.logError(LogConstants.CTX_CONNECTOR, toLog, msg); } } if (t instanceof TranslatorException) { return (TranslatorException)t; } return new TranslatorException(t); }
private TranslatorException handleError(Throwable t) { if (t instanceof DataNotAvailableException) { throw (DataNotAvailableException)t; } if (t instanceof RuntimeException && t.getCause() != null) { t = t.getCause(); } String msg = QueryPlugin.Util.getString("ConnectorWorker.process_failed", this.id); //$NON-NLS-1$ if (isCancelled.get()) { LogManager.logDetail(LogConstants.CTX_CONNECTOR, msg); } else { manager.logSRCCommand(this.requestMsg, this.securityContext, Event.ERROR, null, null); Throwable toLog = t; if (this.requestMsg.getCommandContext().getOptions().isSanitizeMessages() && !LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.DETAIL)) { toLog = ExceptionUtil.sanitize(toLog, true); } if (toLog instanceof TranslatorException || toLog instanceof TeiidProcessingException) { LogManager.logWarning(LogConstants.CTX_CONNECTOR, toLog, msg); } else { LogManager.logError(LogConstants.CTX_CONNECTOR, toLog, msg); } } if (t instanceof TranslatorException) { return (TranslatorException)t; } return new TranslatorException(t); }
item.setNullOrdering(null); } else if (userOrdering && supportsNullOrdering && defaultNullOrder != context.getOptions().getDefaultNullOrder() && context.getOptions().isPushdownDefaultNullOrder()) { if (context.getOptions().getDefaultNullOrder() == NullOrder.FIRST || context.getOptions().getDefaultNullOrder() == NullOrder.LOW) { if (defaultNullOrder != NullOrder.FIRST && defaultNullOrder != NullOrder.LOW) { item.setNullOrdering(NullOrdering.FIRST); if (context.getOptions().getDefaultNullOrder() == NullOrder.LAST || context.getOptions().getDefaultNullOrder() == NullOrder.LOW) { if (defaultNullOrder != NullOrder.LAST && defaultNullOrder != NullOrder.LOW) { item.setNullOrdering(NullOrdering.LAST);
PlannedResult plannedResult = rmc.findSubquery(crits.next(), context!=null?context.getOptions().isSubqueryUnnestDefault():false); if (plannedResult.not || plannedResult.query == null || plannedResult.query.getProcessorPlan() != null || plannedResult.query.getWith() != null) {
PlannedResult plannedResult = rmc.findSubquery(crits.next(), context!=null?context.getOptions().isSubqueryUnnestDefault():false); if (plannedResult.not || plannedResult.query == null || plannedResult.query.getProcessorPlan() != null || plannedResult.query.getWith() != null) {
PlannedResult plannedResult = rmc.findSubquery(crits.next(), context!=null?context.getOptions().isSubqueryUnnestDefault():false); if (plannedResult.not || plannedResult.query == null || plannedResult.query.getProcessorPlan() != null || plannedResult.query.getWith() != null) {
@Override public void visit(OrderBy obj) { String collation = null; try { collation = (String) CapabilitiesUtil.getProperty(Capability.COLLATION_LOCALE, modelID, metadata, capFinder); } catch(QueryMetadataException e) { handleException(new TeiidComponentException(e)); } catch(TeiidComponentException e) { handleException(e); } CommandContext commandContext = CommandContext.getThreadLocalContext(); if (collation != null && commandContext != null && commandContext.getOptions().isRequireTeiidCollation() && !collation.equals(DataTypeManager.COLLATION_LOCALE)) { for (OrderByItem symbol : obj.getOrderByItems()) { if (symbol.getSymbol().getType() == DataTypeManager.DefaultDataClasses.STRING || symbol.getSymbol().getType() == DataTypeManager.DefaultDataClasses.CLOB || symbol.getSymbol().getType() == DataTypeManager.DefaultDataClasses.CHAR) { //we require the collation to match markInvalid(obj, "source is not using the same collation as Teiid"); //$NON-NLS-1$ break; } } } }
/** * Same as above but using the system/option property * @throws TeiidComponentException * @throws TeiidProcessingException */ @Test public void testMergeJoinOrderNotPushed1() throws Exception { String sql = "select bqt1.smalla.intkey, bqt2.smalla.intkey " + "from bqt1.smalla inner join bqt2.smalla on (bqt2.smalla.stringkey = bqt1.smalla.stringkey)"; //$NON-NLS-1$ BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities(); bsc.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true); CommandContext cc = TestProcessor.createCommandContext(); cc.getOptions().setAssumeMatchingCollation(false); // Plan query ProcessorPlan plan = TestProcessor.helpGetPlan(TestOptimizer.helpGetCommand(sql, RealMetadataFactory.exampleBQTCached()), RealMetadataFactory.exampleBQTCached(), new DefaultCapabilitiesFinder(bsc), cc); HardcodedDataManager hdm = new HardcodedDataManager(); hdm.addData("SELECT g_0.StringKey, g_0.IntKey FROM BQT1.SmallA AS g_0", Arrays.asList("b", 1), Arrays.asList("a", 3)); hdm.addData("SELECT g_0.StringKey, g_0.IntKey FROM BQT2.SmallA AS g_0", Arrays.asList("c", 1), Arrays.asList("a", 2)); TestProcessor.helpProcess(plan, hdm, new List<?>[] {Arrays.asList(3, 2)}); }
@Override public void visit(OrderBy obj) { String collation = null; try { collation = (String) CapabilitiesUtil.getProperty(Capability.COLLATION_LOCALE, modelID, metadata, capFinder); } catch(QueryMetadataException e) { handleException(new TeiidComponentException(e)); } catch(TeiidComponentException e) { handleException(e); } CommandContext commandContext = CommandContext.getThreadLocalContext(); if (collation != null && commandContext != null && commandContext.getOptions().isRequireTeiidCollation() && !collation.equals(DataTypeManager.COLLATION_LOCALE)) { for (OrderByItem symbol : obj.getOrderByItems()) { if (symbol.getSymbol().getType() == DataTypeManager.DefaultDataClasses.STRING || symbol.getSymbol().getType() == DataTypeManager.DefaultDataClasses.CLOB || symbol.getSymbol().getType() == DataTypeManager.DefaultDataClasses.CHAR) { //we require the collation to match markInvalid(obj, "source is not using the same collation as Teiid"); //$NON-NLS-1$ break; } } } }
@Override public void visit(OrderBy obj) { String collation = null; try { collation = (String) CapabilitiesUtil.getProperty(Capability.COLLATION_LOCALE, modelID, metadata, capFinder); } catch(QueryMetadataException e) { handleException(new TeiidComponentException(e)); } catch(TeiidComponentException e) { handleException(e); } CommandContext commandContext = CommandContext.getThreadLocalContext(); if (collation != null && commandContext != null && commandContext.getOptions().isRequireTeiidCollation() && !collation.equals(DataTypeManager.COLLATION_LOCALE)) { for (OrderByItem symbol : obj.getOrderByItems()) { if (symbol.getSymbol().getType() == DataTypeManager.DefaultDataClasses.STRING || symbol.getSymbol().getType() == DataTypeManager.DefaultDataClasses.CLOB || symbol.getSymbol().getType() == DataTypeManager.DefaultDataClasses.CHAR) { //we require the collation to match markInvalid(obj, "source is not using the same collation as Teiid"); //$NON-NLS-1$ break; } } } }
private ProcessorPlan process(String sql, List<?>[] expected, boolean relativeXPath) throws Exception { CommandContext cc = createCommandContext(); cc.getOptions().relativeXPath(relativeXPath); CommandContext.pushThreadLocalContext(cc); try { ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached(), new DefaultCapabilitiesFinder(), cc); helpProcess(plan, cc, dataManager, expected); return plan; } finally { CommandContext.popThreadLocalContext(); } }
return false; } else if (!context.getOptions().isAssumeMatchingCollation()) { return false;
CommandContext cc = CommandContext.getThreadLocalContext(); if (cc != null) { saxonXQueryExpression.relativePaths = cc.getOptions().isRelativeXPath();
CommandContext cc = CommandContext.getThreadLocalContext(); if (cc != null) { saxonXQueryExpression.relativePaths = cc.getOptions().isRelativeXPath();