Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't parse if no args and result #30

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ private CodecCache(ProtocolVersion version) {
public static final UUID NULL_CODEC_ID = new UUID(0L, 0L);
public static final UUID INVALID_CODEC_ID = new UUID(Long.MAX_VALUE, Long.MAX_VALUE);

public static final NullCodec NULL_CODEC = new NullCodec();

private static final ConcurrentMap<ProtocolVersion, CodecCache> codecCaches;

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,6 @@ public ProtocolState(QueryParameters args, ByteBuf stateBuffer, List<ByteBuf> da

@Override
public CompletionStage<ParseResult> parseQuery(QueryParameters queryParameters) {
var cacheKey = queryParameters.getCacheKey();

var cachedCodecs = CodecBuilder.getCachedCodecs(this, cacheKey);

ByteBuf stateBuffer;

try {
Expand All @@ -305,6 +301,22 @@ public CompletionStage<ParseResult> parseQuery(QueryParameters queryParameters)
return CompletableFuture.failedFuture(e);
}

if(queryParameters.format == IOFormat.NONE && (queryParameters.arguments == null || queryParameters.arguments.isEmpty())) {
return CompletableFuture.completedFuture(new ParseResult(
CodecBuilder.NULL_CODEC,
CodecBuilder.NULL_CODEC,
CodecBuilder.NULL_CODEC_ID,
CodecBuilder.NULL_CODEC_ID,
stateBuffer,
queryParameters.capabilities,
queryParameters.cardinality
));
}

var cacheKey = queryParameters.getCacheKey();

var cachedCodecs = CodecBuilder.getCachedCodecs(this, cacheKey);

if(cachedCodecs == null) {
ProtocolState parseState = new ProtocolState(queryParameters, stateBuffer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ public TransactionState getTransactionState() {

@Override
public CompletionStage<Void> startTransaction(@NotNull TransactionIsolation isolation, boolean readonly, boolean deferrable) {

String query = "start transaction isolation " +
isolation +
", " +
Expand Down