Apache Phoenix中有效范围错误的限定符选择'其中'和'抵消'子句

时间:2017-05-27 08:26:19

标签: phoenix

我使用phoenix jdbc驱动程序和

创建了一个表
create table myns.test(
    "id" integer,
    "cf"."col1" varchar null,
    "cf"."col2" varchar null,
    "cf2"."col3" varchar null,
    "cf2"."col4" varchar null,
    constraint pk primary key("id")
)

并将10,000,000行数据上传到表中。数据看起来像

+-----+--------+---------+-------+---------+
| id  |  col1  |  col2   | col3  |  col4   |
+-----+--------+---------+-------+---------+
| 0   | name0  | title0  | job0  | col4-0  |
| 1   | name1  | title1  | job1  | col4-1  |
| 2   | name2  | title2  | job2  | col4-2  |
| 3   | name3  | title3  | job3  | col4-3  |
| 4   | name4  | title4  | job4  | col4-4  |
| 5   | name5  | title5  | job5  | col4-5  |
| 6   | name6  | title6  | job6  | col4-6  |
| 7   | name7  | title7  | job7  | col4-7  |
| 8   | name8  | title8  | job8  | col4-8  |
| 9   | name9  | title9  | job9  | col4-9  |
+-----+--------+---------+-------+---------+

然后我想尝试分页查询。

select * from myns.test limit 10 offset 20

给出了以下

+-----+---------+----------+--------+----------+
| id  |  col1   |   col2   |  col3  |   col4   |
+-----+---------+----------+--------+----------+
| 20  | name20  | title20  | job20  | col4-20  |
| 21  | name21  | title21  | job21  | col4-21  |
| 22  | name22  | title22  | job22  | col4-22  |
| 23  | name23  | title23  | job23  | col4-23  |
| 24  | name24  | title24  | job24  | col4-24  |
| 25  | name25  | title25  | job25  | col4-25  |
| 26  | name26  | title26  | job26  | col4-26  |
| 27  | name27  | title27  | job27  | col4-27  |
| 28  | name28  | title28  | job28  | col4-28  |
| 29  | name29  | title29  | job29  | col4-29  |
+-----+---------+----------+--------+----------+

这是正确的。我也试过

select * from myns.test where "cf"."col1" like '%name2%' limit 10

返回

+----------+--------------+---------------+-------------+---------------+
|    id    |     col1     |     col2      |    col3     |     col4      |
+----------+--------------+---------------+-------------+---------------+
| 2        | name2        | title2        | job2        | col4-2        |
| 2234811  | name2234811  | title2234811  | job2234811  | col4-2234811  |
| 20       | name20       | title20       | job20       | col4-20       |
| 2234812  | name2234812  | title2234812  | job2234812  | col4-2234812  |
| 21       | name21       | title21       | job21       | col4-21       |
| 2234813  | name2234813  | title2234813  | job2234813  | col4-2234813  |
| 22       | name22       | title22       | job22       | col4-22       |
| 2234814  | name2234814  | title2234814  | job2234814  | col4-2234814  |
| 23       | name23       | title23       | job23       | col4-23       |
| 2234815  | name2234815  | title2234815  | job2234815  | col4-2234815  |
+----------+--------------+---------------+-------------+---------------+

以下也很好。

select * from myns.test where "cf"."col1" like '%name222222%'

但是当我尝试

select * from myns.test where "cf"."col1" like '%name2%' limit 10 offset 200

发生了异常

Error: org.apache.hadoop.hbase.DoNotRetryIOException: MYNS.TEST,,1495615200438.aef5a753122f9e3a570758aea278f692.: Qualifier 12 is out of the valid range - (11, 11)
at org.apache.phoenix.util.ServerUtil.createIOException(ServerUtil.java:89)
at org.apache.phoenix.util.ServerUtil.throwIOException(ServerUtil.java:55)
at org.apache.phoenix.coprocessor.BaseScannerRegionObserver$1.nextRaw(BaseScannerRegionObserver.java:474)
at org.apache.phoenix.iterate.RegionScannerResultIterator.next(RegionScannerResultIterator.java:61)
at org.apache.phoenix.iterate.DelegateResultIterator.next(DelegateResultIterator.java:44)
at org.apache.phoenix.iterate.OffsetResultIterator.next(OffsetResultIterator.java:42)
at org.apache.phoenix.coprocessor.ScanRegionObserver.getOffsetScanner(ScanRegionObserver.java:265)
at org.apache.phoenix.coprocessor.ScanRegionObserver.doPostScannerOpen(ScanRegionObserver.java:247)
at org.apache.phoenix.coprocessor.BaseScannerRegionObserver$RegionScannerHolder.overrideDelegate(BaseScannerRegionObserver.java:237)
at org.apache.phoenix.coprocessor.BaseScannerRegionObserver$RegionScannerHolder.nextRaw(BaseScannerRegionObserver.java:282)
at org.apache.hadoop.hbase.regionserver.RSRpcServices.scan(RSRpcServices.java:2580)
at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:33648)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2188)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:112)
at org.apache.hadoop.hbase.ipc.RpcExecutor.consumerLoop(RpcExecutor.java:133)
at org.apache.hadoop.hbase.ipc.RpcExecutor$1.run(RpcExecutor.java:108)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IndexOutOfBoundsException: Qualifier 12 is out of the valid range - (11, 11)
    at org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList.checkQualifierRange(EncodedColumnQualiferCellsList.java:388)
    at org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList.add(EncodedColumnQualiferCellsList.java:138)
    at org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList.add(EncodedColumnQualiferCellsList.java:55)
    at org.apache.hadoop.hbase.regionserver.StoreScanner.next(StoreScanner.java:560)
    at org.apache.hadoop.hbase.regionserver.KeyValueHeap.next(KeyValueHeap.java:150)
    at org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.populateResult(HRegion.java:5731)
    at org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.nextInternal(HRegion.java:5894)
    at org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.nextRaw(HRegion.java:5668)
    at org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.nextRaw(HRegion.java:5654)
    at org.apache.phoenix.coprocessor.BaseScannerRegionObserver$1.nextRaw(BaseScannerRegionObserver.java:442)
    ... 14 more (state=08000,code=101)

所有sql查询都在' sqlline.py'中运行。任何帮助表示赞赏。

0 个答案:

没有答案