Repository navigation
feat(qwp): report the designated timestamp and omit BINARY values of query results - #135
Open
glasstiger wants to merge 2 commits into
Open
glasstiger wants to merge 2 commits into
glasstiger wants to merge 2 commits into
Conversation
Add the designatedTimestamp option to QwpQueryOptions. A server that advertises CAP_QUERY_DETAILS then ends RESULT_END with designated_timestamp:i32, after the row count and the statistics block: the index of the result column that is the designated timestamp, or NO_DESIGNATED_TIMESTAMP (-1) when the result has none, as the timestamp of the /exec HTTP endpoint reports it. QwpQueryDetails passes it to onEnd() through hasDesignatedTimestampIndex() and getDesignatedTimestampIndex(). - QUERY_FLAG_DESIGNATED_TIMESTAMP (0x80) asks for the trailer. Like the other reports, the client drops it for a server without CAP_QUERY_DETAILS, after a failover too. - The decoder rejects a designated_timestamp that cannot name a result column, outside -1 to 2047, as a broken stream, the way it rejects a truncated trailer. - Statements and errors carry no designated timestamp. - The README example asks for it. Server counterpart: questdb/questdb#8693.
glasstiger
added a commit
to questdb/questdb
that referenced
this pull request
Dec 1, 2026
Bump java-questdb-client to the commit that adds the designatedTimestamp query option (questdb/java-questdb-client#135), and check the designated timestamp through it, as changes to the QWP wire format require. - QwpEgressQueryDetailsClientTest compares the index the pinned client reports with /exec across table scans, projections, a TIMESTAMP_NS table, SAMPLE BY, an ASOF JOIN and an empty result, with and without a row window, and checks that it names a TIMESTAMP or TIMESTAMP_NS column of the schema the client decoded. It also covers the pooled Query facade, statements and errors, and that the client and server constants match. - QwpEgressFuzzTest asks for the designated timestamp a third of the time, and checks it against /exec in both of its query paths. The bump also brings in questdb/java-questdb-client#130, which adds owned_by to the QWP sender.
Add the omitBinaryValues option to QwpQueryOptions. It sets the new QUERY_FLAG_OMIT_BINARY_VALUES (0x100) bit of query_flags, which asks a server that advertises CAP_QUERY_DETAILS to send each non-NULL BINARY value empty, zero bytes long, and a NULL as NULL, in the usual layout of the column. The /exec HTTP endpoint never sends BINARY content either: it writes every BINARY value as []. The server neither copies nor sends the bytes, so a client that does not read them no longer waits for them. - The flag adds no request field and no trailer, and the batch decoder needs no change: an omitted value decodes as an empty one, which getBinary() and getBinaryA() tell apart from NULL. - Like the query details, the client drops the flag for a server without CAP_QUERY_DETAILS, after a failover too. Such a server sends the values in full. - The README example asks for it. Server counterpart: questdb/questdb#8693.
glasstiger
added a commit
to questdb/questdb
that referenced
this pull request
Dec 1, 2026
Bump java-questdb-client to the commit that adds the omitBinaryValues query option (questdb/java-questdb-client#135), and check the omission of BINARY values through it, as changes to the QWP wire format require. - QwpEgressQueryDetailsClientTest checks that each value the pinned client decodes is NULL where length() reads -1 and empty elsewhere, and as long as length() reads without the option. It covers the page frames of parquet and native partitions and of a column top, forwards and backwards; the RecordCursors of a filter, a sort, LIMIT, a CASE, a join, UNION ALL and a CTE; a row window; and the pooled Query facade. It also checks the NULLs of rnd_bin(), which length() does not see, that a row whose BINARY value overflows the send buffer streams with the option and fails the query without it, and that the client and server constants match. - QwpEgressFuzzTest leaves the BINARY values out a third of the time, and its BINARY columns now hold NULLs too.
Contributor
[PR Coverage check]😍 pass : 38 / 38 (100.00%) file detail
|
This branch has not been deployed
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.
Adds a designated timestamp report and the omission of BINARY values to the Java QWP query client: the client side of questdb/questdb#8693.
New functionality
QwpQueryOptions.designatedTimestamp(true)asks the server which column of the result is its designated timestamp, as/execreports it intimestamp.QwpQueryDetails.getDesignatedTimestampIndex()returns that column's index in the result's schema, orQwpEgressMsgKind.NO_DESIGNATED_TIMESTAMP(-1) when the result has none.hasDesignatedTimestampIndex()tells whether the server reported it at all.onEnd(requestId, totalRows, details)throughQwpQueryClient.execute(...)and the pooledQuery.options(...)alike. Statements and errors report none.QwpQueryOptions.omitBinaryValues(true)asks the server to leave the bytes of BINARY values out, as/execdoes, which sends every BINARY value as[]. Each non-NULL BINARY value then reaches the handler empty, zero bytes long, and a NULL stays NULL; the server neither copies nor sends the bytes.Compatibility and implementation
QUERY_FLAG_DESIGNATED_TIMESTAMP(0x80) asks for adesignated_timestamp:i32trailer at the end ofRESULT_END, after the row count and the statistics block.QUERY_FLAG_OMIT_BINARY_VALUES(0x100) adds no request field and no trailer. The BINARY column keeps its layout, so the batch decoder is unchanged: an omitted value decodes as an empty one, whichgetBinary()andgetBinaryA()tell apart from NULL.CAP_QUERY_DETAILS: the client drops them for a server without the capability, including after a failover. Such a server sends the BINARY values in full.The README example shows the new options.
Tandem PRs: questdb/questdb#8693, questdb/nodejs-questdb-client#83.