Bug 780317 (SOA-2723) - MALFORMED Query when trying to execute a query with OUTER JOINs which only contains elements from JOINed source
Summary: MALFORMED Query when trying to execute a query with OUTER JOINs which only co...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: SOA-2723
Product: JBoss Enterprise SOA Platform 5
Classification: JBoss
Component: EDS
Version: 5.1.0.ER5
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 5.1.0.CR1
Assignee: Steven Hawkins
QA Contact:
URL: http://jira.jboss.org/jira/browse/SOA...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-01 16:42 UTC by Wanja Pernath
Modified: 2011-02-08 19:41 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
EAP 5.1 with CXF and Teiid 7.1.1
Last Closed: 2011-02-08 19:41:40 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SOA-2723 0 None None None Never

Description Wanja Pernath 2011-01-01 16:42:26 UTC
Workaround: Workaround Exists
Workaround Description: There's a workaround where you just have to provide a dummy element in the SELECT clause:


select PrimaryBusinessUnit, sum(oli.totalPrice), accountId
from general.salesforce.Opportunity o left outer join general.salesforce.OpportunityLineItem oli ON oli.OpportunityId = o.id,
     general.salesforce.PricebookEntry pbe, general.salesforce.Product2 p
where 	(PricebookEntryId = pbe.Id) AND (p.Id = Product2Id)
and   isClosed=true
and   isWon = true
and   CloseDate > '2008-03-01'
and    accountId = '00130000009SwiLAAS'
group by PrimaryBusinessUnit, accountId


project_key: SOA

If you're executing a query like this:


select PrimaryBusinessUnit, sum(oli.totalPrice)
from general.salesforce.Opportunity o left outer join general.salesforce.OpportunityLineItem oli ON oli.OpportunityId = o.id,
     general.salesforce.PricebookEntry pbe, general.salesforce.Product2 p
where 	(PricebookEntryId = pbe.Id) AND (p.Id = Product2Id)
and   isClosed=true
and   isWon = true
and   CloseDate > '2008-03-01'
and    accountId = '00130000009SwiLAAS'
group by PrimaryBusinessUnit


you end up with a MALFORMED_QUERY exception.


2010-12-30 02:32:07,946 DEBUG [org.teiid.CONNECTOR] (Worker82_QueryProcessorQueue1867) iQQ1QVCn8ndT.0.6.153 Create State
2010-12-30 02:32:07,946 DEBUG [org.teiid.CONNECTOR] (Worker84_QueryProcessorQueue1868) iQQ1QVCn8ndT.0.6.153 Processing NEW request: SELECT sfdc.salesforce.OpportunityLineItem.PricebookEntryId, sfdc.salesforce.OpportunityLineItem.TotalPrice FROM sfdc.salesforce.Opportunity LEFT OUTER JOIN sfdc.salesforce.OpportunityLineItem ON sfdc.salesforce.OpportunityLineItem.OpportunityId = sfdc.salesforce.Opportunity.Id WHERE (sfdc.salesforce.Opportunity.StageName <> 'Closed Lost') AND (sfdc.salesforce.Opportunity.ForecastCategory <> 'Omitted') AND (sfdc.salesforce.Opportunity.OpportunityType__c <> 'REBOOK') AND (sfdc.salesforce.Opportunity.IsClosed = TRUE) AND (sfdc.salesforce.Opportunity.IsWon = TRUE) AND (sfdc.salesforce.Opportunity.CloseDate > {d'2008-03-01'}) AND (sfdc.salesforce.Opportunity.AccountId = '00130000009SwiLAAS')
2010-12-30 02:32:07,946 DEBUG [org.teiid.CONNECTOR] (Worker84_QueryProcessorQueue1868) iQQ1QVCn8ndT.0.6.153 Obtained execution
2010-12-30 02:32:07,946 DEBUG [org.teiid.CONNECTOR] (Worker84_QueryProcessorQueue1868) sfdc.iQQ1QVCn8ndT.iQQ1QVCn8ndT.0.6:  Incoming Query: SELECT OpportunityLineItem.PricebookEntryId, OpportunityLineItem.TotalPrice FROM Opportunity LEFT OUTER JOIN OpportunityLineItem ON OpportunityLineItem.OpportunityId = Opportunity.Id WHERE Opportunity.StageName <> 'Closed Lost' AND Opportunity.ForecastCategory <> 'Omitted' AND Opportunity.OpportunityType__c <> 'REBOOK' AND Opportunity.IsClosed = TRUE AND Opportunity.IsWon = TRUE AND Opportunity.CloseDate > {d '2008-03-01'} AND Opportunity.AccountId = '00130000009SwiLAAS'
2010-12-30 02:32:07,947 DEBUG [org.teiid.CONNECTOR] (Worker84_QueryProcessorQueue1868) sfdc.iQQ1QVCn8ndT.iQQ1QVCn8ndT.0.6:  Executing Query: SELECT , (SELECT OpportunityLineItem.PricebookEntryId, OpportunityLineItem.TotalPrice FROM OpportunityLineItems) FROM Opportunity WHERE (Opportunity.StageName != 'Closed Lost') AND ((Opportunity.ForecastCategory != 'Omitted') AND ((Opportunity.OpportunityType__c != 'REBOOK') AND ((Opportunity.IsClosed = true) AND ((Opportunity.IsWon = true) AND ((Opportunity.CloseDate > 2008-03-01) AND (Opportunity.AccountId = '00130000009SwiLAAS'))))))
2010-12-30 02:32:08,434 WARN  [org.teiid.CONNECTOR] (Worker84_QueryProcessorQueue1868) Connector worker process failed for atomic-request=iQQ1QVCn8ndT.0.6.153
[TranslatorException]com.sforce.soap.partner.MalformedQueryFault: MALFORMED_QUERY: 
SELECT , (SELECT OpportunityLineItem.PricebookEntryId
      ^
ERROR at Row:1:Column:7
unexpected token: ','
1 [ResourceException]com.sforce.soap.partner.MalformedQueryFault: MALFORMED_QUERY: 
SELECT , (SELECT OpportunityLineItem.PricebookEntryId
      ^
ERROR at Row:1:Column:7
unexpected token: ','
2 [MalformedQueryFault]MALFORMED_QUERY: 
SELECT , (SELECT OpportunityLineItem.PricebookEntryId
      ^
ERROR at Row:1:Column:7
unexpected token: ','
	at org.teiid.translator.salesforce.execution.QueryExecutionImpl.execute(QueryExecutionImpl.java:149)
	at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:263)
	at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:281)
	at org.teiid.dqp.internal.process.DataTierTupleSource.access$0(DataTierTupleSource.java:274)
	at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:123)
	at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:1)
	at org.teiid.dqp.internal.process.DQPCore$FutureWork.run(DQPCore.java:108)
	at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:188)
	at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:116)
	at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:290)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Caused by: javax.resource.ResourceException: com.sforce.soap.partner.MalformedQueryFault: MALFORMED_QUERY: 
SELECT , (SELECT OpportunityLineItem.PricebookEntryId
      ^
ERROR at Row:1:Column:7
unexpected token: ','
	at org.teiid.resource.adapter.salesforce.SalesforceConnectionImpl.query(SalesforceConnectionImpl.java:176)
	at org.teiid.translator.salesforce.execution.QueryExecutionImpl.execute(QueryExecutionImpl.java:135)
	... 12 more
Caused by: com.sforce.soap.partner.MalformedQueryFault: MALFORMED_QUERY: 
SELECT , (SELECT OpportunityLineItem.PricebookEntryId
      ^
ERROR at Row:1:Column:7
unexpected token: ','
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:131)
	at $Proxy169.query(Unknown Source)
	at org.teiid.resource.adapter.salesforce.SalesforceConnectionImpl.query(SalesforceConnectionImpl.java:171)
	... 13 more
2010-12-30 02:32:08,436 DEBUG [org.teiid.CONNECTOR] (Worker84_QueryProcessorQueue1870) iQQ1QVCn8ndT.0.6.153 Processing Close : SELECT sfdc.salesforce.OpportunityLineItem.PricebookEntryId, sfdc.salesforce.OpportunityLineItem.TotalPrice FROM sfdc.salesforce.Opportunity LEFT OUTER JOIN sfdc.salesforce.OpportunityLineItem ON sfdc.salesforce.OpportunityLineItem.OpportunityId = sfdc.salesforce.Opportunity.Id WHERE (sfdc.salesforce.Opportunity.StageName <> 'Closed Lost') AND (sfdc.salesforce.Opportunity.ForecastCategory <> 'Omitted') AND (sfdc.salesforce.Opportunity.OpportunityType__c <> 'REBOOK') AND (sfdc.salesforce.Opportunity.IsClosed = TRUE) AND (sfdc.salesforce.Opportunity.IsWon = TRUE) AND (sfdc.salesforce.Opportunity.CloseDate > {d'2008-03-01'}) AND (sfdc.salesforce.Opportunity.AccountId = '00130000009SwiLAAS')
2010-12-30 02:32:08,436 DEBUG [org.teiid.CONNECTOR] (Worker84_QueryProcessorQueue1870) SynchQueryExecution.close() called
2010-12-30 02:32:08,436 DEBUG [org.teiid.CONNECTOR] (Worker84_QueryProcessorQueue1870) iQQ1QVCn8ndT.0.6.153 Closed execution
2010-12-30 02:32:08,436 WARN  [org.teiid.PROCESSOR] (Worker82_QueryProcessorQueue1869) Processing exception 'com.sforce.soap.partner.MalformedQueryFault: MALFORMED_QUERY: 
SELECT , (SELECT OpportunityLineItem.PricebookEntryId
      ^
ERROR at Row:1:Column:7
unexpected token: ','' for request iQQ1QVCn8ndT.0.  Exception type org.teiid.core.TeiidProcessingException thrown from org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:131). Enable more detailed logging to see the entire stacktrace.
2010-12-30 02:32:08,436 DEBUG [org.teiid.CONNECTOR] (Worker84_QueryProcessorQueue1870) iQQ1QVCn8ndT.0.6.153 Remove State
2010-12-30 02:32:08,437 DEBUG [org.teiid.CONNECTOR] (Worker84_QueryProcessorQueue1870) iQQ1QVCn8ndT.0.6.153 Closed connection

Comment 1 Steven Hawkins 2011-01-01 16:42:27 UTC
Link: Added: This issue Cloned from TEIID-1410


Comment 2 Steven Hawkins 2011-01-01 16:43:24 UTC
Security: Added: Public


Comment 4 Paul Nittel 2011-02-08 19:41:40 UTC
Tested with ER9 and closed.


Note You need to log in before you can comment on or make changes to this bug.