Ken Hu created TINKERPOP-3156:
---------------------------------

             Summary: Check consistency of partial result handling in GLVs
                 Key: TINKERPOP-3156
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3156
             Project: TinkerPop
          Issue Type: Improvement
          Components: dotnet, driver, go, javascript, python
    Affects Versions: 3.8.0
            Reporter: Ken Hu


Check behavior of GLVs when handling partial results for both the Client and 
Traversal APIs. It isn't entirely clear if GLVs should allow the user to 
retrieve results that were received before the error or if errors will discard 
the results.

Let's say there are five results that were received and then an error before 
the user requests for the data. Should _HasNext()_ return true for the first 
five results without error or should it throw an exception (or equivalent 
depending on language) right away. What should _One()_ or _ToList()_ in 
ResultSet do?

An example of this is the Go driver's behavior. Let's take the following test 
(if it were in resultSet_test.go) as an example
{code:java}
    t.Run("Test ResultSet reads partial results with error.", func(t 
*testing.T) {
        channelResultSet := newChannelResultSet(mockID, getSyncMap())
        AddResults(channelResultSet, 5)
        channelResultSet.setError(fmt.Errorf("injected %s error", "ResultSet")) 
       assert.False(t, channelResultSet.IsEmpty())
        one, _, _ := channelResultSet.One()
        assert.NotNil(t, one)
    }) {code}
The assert.NotNil(t, one) portion fails even though the ResultSet has results. 
The same would be true for Traversal.Next(). Ideally, the API should give the 
user the option to either handle the error immediately (thus discarding the 
results) or read the results first and then handle the error. The other thing 
to consider is that it should be very clear to a user whether a query was 
successful (all results), partially successful (some results but ended with 
error), or failed (no results with error).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to