Skip to content

Commit 249177d

Browse files
committed
add ob verison check when do fts query
1 parent 9a0bd19 commit 249177d

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/main/java/com/alipay/oceanbase/rpc/ObGlobal.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ public static boolean isLsOpSupport() {
8686
|| OB_VERSION >= OB_VERSION_4_3_4_0;
8787
}
8888

89+
public static boolean isFtsQuerySupport() {
90+
return OB_VERSION >= OB_VERSION_4_3_5_1;
91+
}
92+
8993
public static boolean isReturnOneResultSupport() {
9094
return OB_VERSION >= OB_VERSION_4_2_3_0 && OB_VERSION < OB_VERSION_4_3_0_0
9195
|| OB_VERSION >= OB_VERSION_4_3_4_0;
@@ -96,6 +100,8 @@ public static boolean isReturnOneResultSupport() {
96100
public static final long OB_VERSION_4_3_0_0 = calcVersion(4, (short) 3, (byte) 0, (byte) 0);
97101

98102
public static final long OB_VERSION_4_3_4_0 = calcVersion(4, (short) 3, (byte) 4, (byte) 0);
103+
// todo @weifeng : change ob version to 4_3_5_1
104+
public static final long OB_VERSION_4_3_5_1 = calcVersion(4, (short) 3, (byte) 5, (byte) 0);
99105

100106
public static long OB_VERSION = calcVersion(0, (short) 0, (byte) 0, (byte) 0);
101107
}

src/main/java/com/alipay/oceanbase/rpc/table/ObTableClientQueryImpl.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
package com.alipay.oceanbase.rpc.table;
1919

20+
import com.alipay.oceanbase.rpc.ObGlobal;
2021
import com.alipay.oceanbase.rpc.ObTableClient;
22+
import com.alipay.oceanbase.rpc.exception.FeatureNotSupportedException;
2123
import com.alipay.oceanbase.rpc.exception.ObTableException;
2224
import com.alipay.oceanbase.rpc.location.model.partition.ObPair;
2325
import com.alipay.oceanbase.rpc.mutation.Row;
@@ -129,6 +131,15 @@ public void checkArgumentBeforeExec() throws Exception {
129131
throw new ObTableException("offset can not be use without limit");
130132
} else if (tableName == null || tableName.isEmpty()) {
131133
throw new IllegalArgumentException("table name is null");
134+
} else if (tableQuery.isFTSQuery()) {
135+
if (!ObGlobal.isFtsQuerySupport()) {
136+
throw new FeatureNotSupportedException("full text query is not supported in "+ObGlobal.OB_VERSION);
137+
}
138+
if (tableQuery.getIndexName() == null || tableQuery.getIndexName().isEmpty()
139+
|| tableQuery.getIndexName().equalsIgnoreCase("primary")) {
140+
throw new IllegalArgumentException(
141+
"use fulltext search but specified index name is not fulltext index");
142+
}
132143
}
133144
}
134145

@@ -159,15 +170,6 @@ private AbstractQueryStreamResult commonExecute(InitQueryResultCallback<Abstract
159170
// fill a whole range if no range is added explicitly.
160171
if (tableQuery.getKeyRanges().isEmpty()) {
161172
tableQuery.addKeyRange(ObNewRange.getWholeRange());
162-
} else if (tableQuery.isFTSQuery()) {
163-
// Currently, fulltext query only support scan all partitions
164-
tableQuery.getKeyRanges().clear();
165-
tableQuery.addKeyRange(ObNewRange.getWholeRange());
166-
if (tableQuery.getIndexName() == null || tableQuery.getIndexName().isEmpty()
167-
|| tableQuery.getIndexName().equalsIgnoreCase("primary")) {
168-
throw new IllegalArgumentException(
169-
"use fulltext search but specified index name is not fulltext index");
170-
}
171173
}
172174

173175
// init partitionObTables

0 commit comments

Comments
 (0)