The execute_query method in the Spanner client invokes the ExecuteStreamingSql RPC in Spanner. This initiates the gRPC stream that will receive the query results from Spanner. However, Spanner does not evaluate the query at all before setting up this stream, meaning that even the simplest syntax error will be delayed until the first time the application calls ResultSet#next().
Possible alternatives:
- Keep it as it is now.
- Delay the initialization of the stream until the first time
ResultSet#next() is called.
- Eagerly fetch the first
PartialResultSet when execute_streaming is called to ensure that execute_query fully validates and executes the query.
The Spanner emulator does evaluate the query when ExecuteStreamingSql is invoked. This currently causes a behavioral difference when using the Rust client with the Emulator vs with real Spanner.
The
execute_querymethod in the Spanner client invokes theExecuteStreamingSqlRPC in Spanner. This initiates the gRPC stream that will receive the query results from Spanner. However, Spanner does not evaluate the query at all before setting up this stream, meaning that even the simplest syntax error will be delayed until the first time the application callsResultSet#next().Possible alternatives:
ResultSet#next()is called.PartialResultSetwhenexecute_streamingis called to ensure thatexecute_queryfully validates and executes the query.The Spanner emulator does evaluate the query when
ExecuteStreamingSqlis invoked. This currently causes a behavioral difference when using the Rust client with the Emulator vs with real Spanner.