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

[Refactor] query #120

Merged
merged 6 commits into from
Apr 2, 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
147 changes: 0 additions & 147 deletions src/main/java/com/alipay/oceanbase/rpc/ObClusterTableAsyncQuery.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,18 @@ public void setReturnOneResult(boolean returnOneResult) {
}

void preCheck() {
List<ObTableOperation> operations = this.tableBatchOps.getObTableBatchOperation().getTableOperations();
List<ObTableOperation> operations = this.tableBatchOps.getObTableBatchOperation()
.getTableOperations();
if (operations.isEmpty()) {
throw new IllegalArgumentException("operations is empty");
}
ObTableOperationType lastType = operations.get(0).getOperationType();
if (returnOneResult
&& !(this.tableBatchOps.getObTableBatchOperation().isSameType() && (lastType == ObTableOperationType.INSERT
|| lastType == ObTableOperationType.PUT
|| lastType == ObTableOperationType.REPLACE || lastType == ObTableOperationType.DEL))) {
&& !(this.tableBatchOps.getObTableBatchOperation().isSameType() && (lastType == ObTableOperationType.INSERT
|| lastType == ObTableOperationType.PUT
|| lastType == ObTableOperationType.REPLACE || lastType == ObTableOperationType.DEL))) {
throw new IllegalArgumentException(
"returnOneResult only support multi-insert/put/replace/del");
"returnOneResult only support multi-insert/put/replace/del");
}
}
}
22 changes: 13 additions & 9 deletions src/main/java/com/alipay/oceanbase/rpc/ObClusterTableQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@

package com.alipay.oceanbase.rpc;

import com.alipay.oceanbase.rpc.location.model.partition.ObPair;
import com.alipay.oceanbase.rpc.mutation.Row;
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.ObTableEntityType;
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.aggregation.ObTableAggregationType;
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.query.ObHTableFilter;
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.query.ObTableQuery;
import com.alipay.oceanbase.rpc.stream.ObTableClientQueryAsyncStreamResult;
import com.alipay.oceanbase.rpc.stream.ObTableClientQueryStreamResult;
import com.alipay.oceanbase.rpc.stream.QueryResultSet;
import com.alipay.oceanbase.rpc.table.AbstractTableQuery;
import com.alipay.oceanbase.rpc.table.ObTableClientQueryImpl;
import com.alipay.oceanbase.rpc.table.ObTableParam;
import com.alipay.oceanbase.rpc.table.api.TableQuery;

import java.util.List;
Expand Down Expand Up @@ -85,14 +84,12 @@ public QueryResultSet execute() throws Exception {
return tableClientQuery.execute();
}

/*
* Execute.
*/
@Override
public QueryResultSet executeInit(ObPair<Long, ObTableParam> entry) throws Exception {
throw new IllegalArgumentException("not support executeInit");
}

@Override
public QueryResultSet executeNext(ObPair<Long, ObTableParam> entry) throws Exception {
throw new IllegalArgumentException("not support executeNext");
public QueryResultSet asyncExecute() throws Exception {
return tableClientQuery.asyncExecute();
}

/*
Expand All @@ -102,6 +99,13 @@ public ObTableClientQueryStreamResult executeInternal() throws Exception {
return tableClientQuery.executeInternal();
}

/*
* Async execute internal.
*/
public ObTableClientQueryAsyncStreamResult asyncExecuteInternal() throws Exception {
return tableClientQuery.asyncExecuteInternal();
}

/*
* Select.
*/
Expand Down
Loading
Loading