Aggragate looking at object type, but misses interface compatability

7 views
Skip to first unread message

Gordon Watts

unread,
Jul 20, 2012, 4:25:26 PM7/20/12
to re-moti...@googlegroups.com
Hi,
  It has been a while since I've updated re-linq, so it could be this behavior has changed (I remember a similar issue a while ago). I'm running into an InvalidOperationException in AggregateFromSeedResultOperator. Basically, my call looks like this:
 
            var value = q.Aggregate(new ROOTNET.NTLorentzVector(0.0, 0.0, 0.0, 0.0) as ROOTNET.Interface.NTLorentzVector, (a, v) => CPPHelperFunctions.Inc(a, v.run));
  You'll note that the see type is a NTLorentzVector. That object implements InterfaceNTLorentzVector. The function, Inc, takes as input Interface.NTLorentzVector and an integer, and returns an Interface.NTLorentzVector.
 
  However, in the re-linq result operator, it looks at the actual object type - which it sees as NTLorentzVector, and thus concludes that the function is not compatible.
 
  The issue is that the accumulator must remain the same time. So I need a way to force Aggregate to expect the interface in and out of the function. In short, re-linq seems to be too type safe here. ;-)

    Cheers,
        Gordon.

Fabian Schmied

unread,
Jul 23, 2012, 5:08:28 AM7/23/12
to re-moti...@googlegroups.com
Hi Gordon,

You're right, I've fixed a similar issue a few weeks ago. It was in
the StreamedSequenceDataInfo class and had to do with supporting
covariant IQueryable<T>. At that time, I put it on my TODO list to
check whether the AggregateFromSeedResultOperator was suffering from a
similar type comparison problem. I haven't had the time to check yet,
and now you've run into exactly that problem :)

I'm currently on holiday, so I can't try to reproduce and fix the
issue until next week. However, I'll try to get it done when I'm back.
Would you just tell me the exact exception message (plus stack trace)
you're getting?

Cheers,
Fabian
> --
> You received this message because you are subscribed to the Google Groups
> "re-motion Users" group.
> To post to this group, send email to re-moti...@googlegroups.com.
> To unsubscribe from this group, send email to
> re-motion-use...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/re-motion-users?hl=en.

Fabian Schmied

unread,
Jul 26, 2012, 11:05:02 AM7/26/12
to re-moti...@googlegroups.com
Hi again,

I've now tried to reproduce this issue, but I wasn't able to - the
code you've given seems to work just alright.
Can you please update to the most recent version of re-linq, and then
try your scenario again? If you still get the error, please tell me
the stack trace and exact error message so I can look into the issue.

(The issue I was thinking of actually applies only to the
AggregateResultOperator without seed, so it doesn't fit here...)

Thanks,
Fabian
Reply all
Reply to author
Forward
0 new messages