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

Batch op in ls #104

Closed
wants to merge 240 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
240 commits
Select commit Hold shift + click to select a range
49c7f36
Merge pull request #3 from JLY2015/master
JLY2015 Jan 18, 2022
20bf10d
fix: update default java.version from 1.6 to 1.8
hzchenjianfei Jan 19, 2022
1bf4d15
Merge pull request #4 from hzchenjianfei/master
hzchenjianfei Jan 19, 2022
72f102e
build(deps): bump netty-all from 4.1.13.Final to 4.1.42.Final (#9)
dependabot[bot] Jan 24, 2022
4b1730c
build(deps-dev): bump junit from 4.12 to 4.13.1 (#8)
dependabot[bot] Jan 24, 2022
fab0ffc
build(deps): bump mysql-connector-java from 5.1.30 to 8.0.16 (#7)
dependabot[bot] Jan 24, 2022
1e4253e
build(deps-dev): bump spring-core from 4.3.4.RELEASE to 4.3.21.RELEAS…
dependabot[bot] Jan 24, 2022
c832eef
fix: update mysql-connector-java version to 5.1.49 and fastjson version
JLY2015 Jan 25, 2022
4ee9c37
Merge pull request #10 from JLY2015/master
JLY2015 Jan 25, 2022
438a398
support query async
JLY2015 Mar 24, 2022
5befab7
Merge pull request #12 from JLY2015/master
JLY2015 Mar 25, 2022
d88d357
fix: modify file description
JLY2015 Mar 25, 2022
5f6789a
Merge pull request #13 from JLY2015/master
JLY2015 Mar 25, 2022
5af7907
update version to 0.1.2
JLY2015 Mar 25, 2022
767cabe
Merge pull request #14 from JLY2015/master
JLY2015 Mar 25, 2022
e1a2b05
bugfix: query async next need init before using resultSet
JLY2015 Jun 23, 2022
258f90a
Merge pull request #21 from JLY2015/master
JLY2015 Jun 23, 2022
4738107
update version to 0.1.3
Jul 1, 2022
dd97147
Merge pull request #22 from JLY2015/master
JLY2015 Jul 1, 2022
4b9f021
feat: table api client adapt to odp
shenyunlong Sep 26, 2022
26ba565
Merge branch toODP into master
shenyunlong Sep 29, 2022
14726a1
add trace log
shenyunlong Oct 12, 2022
41b5be7
Merge branch addTraceLog into master
shenyunlong Oct 12, 2022
2bf8986
TableAPI Support QueryAndMutate
IHEII Oct 12, 2022
0870047
Merge branch origin/QueryAndMutate into master
IHEII Oct 14, 2022
e40ba75
fix trace id and remove odp full username check
shenyunlong Oct 21, 2022
dffc4cf
Feat: refactor interface of filter
IHEII Oct 25, 2022
122ec2a
Merge branch QueryAndMutate into master
IHEII Oct 26, 2022
20b631b
Merge branch issue/512134 into master
shenyunlong Nov 3, 2022
d44c4e3
Feat: FilterFactory
IHEII Nov 1, 2022
428df00
Merge branch origin/QueryAndMutate into master
IHEII Nov 14, 2022
12c3ecb
fix issue 46194021 & 46194144
shenyunlong Nov 17, 2022
e1ae676
Feat: Mutation
IHEII Nov 16, 2022
d26d2f9
fix: fix README.md
JLY2015 Dec 16, 2021
2820026
fix README.md
JLY2015 Jan 18, 2022
befcaf9
fix: privacy security
IHEII Sep 19, 2022
ff02587
feat: value filter support is/is_not compare op
shenyunlong Nov 15, 2022
408515d
Merge branch is_not_and_limit into master
shenyunlong Nov 22, 2022
6477bd7
fix: issue 46155840 and 46155965
shenyunlong Nov 16, 2022
e8506db
Merge branch issue/46155840 into master
shenyunlong Nov 22, 2022
2b3ced1
Merge branch 'master' of gitlab.alibaba-inc.com:oceanbase/obkv-table-…
shenyunlong Nov 22, 2022
6d017f2
Merge branch issue/46194144 into master
shenyunlong Nov 22, 2022
e423a18
fix conflicts
IHEII Nov 22, 2022
ff45ead
bugfix & remove useless func
IHEII Nov 22, 2022
653bb4b
Merge branch origin/mutation_interface into master
IHEII Nov 23, 2022
370ad3c
bugfix & remove useless func
IHEII Nov 22, 2022
5c9c391
fix conflicts
IHEII Nov 24, 2022
d8f2cb9
Merge branch origin/mutation_interface into master
IHEII Nov 24, 2022
da03186
faat: support local index in odp mode
shenyunlong Nov 29, 2022
8522546
fix: the keySet of rowKeyElement is unordered
shenyunlong Nov 29, 2022
1a69619
modify ObTableClientPartitionKeyTest to use table without generated c…
shenyunlong Nov 29, 2022
e3e0293
add testcase for index query on key partitioned table
shenyunlong Dec 1, 2022
063ebce
add local index testcase for range partition query
shenyunlong Dec 1, 2022
93524bd
fix cases
shenyunlong Dec 1, 2022
04c764b
fix: update test cases
shenyunlong Dec 1, 2022
a5d91b3
fix: batch query / exception printer / ODP
IHEII Nov 28, 2022
f7335d3
Merge branch origin/mutation_interface into master
shenyunlong Dec 2, 2022
3f271b4
fix append and increment in column with wrong data type
shenyunlong Dec 2, 2022
edbffb9
Merge remote-tracking branch 'origin/master' into issue/46411494
shenyunlong Dec 2, 2022
03086fb
remove some unnecessary modifications
shenyunlong Dec 2, 2022
73c2701
fix review
shenyunlong Dec 2, 2022
e76755d
remove useless blank line
shenyunlong Dec 2, 2022
8b3baa5
Merge branch issue/46411494 into master
shenyunlong Dec 2, 2022
ac9c171
fix: some cases
IHEII Dec 3, 2022
b5453b6
Merge remote-tracking branch 'origin/master' into dev
IHEII Dec 3, 2022
3d9119e
fix cases and remove useless code
shenyunlong Dec 4, 2022
e9f787d
remove HANDLE_KEY_RANGE_COLUMNS and adjust client version
shenyunlong Dec 4, 2022
72ab021
Merge branch origin/mutation_interface into master
shenyunlong Dec 4, 2022
2ef3102
Merge branch fix_cases into master
shenyunlong Dec 4, 2022
8ddcd9e
fix: maven configuration
IHEII Dec 5, 2022
bcee725
Merge branch origin/mutation_interface into master
shenyunlong Dec 5, 2022
8df3ebd
fill a whole scan range if no scan range is addded by user explicitly
shenyunlong Dec 5, 2022
eb789e3
fix: end key is MIN when getWholeRange
shenyunlong Dec 5, 2022
c5f20bd
add cases for key prefix scan and empty range scan
shenyunlong Dec 5, 2022
a6deb0a
Merge remote-tracking branch 'origin/master' into issue/46537711
shenyunlong Dec 5, 2022
ba7d7d2
fix cases compile error
shenyunlong Dec 5, 2022
6a55c16
remove ObRowKey.getMinRow and ObRowKey.getMaxRow
shenyunlong Dec 6, 2022
92f885b
Merge branch issue/46537711 into master
shenyunlong Dec 6, 2022
eee9923
exclude bolt's netty dependency
shenyunlong Dec 6, 2022
51c02af
Merge branch issue/46596374 into master
shenyunlong Dec 6, 2022
b04bbc9
fix: SCA
IHEII Dec 7, 2022
0c1f235
fix: adjust range scan in mutation
IHEII Dec 8, 2022
9d14127
fix: remove select related code
IHEII Dec 13, 2022
2325c07
fix:some cases
IHEII Dec 13, 2022
2dbb99e
Merge branch rangeScanMutation into master
IHEII Dec 14, 2022
553b9b6
fix: modify BatchOperation
IHEII Dec 16, 2022
cadaca4
change getOperationRows to getOperationRow
shenyunlong Dec 19, 2022
369bd32
Merge branch BatchOperation into master
shenyunlong Dec 19, 2022
37f41c4
adjust BatchOperation.addOperation interface
shenyunlong Dec 19, 2022
c22cd55
Merge branch adjustAddOp into master
shenyunlong Dec 19, 2022
ebe6264
add testcase for batch query and large query
shenyunlong Dec 21, 2022
9ba4da3
fix issue 46751822
shenyunlong Dec 20, 2022
4e24c72
Merge branch issue/46843538 into master
shenyunlong Dec 21, 2022
ece448e
Merge branch issue/46751822 into master
shenyunlong Dec 21, 2022
5385352
Release v1.0.0
IHEII Jan 4, 2023
525283c
Merge branch release_1.0.0 into master
IHEII Jan 4, 2023
a1bc26e
feat: add throttle test
IHEII Jan 4, 2023
e039014
Merge remote-tracking branch 'origin/master' into throttle
IHEII Jan 4, 2023
2d72f8d
Merge branch throttle into master
IHEII Jan 4, 2023
93bbe76
renew pom and update version
IHEII Jan 5, 2023
80a8df5
Merge branch renew_pom into master
IHEII Jan 5, 2023
5bf84d3
fix: batch isSameType
IHEII Jan 10, 2023
be9938e
Merge branch issametype into master
IHEII Jan 10, 2023
39de766
fix:duplicate rowkey in mutation
IHEII Jan 12, 2023
ea8121c
Merge branch duplicate_rowkey into master
IHEII Jan 12, 2023
89cb308
fix:batch operation duplicate rowkey
IHEII Jan 16, 2023
2c987a4
Merge branch batch_duplicate_rowkey into master
IHEII Jan 16, 2023
34d0509
Merge branch 'master' of https://github.com/oceanbase/obkv-table-clie…
wangzelin19961202 Jan 31, 2023
53cd5d5
Preparation for release
IHEII Feb 2, 2023
b6b034a
Merge branch release_preparation into master
IHEII Feb 2, 2023
3ce8654
fix: empty traceId
IHEII Feb 3, 2023
fea6cbb
Merge branch issue_47606531 into master
IHEII Feb 3, 2023
b1606e8
fix:test cases and BatchOperation
IHEII Feb 6, 2023
45304ce
Merge branch issue_47645954 into master
IHEII Feb 7, 2023
56eaa2d
Modify the multi-threaded test case
IHEII Feb 7, 2023
34ea8a4
Merge branch throttle_test into master
IHEII Feb 8, 2023
2536cd7
fix:pom gpg
IHEII Feb 9, 2023
1a6020a
[maven-release-plugin] prepare release obkv-table-client-1.0.1
IHEII Feb 9, 2023
f6dbb32
[maven-release-plugin] prepare for next development iteration
IHEII Feb 9, 2023
dfeabd5
Merge branch 101_release into master
IHEII Feb 9, 2023
e4cd4ab
fix:some testcases
IHEII Feb 15, 2023
e22630a
Merge branch fix_testcase into master
IHEII Feb 15, 2023
dd6868a
fix connection's credential is null
shenyunlong Mar 1, 2023
a8ef1b7
add debug info for reconnect
shenyunlong Mar 1, 2023
b64f12c
fix endless loop for throwing exception: all connection's credential …
shenyunlong Mar 1, 2023
e89c062
[feature] add setIsAtomic interface for BatchOperation
shenyunlong Mar 6, 2023
4d15482
[feature] add logback print support
shenyunlong Mar 8, 2023
eb58db7
change batch mutation atomic is true in default and ajust log conf
shenyunlong Mar 9, 2023
a90c67f
code format
shenyunlong Mar 9, 2023
e6eebdd
add trace-id in log
shenyunlong Mar 9, 2023
a9fec56
Merge branch gaode_master into master
shenyunlong Mar 9, 2023
065794d
mvn format code
shenyunlong Mar 9, 2023
6f0cbe8
[maven-release-plugin] prepare release obkv-table-client-1.0.2
IHEII Mar 9, 2023
29e7b84
[maven-release-plugin] prepare for next development iteration
IHEII Mar 9, 2023
4337905
[feature] Add slow_query_monitor_threshold property
shenyunlong Mar 14, 2023
512f80b
[maven-release-plugin] prepare release obkv-table-client-1.0.3
IHEII Mar 14, 2023
687a270
[maven-release-plugin] prepare for next development iteration
IHEII Mar 14, 2023
be7a83c
Merge pull request #28 from oceanbase/release_103
IHEII Mar 14, 2023
e5f0eed
[FIX] some wrong testcases
shenyunlong Mar 15, 2023
fc71f21
[Feat] Support 4.x observer
IHEII Mar 23, 2023
274b464
Fix ByteBuf memleak and timeout exceed
shenyunlong Mar 24, 2023
2af76d9
[maven-release-plugin] prepare release obkv-table-client-1.1.0
IHEII Mar 24, 2023
81e7473
[maven-release-plugin] prepare for next development iteration
IHEII Mar 24, 2023
55e5bd1
Merge pull request #29 from oceanbase/release_1.1.0
IHEII Mar 24, 2023
eaf52a1
[Fix] default atomic option
IHEII Mar 29, 2023
2e6fb8d
[Fix] hash func in partition
IHEII Apr 6, 2023
9d6a550
[Fix] hash/range partition
IHEII Apr 7, 2023
1df7b44
[Fix] constants define error
Apr 7, 2023
27d8c84
[Test] add testcase for gv$ob_kv_connections and v$ob_kv_connections
shenyunlong Apr 10, 2023
4dec4da
[Fix] sub range partition
IHEII Apr 12, 2023
e6cf99b
[Fix] sub partition in 4.x
IHEII Apr 13, 2023
7492c63
[Test] add testcases for sql_audit
shenyunlong Apr 25, 2023
f4099b8
[Doc] update readme
shenyunlong Apr 25, 2023
6fb627f
[Refactor] oceanbase jdbc
IHEII May 17, 2023
b92d302
fix potential ByteBuffer leak problem
shenyunlong May 26, 2023
c28bac5
[Fix] int32/int16/int8 in range partition
IHEII May 26, 2023
3828aaf
[maven-release-plugin] prepare release obkv-table-client-1.2.0
IHEII May 29, 2023
47bdc38
[maven-release-plugin] prepare for next development iteration
IHEII May 29, 2023
42eefdf
[Feat] aggregation impl (#31)
SmallSongZ Jun 1, 2023
f53d598
[Fix] add defense for multiple partition aggregation (#33)
SmallSongZ Jun 5, 2023
4f8e974
[Fix] revise aggregation impl (#34)
SmallSongZ Jun 12, 2023
79f6693
[Test] add testcases for TTL and fix some testcases
shenyunlong Jun 15, 2023
ee24685
fix: remove unused code
Jul 4, 2023
8346ec4
[Fix] scale number & format
IHEII Jul 4, 2023
3393201
[Fix] test cases
IHEII Jul 4, 2023
44f0ece
[maven-release-plugin] prepare release obkv-table-client-1.2.1
IHEII Jul 4, 2023
adb104a
[maven-release-plugin] prepare for next development iteration
IHEII Jul 4, 2023
ca07da9
[Feat] insertWithFilter & add testcases (#36)
SmallSongZ Jul 7, 2023
be6c75c
[maven-release-plugin] prepare release obkv-table-client-1.2.2
IHEII Jul 7, 2023
4e0bc9a
[maven-release-plugin] prepare for next development iteration
IHEII Jul 7, 2023
003c02a
[Chore] format
IHEII Jul 7, 2023
b22cf9f
fix: merge appenders and loggers in log4j2 config (#38)
whhe Jul 19, 2023
7245e9b
[Fix] modify test cases for aggregate on empty table (#39)
SmallSongZ Aug 4, 2023
8784016
[Feat] reRouting flag (#40)
IHEII Aug 10, 2023
8087b5d
[Fix] observer version is invalid under ODP mode
shenyunlong Aug 23, 2023
12bb271
[maven-release-plugin] prepare release obkv-table-client-1.2.3
IHEII Aug 23, 2023
6503bbb
[maven-release-plugin] prepare for next development iteration
IHEII Aug 23, 2023
21964d0
[Chore] format
IHEII Aug 23, 2023
7db21ad
[Fix] int in key partition (#41)
IHEII Sep 5, 2023
e7c9f0e
[Fix] unrecognized exception in ODP query
IHEII Sep 7, 2023
2574d6d
Merge pull request #42 from IHEII/reroute
WeiXinChan Sep 7, 2023
a176f3c
[Refactor] ObVersion (#43)
IHEII Sep 8, 2023
1cbed4c
[Fix] testLargeQuery and OB_VERSION (#44)
IHEII Sep 13, 2023
56cf874
[Fix] datetime (#45)
IHEII Sep 15, 2023
ae07897
[Feat] support put (#46)
WeiXinChan Sep 18, 2023
56cd981
[Chore] format (#47)
IHEII Sep 18, 2023
5b34647
[maven-release-plugin] prepare release obkv-table-client-1.2.4
IHEII Sep 18, 2023
ff456fa
[maven-release-plugin] prepare for next development iteration
IHEII Sep 18, 2023
6e932db
[maven-release-plugin] prepare release obkv-table-client-1.2.5
IHEII Sep 18, 2023
d419305
[maven-release-plugin] prepare for next development iteration
IHEII Sep 18, 2023
3314598
[Feat] direct load java client
Oct 10, 2023
0378d93
[Fix] obtable init check (#48)
IHEII Oct 11, 2023
fb5013c
[Test] enable basic ttl test for 4.x (#49)
IHEII Oct 11, 2023
c7157cb
[fix] direct load retry
suz-yang Oct 13, 2023
9b63e3b
[Fix] direct load missing error code
suz-yang Oct 13, 2023
6db15bd
[Fix] test case (#53)
IHEII Nov 1, 2023
e512667
[Chore] update dependencies (#52)
IHEII Nov 1, 2023
d250f03
[Fix] ODP test case (#54)
IHEII Nov 1, 2023
942f794
[Fix] test cases (#55)
IHEII Nov 3, 2023
8db5e39
[Fix] table direct load rpc timeout (#56)
suz-yang Nov 9, 2023
8873e5b
[Fix] CE login with ODP (#57)
IHEII Nov 10, 2023
844497d
[Test] add batch test (#58)
IHEII Nov 21, 2023
2bd43d0
[Test] apd/inc in batch op (#59)
IHEII Nov 24, 2023
50df6b9
[Chore] fix Javadoc warning
IHEII Nov 24, 2023
6ced3eb
[maven-release-plugin] prepare release obkv-table-client-1.2.6
IHEII Nov 24, 2023
e87cbd7
[maven-release-plugin] prepare for next development iteration
IHEII Nov 24, 2023
1c8f7fc
adapt error message (#61)
WeiXinChan Dec 15, 2023
8b9d9f3
check credential before encode (#62)
WeiXinChan Dec 18, 2023
00eee50
obkv-client:check tenant name after connect && insert null into auto-…
foronedream Dec 25, 2023
fe6da82
obkv connection bugfix (#65)
foronedream Dec 26, 2023
d6c2d16
delete row element precheck (#66)
foronedream Dec 26, 2023
c1df9dd
incorrect comment (#67)
foronedream Dec 26, 2023
0c80ab2
fix tests (#69)
WeiXinChan Dec 27, 2023
df76fd9
[Chore] add ci (#68)
IHEII Dec 27, 2023
98b9781
[Fix] dateTime in partition table (#70)
IHEII Jan 2, 2024
62bd0b5
[feat] support global index for obkv (#51)
GroundWu Jan 2, 2024
86bc228
fix: query with primary index fail when indexname specify to 'primary…
GroundWu Jan 5, 2024
6b89ab0
[Chore] format
IHEII Jan 8, 2024
ad13c1b
[maven-release-plugin] prepare release obkv-table-client-1.2.7
IHEII Jan 8, 2024
2810983
[maven-release-plugin] prepare for next development iteration
IHEII Jan 8, 2024
1e28466
[Feat] support checkAndInsUp (#64)
shenyunlong Jan 8, 2024
540fedd
fix null pointer exception when error code is unknown from higher ver…
WeiXinChan Jan 10, 2024
1f7d239
fix test case error code not match (#74)
GroundWu Jan 10, 2024
84806f4
[Test] add cross-partition test for checkAndInsUp (#75)
shenyunlong Jan 10, 2024
4b90a3f
[Test] add checkAndInsUp test for non-partitioned table (#76)
shenyunlong Jan 15, 2024
30d397a
[Fix] refresh when truncate table (#77)
IHEII Jan 17, 2024
da169d1
[Fix] sub partition in query (#78)
IHEII Jan 18, 2024
8958e48
[Fix] time scale (#81)
IHEII Jan 24, 2024
7a511c8
[Fix] sub part query & key part (#82)
IHEII Jan 25, 2024
d7ad274
[Chore] Adjust ObLSOp Format (#83)
shenyunlong Jan 25, 2024
ee043d0
use mysql driver by default (#85)
whhe Jan 30, 2024
96ebed0
[Feat] dict column name (#84)
IHEII Jan 31, 2024
a8ad2f1
[Feat] Add new Object format for LS Op (#86)
shenyunlong Jan 31, 2024
b9dfa38
[Fix] property & hashset in LSOp (#87)
IHEII Feb 1, 2024
92dc6da
[Fix] upperBound in range part (#88)
IHEII Feb 4, 2024
335e516
[Fix] the exception message when execute LS batch is inaccurate (#89)
shenyunlong Feb 4, 2024
72c529b
[Fix] query in singleOperation (#90)
IHEII Feb 4, 2024
5687dfd
Merge branch 'master' of github.com:eemjwu/obkv-table-client-java
eemjwu Mar 1, 2024
26a5b74
Merge remote-tracking branch 'upstream/master'
eemjwu Mar 1, 2024
3237b92
Mutation execute With LSBatch Op
eemjwu Mar 1, 2024
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 @@ -198,9 +198,10 @@ public BatchOperationResult executeWithLSBatchOp() throws Exception {
throw new IllegalArgumentException("table name is null");
}
ObTableClientLSBatchOpsImpl batchOps;
boolean hasSetRowkeyElement = false;

if (client instanceof ObTableClient) {
batchOps = new ObTableClientLSBatchOpsImpl(tableName, (ObTableClient) client);
boolean hasSetRowkeyElement = false;
for (Object operation : operations) {
if (operation instanceof CheckAndInsUp) {
CheckAndInsUp checkAndInsUp = (CheckAndInsUp) operation;
Expand All @@ -211,6 +212,18 @@ public BatchOperationResult executeWithLSBatchOp() throws Exception {
rowKeyNames.toArray(new String[0]));
hasSetRowkeyElement = true;
}
} else if (operation instanceof Mutation) {
Mutation mutation = (Mutation) operation;
batchOps.addOperation(mutation);
if (!hasSetRowkeyElement && mutation.getRowKeyNames() != null) {
List<String> rowKeyNames = mutation.getRowKeyNames();
((ObTableClient) client).addRowKeyElement(tableName,
rowKeyNames.toArray(new String[0]));
hasSetRowkeyElement = true;
}
} else if (operation instanceof TableQuery) {
TableQuery query = (TableQuery) operation;
batchOps.addOperation(query);
} else {
throw new IllegalArgumentException(
"The operations in batch must be all checkAndInsUp or all non-checkAndInsUp");
Expand All @@ -220,6 +233,7 @@ public BatchOperationResult executeWithLSBatchOp() throws Exception {
throw new IllegalArgumentException(
"execute batch using ObTable diretly is not supporeted");
}
batchOps.setReturningAffectedEntity(withResult);
return new BatchOperationResult(batchOps.executeWithResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public enum ObTableOperationType {
APPEND(7), // append column value
SCAN(8), // query
TTL(9), // observer internal type, not used by client
CHECK_AND_INSERT_UP(10), INVALID(11);
CHECK_AND_INSERT_UP(10),
PUT(11),
INVALID(15);

private int value;
private static Map<Integer, ObTableOperationType> map = new HashMap<Integer, ObTableOperationType>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
import com.alipay.oceanbase.rpc.exception.*;
import com.alipay.oceanbase.rpc.location.model.ObServerRoute;
import com.alipay.oceanbase.rpc.location.model.partition.ObPair;
import com.alipay.oceanbase.rpc.mutation.InsertOrUpdate;
import com.alipay.oceanbase.rpc.mutation.Mutation;
import com.alipay.oceanbase.rpc.mutation.*;
import com.alipay.oceanbase.rpc.mutation.result.MutationResult;
import com.alipay.oceanbase.rpc.protocol.payload.ResultCodes;
import com.alipay.oceanbase.rpc.protocol.payload.impl.ObRowKey;
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.*;
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.mutate.ObTableQueryAndMutate;
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.query.ObNewRange;
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.query.ObTableQuery;
import com.alipay.oceanbase.rpc.table.api.TableQuery;
import com.alipay.oceanbase.rpc.threadlocal.ThreadLocalMap;
import com.alipay.oceanbase.rpc.util.MonitorUtil;
import com.alipay.oceanbase.rpc.util.TableClientLoggerFactory;
Expand Down Expand Up @@ -169,6 +169,100 @@ public void addOperation(CheckAndInsUp checkAndInsUp) {
addOperation(singleOp);
}

public void addOperation(TableQuery query) throws Exception {
// entity
String[] rowKeyNames = query.getRowKey().getColumns();
if (rowKeyNames == null || rowKeyNames.length == 0) {
throw new IllegalArgumentException("rowKey is empty in get op");
}
Object[] rowKey = query.getRowKey().getValues();
String[] propertiesNames = query.getSelectColumns().toArray(new String[0]);
ObTableSingleOpEntity entity = ObTableSingleOpEntity.getInstance(rowKeyNames, rowKey,
propertiesNames, null);

ObTableSingleOp singleOp = new ObTableSingleOp();
singleOp.setSingleOpType(ObTableOperationType.GET);
singleOp.addEntity(entity);
addOperation(singleOp);
}

public void addOperation(Mutation mutation) throws Exception {
// entity
String[] rowKeyNames = null;
Object[] rowKey = null;
String[] propertiesNames = null;
Object[] propertiesValues = null;

ObTableOperationType type = mutation.getOperationType();
switch (type) {
case GET:
throw new IllegalArgumentException("Invalid type in batch operation, "
+ type);
case INSERT:
((Insert) mutation).removeRowkeyFromMutateColval();
rowKeyNames = ((Insert) mutation).getRowKeyNames().toArray(new String[0]);
rowKey = mutation.getRowKey();
propertiesNames = ((Insert) mutation).getColumns();
propertiesValues = ((Insert) mutation).getValues();
break;
case DEL:
rowKeyNames = ((Delete) mutation).getRowKeyNames().toArray(new String[0]);
rowKey = mutation.getRowKey();
break;
case UPDATE:
((Update) mutation).removeRowkeyFromMutateColval();
rowKeyNames = ((Update) mutation).getRowKeyNames().toArray(new String[0]);
rowKey = mutation.getRowKey();
propertiesNames = ((Update) mutation).getColumns();
propertiesValues = ((Update) mutation).getValues();
break;
case INSERT_OR_UPDATE:
((InsertOrUpdate) mutation).removeRowkeyFromMutateColval();
rowKeyNames = ((InsertOrUpdate) mutation).getRowKeyNames().toArray(new String[0]);
rowKey = mutation.getRowKey();
propertiesNames = ((InsertOrUpdate) mutation).getColumns();
propertiesValues = ((InsertOrUpdate) mutation).getValues();
break;
case REPLACE:
((Replace) mutation).removeRowkeyFromMutateColval();
rowKeyNames = ((Replace) mutation).getRowKeyNames().toArray(new String[0]);
rowKey = mutation.getRowKey();
propertiesNames = ((Replace) mutation).getColumns();
propertiesValues = ((Replace) mutation).getValues();
break;
case INCREMENT:
((Increment) mutation).removeRowkeyFromMutateColval();
rowKeyNames = ((Increment) mutation).getRowKeyNames().toArray(new String[0]);
rowKey = mutation.getRowKey();
propertiesNames = ((Increment) mutation).getColumns();
propertiesValues = ((Increment) mutation).getValues();
break;
case APPEND:
((Append) mutation).removeRowkeyFromMutateColval();
rowKeyNames = ((Append) mutation).getRowKeyNames().toArray(new String[0]);
rowKey = mutation.getRowKey();
propertiesNames = ((Append) mutation).getColumns();
propertiesValues = ((Append) mutation).getValues();
break;
case PUT:
((Put) mutation).removeRowkeyFromMutateColval();
rowKeyNames = ((Put) mutation).getRowKeyNames().toArray(new String[0]);
rowKey = mutation.getRowKey();
propertiesNames = ((Put) mutation).getColumns();
propertiesValues = ((Put) mutation).getValues();
break;
default:
throw new ObTableException("unknown operation type " + type);
}

ObTableSingleOpEntity entity = ObTableSingleOpEntity.getInstance(rowKeyNames, rowKey,
propertiesNames, propertiesValues);
ObTableSingleOp singleOp = new ObTableSingleOp();
singleOp.setSingleOpType(type);
singleOp.addEntity(entity);
addOperation(singleOp);
}

/*
* Execute.
*/
Expand Down
Loading