Another little LINQ error you might encounter from time to time. Ran into this yesterday while building out some queries, and figured it was worth a quick post. Starting with a basic stream, I needed to group by a set of fields in the stream and calculate some basic aggregates.
Running this throws the error:
Microsoft.ComplexEventProcessing.Linq.QueryGenerationException was unhandled by user code Message=Stream other than apply input stream is cannot be referenced inside apply branch. The following expression is not supported: 'sensorGroups => CreateAdapterStream("input", StreamInsight.Samples.Adapters.SimpleTextFileReader.TextFileReaderFactory, value (StreamInsight.Samples.Adapters.SimpleTextFileReader.TextFileReaderConfig), Point, value (Microsoft.ComplexEventProcessing.Linq.CepStreamCreationContext)).TumblingWindow(FromSeconds(5), HoppingWindowOutputPolicy.ClipToWindowEnd)'.
See the subtle yet annoyingly obvious after the fact mistake I made? I grouped by sensorGroups, but windowed over inputStream. Fix this to use the same stream for the window and the group resolves the error.