Implement streaming operator and API - #858
Open
senderista wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
One thing I forgot to mention that might be a problem: we can't set |
senderista
force-pushed
the
streaming_query_results
branch
from
August 8, 2017 20:13
a32e40a to
71b786b
Compare
senderista
force-pushed
the
streaming_query_results
branch
from
August 8, 2017 20:24
71b786b to
f4e476d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This first draft doesn't even work properly for all but the simplest examples, but I wanted to get feedback on the design sooner rather than later. Briefly, I'm introducing a new MyriaL statement
stream(relationVar)analogous tostore()andsink(). Whenever astream()statement appears, RACO inserts aStreampseudo-operator which is expanded into a chain of MyriaX operatorsCollectProducer->CollectConsumer->StreamingSink(the latter is a pseudo-operator defined in MyriaX). On the MyriaX side,StreamingSinkis expanded from its encoding to aTupleSinkwith aPipeSinkinstance of itsDataSinkmember, so we can get anInputStreamwith the query results. InStreamingSink.construct(), thePipeSink'sInputStreamis registered with theQueryManagerunder its query ID so we can retrieve it later and connect it to the HTTPResponseobject. InQueryResource.postNewStreamingQuery(), which is mapped to the new/query/streamendpoint, we retrieve all registeredInputStreams fromPipeSinks instantiated as part of aStreamingSinkin the query plan, and form aSequenceInputStreamwhich we pass toResponseBuilder.entity(), so the HTTP client receives all outputs in the order in which their respectivestream()statements appeared in the MyriaL query.This does seem to work for simple queries like this:
But it fails with the connected components sample query from myria-web, and also with sequenced
stream()statements like this:I haven't diagnosed the CC query failure yet, but I think the sequence query failure is due to a simple deadlock. I think the Myria
Sequenceoperator has to wait for each subquery to finish before running the next one, but that requires the client to consume all tuples, and somehow theSequenceInputStreamthat combines subquery results isn't flushed until the entire query has finished.