Q: What does the following exception mean?
System.Exception: 'unrecognised method call value(FSharp.Data.Sql.Runtime.QueryImplementation+SqlQueryable`1[FSharp.Data.Sql.Common.SqlEntity]).GroupJoin(value(FSharp.Data.Sql.Runtime.QueryImplementation+SqlQueryable`1[FSharp.Data.Sql.Common.SqlEntity]), arClientRow => arClientRow.GetColumn("CLIENT_ID"), dsItemRow => dsItemRow.GetColumn("CLIENT_ID"), (arClientRow, dsItemGroup) => new AnonymousObject`2(Item1 = arClientRow, Item2 = dsItemGroup.DefaultIfEmpty()))'
I'm attempting to translate a Pervasive SQL query to an F# query using SqlDataProvider
with an ODBC connection, building up slowly bit by bit. I'm getting an exception with the following query with a somewhat cryptic exception.
let Q2KQuery = query {
for arClientRow in Q2KDb.Dbo.ArClient do
leftOuterJoin dsItemRow in Q2KDb.Dbo.DsItem
on (arClientRow.ClientId = dsItemRow.ClientId)
into dsItemGroup
select (arClientRow, dsItemGroup) (*select statement simplified here for demonstration purposes*)
}
printfn "%i" (Seq.length Q2KQuery)
When the printfn
statement is executed and the expression is actually evaluated, the exception is hit:
System.Exception: 'unrecognised method call value(FSharp.Data.Sql.Runtime.QueryImplementation+SqlQueryable`1[FSharp.Data.Sql.Common.SqlEntity]).GroupJoin(value(FSharp.Data.Sql.Runtime.QueryImplementation+SqlQueryable`1[FSharp.Data.Sql.Common.SqlEntity]), arClientRow => arClientRow.GetColumn("CLIENT_ID"), dsItemRow => dsItemRow.GetColumn("CLIENT_ID"), (arClientRow, dsItemGroup) => new AnonymousObject`2(Item1 = arClientRow, Item2 = dsItemGroup.DefaultIfEmpty()))'
This is all part of a larger query which has the exact same exception when it is executed:
let Q2KQuery = query {
for arClientRow in Q2KDb.Dbo.ArClient do
leftOuterJoin dsItemRow in Q2KDb.Dbo.DsItem
on (arClientRow.ClientId = dsItemRow.ClientId)
into dsItemGroup
for dsItemRow in dsItemGroup do
leftOuterJoin dsWhseInvHeaderRow in Q2KDb.Dbo.DsWhseInvHeader
on ((dsItemRow.ClientId, dsItemRow.ItemId) = (dsWhseInvHeaderRow.ClientId, dsWhseInvHeaderRow.ItemId))
into dsWhseInvHeaderGroup
for dsWhseInvHeaderRow in dsWhseInvHeaderGroup do
where (
dsItemRow.ObsoleteFlg <> "Y"
&& arClientRow.IsInactive <> "Y"
&& dsWhseInvHeaderRow.WhseId = "B1"
&& dsItemRow.InvunitQty = 1
)
select (arClientRow, dsItemRow, dsWhseInvHeaderRow) (*select statement simplified here for demonstration purposes*)
}
FYI, the SQL query from which this F# query is translated is as follows (the SELECT
statement is not as important as the JOIN
clauses where the F# exception is thrown):
SELECT
-- LOTS of selects here... --
-- ... --
----- the important part of the F# queries begin here -----
FROM
ArClient
LEFT JOIN DsItem
ON ArClient.CLIENT_ID = DsItem.CLIENT_ID
LEFT JOIN DsWhse_Inv_Header
ON (DsItem.CLIENT_ID = DsWhse_Inv_Header.CLIENT_ID)
AND (DsItem.ITEM_ID = DsWhse_Inv_Header.ITEM_ID)
WHERE (
((DsItem.OBSOLETE_FLG) <> 'Y')
AND ((ArClient.IS_INACTIVE) <> 'Y')
AND ((DsWhse_Inv_Header.WHSE_ID) = 'B1')
AND ((DsItem.INVUNIT_QTY) = 1)
)
ORDER BY
CONCAT(LEFT(DsItem.CLIENT_ID, 4), RTRIM(LTRIM(DsItem.ITEM_ID)));