-
Bug
-
Resolution: Done
-
Major
-
7.1.1
-
None
If you select a column of a joined table which is null, you get a NullPointerException:
This query results in a NPE:
SELECT sfdc.salesforce.OpportunityContactRole.id, sfdc.salesforce.Contact.Id, sfdc.salesforce.OpportunityContactRole.ContactId,
sfdc.salesforce.OpportunityContactRole.isPrimary, sfdc.salesforce.OpportunityContactRole.opportunityId,
sfdc.salesforce.OpportunityContactRole.role, sfdc.salesforce.Contact.AccountId, sfdc.salesforce.Contact.Email,
sfdc.salesforce.Contact.Fax, sfdc.salesforce.Contact.FirstName, sfdc.salesforce.Contact.LastName,
sfdc.salesforce.Contact.MailingCity, sfdc.salesforce.Contact.MailingCountry, sfdc.salesforce.Contact.MailingPostalCode,
sfdc.salesforce.Contact.MailingStreet, sfdc.salesforce.Contact.Name, sfdc.salesforce.Contact.Phone,
sfdc.salesforce.Contact.Salutation, sfdc.salesforce.Contact.Mobile
FROM sfdc.salesforce.OpportunityContactRole LEFT OUTER JOIN sfdc.salesforce.Contact ON sfdc.salesforce.OpportunityContactRole.ContactId = sfdc.salesforce.Contact.Id
WHERE sfdc.salesforce.OpportunityContactRole.opportunityId = '0066000000AcQ7BAAV'
After checking which element in Contact could be NULL, I found sfdc.salesforce.Contact.Mobile to be so for this particular opportunity. If I remove it, this query executes as expected.
This issue seems to be related to: TEIID-1409.
Log output:
==========
2011-01-07 00:40:49,644 DEBUG [org.teiid.CONNECTOR] (Worker294_QueryProcessorQueue7699) ioeQ+oAVfHm/.0.1.695 Create State
2011-01-07 00:40:49,647 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) ioeQ+oAVfHm/.0.1.695 Processing NEW request: SELECT sfdc.salesforce.OpportunityContactRole.id, sfdc.salesforce.Contact.Id, sfdc.salesforce.OpportunityContactRole.ContactId, sfdc.salesforce.OpportunityContactRole.isPrimary, sfdc.salesforce.OpportunityContactRole.opportunityId, sfdc.salesforce.OpportunityContactRole.role, sfdc.salesforce.Contact.AccountId, sfdc.salesforce.Contact.Email, sfdc.salesforce.Contact.Fax, sfdc.salesforce.Contact.FirstName, sfdc.salesforce.Contact.LastName, sfdc.salesforce.Contact.MailingCity, sfdc.salesforce.Contact.MailingCountry, sfdc.salesforce.Contact.MailingPostalCode, sfdc.salesforce.Contact.MailingStreet, sfdc.salesforce.Contact.MobilePhone, sfdc.salesforce.Contact.Name, sfdc.salesforce.Contact.Phone, sfdc.salesforce.Contact.Salutation FROM sfdc.salesforce.OpportunityContactRole LEFT OUTER JOIN sfdc.salesforce.Contact ON sfdc.salesforce.OpportunityContactRole.ContactId = sfdc.salesforce.Contact.Id WHERE sfdc.salesforce.OpportunityContactRole.opportunityId = '0066000000AcQ7BAAV'
2011-01-07 00:40:49,648 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) ioeQ+oAVfHm/.0.1.695 Obtained execution
2011-01-07 00:40:49,648 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) sfdc.ioeQ+oAVfHm/.ioeQ+oAVfHm/.0.1: Incoming Query: SELECT OpportunityContactRole.Id, Contact.Id, OpportunityContactRole.ContactId, OpportunityContactRole.IsPrimary, OpportunityContactRole.OpportunityId, OpportunityContactRole.Role, Contact.AccountId, Contact.Email, Contact.Fax, Contact.FirstName, Contact.LastName, Contact.MailingCity, Contact.MailingCountry, Contact.MailingPostalCode, Contact.MailingStreet, Contact.MobilePhone, Contact.Name, Contact.Phone, Contact.Salutation FROM OpportunityContactRole LEFT OUTER JOIN Contact ON OpportunityContactRole.ContactId = Contact.Id WHERE OpportunityContactRole.OpportunityId = '0066000000AcQ7BAAV'
2011-01-07 00:40:49,648 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) sfdc.ioeQ+oAVfHm/.ioeQ+oAVfHm/.0.1: Executing Query: SELECT OpportunityContactRole.Id, Contact.Id, OpportunityContactRole.ContactId, OpportunityContactRole.IsPrimary, OpportunityContactRole.OpportunityId, OpportunityContactRole.Role, Contact.AccountId, Contact.Email, Contact.Fax, Contact.FirstName, Contact.LastName, Contact.MailingCity, Contact.MailingCountry, Contact.MailingPostalCode, Contact.MailingStreet, Contact.MobilePhone, Contact.Name, Contact.Phone, Contact.Salutation FROM OpportunityContactRole WHERE OpportunityContactRole.OpportunityId = '0066000000AcQ7BAAV'
2011-01-07 00:40:50,678 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) ioeQ+oAVfHm/.0.1.695 Executed command
2011-01-07 00:40:50,679 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) ioeQ+oAVfHm/.0.1.695 Sending results from connector
2011-01-07 00:40:50,679 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) SalesForce Object Name = OpportunityContactRole
2011-01-07 00:40:50,679 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) FieldCount = 5
2011-01-07 00:40:50,679 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) Field # 0 is Contact
2011-01-07 00:40:50,679 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) Field # 1 is ContactId
2011-01-07 00:40:50,679 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) Field # 2 is IsPrimary
2011-01-07 00:40:50,679 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) Field # 3 is OpportunityId
2011-01-07 00:40:50,679 DEBUG [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) Field # 4 is Role
2011-01-07 00:40:50,679 ERROR [org.teiid.CONNECTOR] (Worker295_QueryProcessorQueue7700) Connector worker process failed for atomic-request=ioeQ+oAVfHm/.0.1.695
java.lang.NullPointerException
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.setElementValueInColumn(QueryExecutionImpl.java:323)
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.extractValuesFromElement(QueryExecutionImpl.java:276)
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.extactJoinResults(QueryExecutionImpl.java:225)
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.getObjectData(QueryExecutionImpl.java:216)
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.loadBatch(QueryExecutionImpl.java:199)
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.getRow(QueryExecutionImpl.java:174)
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.next(QueryExecutionImpl.java:166)
at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.handleBatch(ConnectorWorkItem.java:281)
at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:266)
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)
2011-01-07 00:40:50,694 ERROR [org.teiid.PROCESSOR] (Worker294_QueryProcessorQueue7701) Unexpected exception for request ioeQ+oAVfHm/.0
java.lang.NullPointerException
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.setElementValueInColumn(QueryExecutionImpl.java:323)
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.extractValuesFromElement(QueryExecutionImpl.java:276)
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.extactJoinResults(QueryExecutionImpl.java:225)
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.getObjectData(QueryExecutionImpl.java:216)
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.loadBatch(QueryExecutionImpl.java:199)
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.getRow(QueryExecutionImpl.java:174)
at org.teiid.translator.salesforce.execution.QueryExecutionImpl.next(QueryExecutionImpl.java:166)
at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.handleBatch(ConnectorWorkItem.java:281)
at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:266)
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)
2011-01-07 00:40:50,708 DEBUG [org.teiid.CONNECTOR] (Worker296_QueryProcessorQueue7702) ioeQ+oAVfHm/.0.1.695 Processing Close : SELECT sfdc.salesforce.OpportunityContactRole.id, sfdc.salesforce.Contact.Id, sfdc.salesforce.OpportunityContactRole.ContactId, sfdc.salesforce.OpportunityContactRole.isPrimary, sfdc.salesforce.OpportunityContactRole.opportunityId, sfdc.salesforce.OpportunityContactRole.role, sfdc.salesforce.Contact.AccountId, sfdc.salesforce.Contact.Email, sfdc.salesforce.Contact.Fax, sfdc.salesforce.Contact.FirstName, sfdc.salesforce.Contact.LastName, sfdc.salesforce.Contact.MailingCity, sfdc.salesforce.Contact.MailingCountry, sfdc.salesforce.Contact.MailingPostalCode, sfdc.salesforce.Contact.MailingStreet, sfdc.salesforce.Contact.MobilePhone, sfdc.salesforce.Contact.Name, sfdc.salesforce.Contact.Phone, sfdc.salesforce.Contact.Salutation FROM sfdc.salesforce.OpportunityContactRole LEFT OUTER JOIN sfdc.salesforce.Contact ON sfdc.salesforce.OpportunityContactRole.ContactId = sfdc.salesforce.Contact.Id WHERE sfdc.salesforce.OpportunityContactRole.opportunityId = '0066000000AcQ7BAAV'
2011-01-07 00:40:50,708 DEBUG [org.teiid.CONNECTOR] (Worker296_QueryProcessorQueue7702) SynchQueryExecution.close() called
2011-01-07 00:40:50,708 DEBUG [org.teiid.CONNECTOR] (Worker296_QueryProcessorQueue7702) ioeQ+oAVfHm/.0.1.695 Closed execution
2011-01-07 00:40:50,708 DEBUG [org.teiid.CONNECTOR] (Worker296_QueryProcessorQueue7702) ioeQ+oAVfHm/.0.1.695 Remove State
2011-01-07 00:40:50,708 DEBUG [org.teiid.CONNECTOR] (Worker296_QueryProcessorQueue7702) ioeQ+oAVfHm/.0.1.695 Closed connection