Phoenix 索引初探

Phoenix中 创建一个表:

0: jdbc:phoenix:localhost> create table test ( id varchar not null primary key, cf1.a varchar, cf1.b varchar, cf2.c varchar , cf2.d varchar);


Phoenix中查看其定义 

0: jdbc:phoenix:localhost> !describe test

+------------+-------------+------------+-------------+-----------+------------+-------------+---------------+-------------- 
| TABLE_CAT  | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME  | ......
+------------+-------------+------------+-------------+-----------+------------+-------------+---------------+-------------- 
| null                         | null                         | TEST              |ID                                | 12          | VARCHAR    | ......
| CF1                         | null                         | TEST              |A                                 | 12        | VARCHAR    |......
| CF1                         | null                         | TEST              |B                                 | 12        | VARCHAR    | ......
| CF2                         | null                         | TEST              |C                                 | 12        | VARCHAR    | ......
| CF2                         | null                         | TEST              | D                                | 12        | VARCHAR    | ......
+------------+-------------+------------+-------------+-----------+------------+-------------+---------------+-------------- 

HBase中查看该表的定义:
hbase(main):009:0> describe 'TEST'   

                                                                                                                                                                                                                       
 {NAME=>'TEST',coprocessor$6=>'|org.apache.hbase.index.Indexer|1073741823|index.builder=org.apache.phoenix.index.PhoenixIndexBuilder,org.apache.hbase.index.codec.class=org.apache.phoenix.index.PhoenixIndexCodec', coprocessor$5 => '|org.apache.phoenix.coprocessor.ServerCachingEndpointImpl|1|', coprocessor$4 =>'|org.apache.phoenix.join.HashJoiningRegionObserver|1|', coprocessor$3 => '|org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver|1|', coprocessor$2 => '|org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver|1|', coprocessor$1 => '|org.apache.phoenix.coprocessor.ScanRegionObserver|1|', FAMILIES => [{NAME => 'CF1', DATA_BLOCK_ENCODING =>'FAST_DIFF', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'true', BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE _ON_DISK => 'true', BLOCKCACHE => 'true'}, {NAME => 'CF2', DATA_BLOCK_ENCODING => 'FAST_DIFF', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647' , KEEP_DELETED_CELLS => 'true', BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE_ON_DISK => 'true', BLOCKCACHE => 'true'}]}   


 采用了Phoenix 自带的 PhoenixIndexBuilder 、PhoenixIndexCodec、coprocessor.ServerCachingEndpointImpl、coprocessor.GroupedAggregateRegionObserver、coprocessor.UngroupedAggregateRegionObserver、coprocessor.ScanRegionObserver


而非Phoenix表的定义一般为:
                                                                                                                                                                                                                                 
 {NAME => 'HEHE', FAMILIES => [{NAME => 'CF1', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE_ON_DISK => 'true', BLOCKCACHE => 'true'}, {NAME => 'CF2', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE_ON_DISK => 'true', BLOCKCACHE => 'true'}]}  

将表改为 immutable,即表中数据只会写入,不会修改
0: jdbc:phoenix:localhost> alter table test set immutable_rows=true;


在字段a上创建索引 index index_test_a:
0: jdbc:phoenix:localhost> create index index_test_a on test(a);


查看索引 index index_test_a :
0: jdbc:phoenix:localhost> !describe index_test_a 
+------------+-------------+------------+-------------+-----------+------------+-------------+---------------+------------- 
| TABLE_CAT  | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME  |  
+------------+-------------+------------+-------------+-----------+------------+----------- 
| null       | null        | INDEX_TEST_A | CF1:A       | 12            | VARCHAR    | 
| null       | null        | INDEX_TEST_A | :ID             | 12            | VARCHAR    | 
+------------+-------------+------------+-------------+-----------+------------+----------- 


实际上是生成一个新表 'INDEX_TEST_A' , HBase 中查看为:
hbase(main):014:0> describe 'INDEX_TEST_A'  

{NAME => 'INDEX_TEST_A', coprocessor$5 => '|org.apache.phoenix.coprocessor.ServerCachingEndpointImpl|1|', coprocessor$4 => '|org.apache.phoenix.join.HashJoiningRegionObserver|1|', coprocessor$3 => '|org.apache.phoenix.coproc essor.GroupedAggregateRegionObserver|1|', coprocessor$2 => '|org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver|1|', coprocessor$1 => '|org.apache.phoenix.coprocessor.ScanRegionObserver|1|', MAX_FILESIZE => '2684354560', FAMILIES => [{NAME => '_0', DATA_BLOCK_ENCODING => 'FAST_DIFF', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS=> 'true', BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE_ON_DISK => 'true', BLOCKCACHE => 'true'}]}                                                                       
 


在字段a上创建索引 index index_test_a_in_b_c:


0: jdbc:phoenix:localhost> create index index_test_a_in_b_c on test(a) include(b,c);
0: jdbc:phoenix:localhost> !describe index_test_a_in_b_c 
+------------+-------------+------------+-------------+-----------+------------+-------------+---------------+--------------
| TABLE_CAT  | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME  
+------------+-------------+------------+-------------+-----------+------------+-------------+---------------+--------------
| null         | null        | INDEX_TEST_A_IN_B_C     | CF1:A       | 12        | VARCHAR    | 
| null         | null        | INDEX_TEST_A_IN_B_C     | :ID             | 12        | VARCHAR    | 
| CF1        | null        | INDEX_TEST_A_IN_B_C     | CF1:B       | 12        | VARCHAR    | 
| CF2        | null        | INDEX_TEST_A_IN_B_C     | CF2:C       | 12        | VARCHAR    | 
+------------+-------------+------------+-------------+-----------+------------+-------------+-----------


在字段a,b上创建索引 index index_test_a_b_in_c_d:


0: jdbc:phoenix:localhost> create index index_test_a_b_in_c_d on test(a,b) include(c,d);
0: jdbc:phoenix:localhost> !describe index_test_a_b_in_c_d 
+------------+-------------+------------+-------------+-----------+------------+-------------+---------------+---------------
| TABLE_CAT  | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME  |
+------------+-------------+------------+-------------+-----------+------------+-------------+---------------+--------------
| null       | null          | INDEX_TEST_A_B_IN_C_D | CF1:A       | 12        | VARCHAR    |
| null       | null          | INDEX_TEST_A_B_IN_C_D | CF1:B       | 12        | VARCHAR    | 
| null       | null          | INDEX_TEST_A_B_IN_C_D | :ID             | 12        | VARCHAR    |
| CF2        | null        | INDEX_TEST_A_B_IN_C_D | CF2:C       | 12        | VARCHAR    | 
| CF2        | null        | INDEX_TEST_A_B_IN_C_D | CF2:D       | 12        | VARCHAR    | 
+------------+-------------+------------+-------------+-----------+------------+-------------+-------------
        



插入数据:
        String username="";

         String password="";
        String url = "jdbc:phoenix:10.1.20.129,10.1.20.128,10.1.20.44";        
        Connection connection = DriverManager.getConnection(url, username, password);
        Statement statement = connection.createStatement();
         for (int i = 10; i < 29; i++) {  
            statement.executeUpdate("upsert into test values ('10000"+i+"','"+i * 2%10+"','"+i * 3%10+"','"+i * 5%10+"','"+i * 7%10+"')");     
        }   
        connection.commit();
        statement.close();
        connection.close();


此时各表数据:


表Test

0: jdbc:phoenix:localhost> select * from Test;
+------------+------------+------------+------------+------------+
|     ID     |     A      |     B      |     C      |     D      |
+------------+------------+------------+------------+------------+
| 1000010    | 0          | 0          | 0          | 0          |
| 1000020    | 0          | 0          | 0          | 0          |
| 1000015    | 0          | 5          | 5          | 5          |
| 1000025    | 0          | 5          | 5          | 5          |
| 1000011    | 2          | 3          | 5          | 7          |
| 1000021    | 2          | 3          | 5          | 7          |
| 1000016    | 2          | 8          | 0          | 2          |
| 1000026    | 2          | 8          | 0          | 2          |
| 1000017    | 4          | 1          | 5          | 9          |
| 1000027    | 4          | 1          | 5          | 9          |
| 1000012    | 4          | 6          | 0          | 4          |
| 1000022    | 4          | 6          | 0          | 4          |
| 1000018    | 6          | 4          | 0          | 6          |
| 1000028    | 6          | 4          | 0          | 6          |
| 1000013    | 6          | 9          | 5          | 1          |
| 1000023    | 6          | 9          | 5          | 1          |
| 1000014    | 8          | 2          | 0          | 8          |
| 1000024    | 8          | 2          | 0          | 8          |
| 1000019    | 8          | 7          | 5          | 3          |
+------------+

hbase(main):017:0> scan 'TEST'
ROW                                           COLUMN+CELL                                                                                                                       
 1000010                                      column=CF1:A, timestamp=1414936659069, value=0                                                                                    
 1000010                                      column=CF1:B, timestamp=1414936659069, value=0                                                                                    
 1000010                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000010                                      column=CF2:C, timestamp=1414936659069, value=0                                                                                    
 1000010                                      column=CF2:D, timestamp=1414936659069, value=0                                                                                    
 1000011                                      column=CF1:A, timestamp=1414936659069, value=2                                                                                    
 1000011                                      column=CF1:B, timestamp=1414936659069, value=3                                                                                    
 1000011                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000011                                      column=CF2:C, timestamp=1414936659069, value=5                                                                                    
 1000011                                      column=CF2:D, timestamp=1414936659069, value=7                                                                                    
 1000012                                      column=CF1:A, timestamp=1414936659069, value=4                                                                                    
 1000012                                      column=CF1:B, timestamp=1414936659069, value=6                                                                                    
 1000012                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000012                                      column=CF2:C, timestamp=1414936659069, value=0                                                                                    
 1000012                                      column=CF2:D, timestamp=1414936659069, value=4                                                                                    
 1000013                                      column=CF1:A, timestamp=1414936659069, value=6                                                                                    
 1000013                                      column=CF1:B, timestamp=1414936659069, value=9                                                                                    
 1000013                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000013                                      column=CF2:C, timestamp=1414936659069, value=5                                                                                    
 1000013                                      column=CF2:D, timestamp=1414936659069, value=1                                                                                    
 1000014                                      column=CF1:A, timestamp=1414936659069, value=8                                                                                    
 1000014                                      column=CF1:B, timestamp=1414936659069, value=2                                                                                    
 1000014                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000014                                      column=CF2:C, timestamp=1414936659069, value=0                                                                                    
 1000014                                      column=CF2:D, timestamp=1414936659069, value=8                                                                                    
 1000015                                      column=CF1:A, timestamp=1414936659069, value=0                                                                                    
 1000015                                      column=CF1:B, timestamp=1414936659069, value=5                                                                                    
 1000015                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000015                                      column=CF2:C, timestamp=1414936659069, value=5                                                                                    
 1000015                                      column=CF2:D, timestamp=1414936659069, value=5                                                                                    
 1000016                                      column=CF1:A, timestamp=1414936659069, value=2                                                                                    
 1000016                                      column=CF1:B, timestamp=1414936659069, value=8                                                                                    
 1000016                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000016                                      column=CF2:C, timestamp=1414936659069, value=0                                                                                    
 1000016                                      column=CF2:D, timestamp=1414936659069, value=2                                                                                    
 1000017                                      column=CF1:A, timestamp=1414936659069, value=4                                                                                    
 1000017                                      column=CF1:B, timestamp=1414936659069, value=1                                                                                    
 1000017                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000017                                      column=CF2:C, timestamp=1414936659069, value=5                                                                                    
 1000017                                      column=CF2:D, timestamp=1414936659069, value=9                                                                                    
 1000018                                      column=CF1:A, timestamp=1414936659069, value=6                                                                                    
 1000018                                      column=CF1:B, timestamp=1414936659069, value=4                                                                                    
 1000018                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000018                                      column=CF2:C, timestamp=1414936659069, value=0                                                                                    
 1000018                                      column=CF2:D, timestamp=1414936659069, value=6                                                                                    
 1000019                                      column=CF1:A, timestamp=1414936659069, value=8                                                                                    
 1000019                                      column=CF1:B, timestamp=1414936659069, value=7                                                                                    
 1000019                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000019                                      column=CF2:C, timestamp=1414936659069, value=5                                                                                    
 1000019                                      column=CF2:D, timestamp=1414936659069, value=3                                                                                    
 1000020                                      column=CF1:A, timestamp=1414936659069, value=0                                                                                    
 1000020                                      column=CF1:B, timestamp=1414936659069, value=0                                                                                    
 1000020                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000020                                      column=CF2:C, timestamp=1414936659069, value=0                                                                                    
 1000020                                      column=CF2:D, timestamp=1414936659069, value=0                                                                                    
 1000021                                      column=CF1:A, timestamp=1414936659069, value=2                                                                                    
 1000021                                      column=CF1:B, timestamp=1414936659069, value=3                                                                                    
 1000021                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000021                                      column=CF2:C, timestamp=1414936659069, value=5                                                                                    
 1000021                                      column=CF2:D, timestamp=1414936659069, value=7                                                                                    
 1000022                                      column=CF1:A, timestamp=1414936659069, value=4                                                                                    
 1000022                                      column=CF1:B, timestamp=1414936659069, value=6                                                                                    
 1000022                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000022                                      column=CF2:C, timestamp=1414936659069, value=0                                                                                    
 1000022                                      column=CF2:D, timestamp=1414936659069, value=4                                                                                    
 1000023                                      column=CF1:A, timestamp=1414936659069, value=6                                                                                    
 1000023                                      column=CF1:B, timestamp=1414936659069, value=9                                                                                    
 1000023                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000023                                      column=CF2:C, timestamp=1414936659069, value=5                                                                                    
 1000023                                      column=CF2:D, timestamp=1414936659069, value=1                                                                                    
 1000024                                      column=CF1:A, timestamp=1414936659069, value=8                                                                                    
 1000024                                      column=CF1:B, timestamp=1414936659069, value=2                                                                                    
 1000024                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000024                                      column=CF2:C, timestamp=1414936659069, value=0                                                                                    
 1000024                                      column=CF2:D, timestamp=1414936659069, value=8                                                                                    
 1000025                                      column=CF1:A, timestamp=1414936659069, value=0                                                                                    
 1000025                                      column=CF1:B, timestamp=1414936659069, value=5                                                                                    
 1000025                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000025                                      column=CF2:C, timestamp=1414936659069, value=5                                                                                    
 1000025                                      column=CF2:D, timestamp=1414936659069, value=5                                                                                    
 1000026                                      column=CF1:A, timestamp=1414936659069, value=2                                                                                    
 1000026                                      column=CF1:B, timestamp=1414936659069, value=8                                                                                    
 1000026                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000026                                      column=CF2:C, timestamp=1414936659069, value=0                                                                                    
 1000026                                      column=CF2:D, timestamp=1414936659069, value=2                                                                                    
 1000027                                      column=CF1:A, timestamp=1414936659069, value=4                                                                                    
 1000027                                      column=CF1:B, timestamp=1414936659069, value=1                                                                                    
 1000027                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000027                                      column=CF2:C, timestamp=1414936659069, value=5                                                                                    
 1000027                                      column=CF2:D, timestamp=1414936659069, value=9                                                                                    
 1000028                                      column=CF1:A, timestamp=1414936659069, value=6                                                                                    
 1000028                                      column=CF1:B, timestamp=1414936659069, value=4                                                                                    
 1000028                                      column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 1000028                                      column=CF2:C, timestamp=1414936659069, value=0                                                                                    
 1000028                                      column=CF2:D, timestamp=1414936659069, value=6                   



索引  INDEX_TEST_A :
0: jdbc:phoenix:localhost> select * from INDEX_TEST_A;
+------------+------------+
|   CF1:A    |    :ID     |
+------------+------------+
| 0          | 1000010    |
| 0          | 1000015    |
| 0          | 1000020    |
| 0          | 1000025    |
| 2          | 1000011    |
| 2          | 1000016    |
| 2          | 1000021    |
| 2          | 1000026    |
| 4          | 1000012    |
| 4          | 1000017    |
| 4          | 1000022    |
| 4          | 1000027    |
| 6          | 1000013    |
| 6          | 1000018    |
| 6          | 1000023    |
| 6          | 1000028    |
| 8          | 1000014    |
| 8          | 1000019    |
| 8          | 1000024    |
+------------+------------+

hbase(main):018:0> scan 'INDEX_TEST_A'


ROW                                           COLUMN+CELL                                                                                                                       
 0\x001000010                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 0\x001000015                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 0\x001000020                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 0\x001000025                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 2\x001000011                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 2\x001000016                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 2\x001000021                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 2\x001000026                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 4\x001000012                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 4\x001000017                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 4\x001000022                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 4\x001000027                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 6\x001000013                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 6\x001000018                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 6\x001000023                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 6\x001000028                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 8\x001000014                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 8\x001000019                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
 8\x001000024                                 column=_0:_0, timestamp=1414936659069, value=      


索引 INDEX_TEST_A_IN_B_C:
0: jdbc:phoenix:localhost> select * from INDEX_TEST_A_IN_B_C;
+------------+------------+------------+------------+
|   CF1:A    |    :ID     |   CF1:B    |   CF2:C    |
+------------+------------+------------+------------+
| 0          | 1000010    | 0          | 0          |
| 0          | 1000015    | 5          | 5          |
| 0          | 1000020    | 0          | 0          |
| 0          | 1000025    | 5          | 5          |
| 2          | 1000011    | 3          | 5          |
| 2          | 1000016    | 8          | 0          |
| 2          | 1000021    | 3          | 5          |
| 2          | 1000026    | 8          | 0          |
| 4          | 1000012    | 6          | 0          |
| 4          | 1000017    | 1          | 5          |
| 4          | 1000022    | 6          | 0          |
| 4          | 1000027    | 1          | 5          |
| 6          | 1000013    | 9          | 5          |
| 6          | 1000018    | 4          | 0          |
| 6          | 1000023    | 9          | 5          |
| 6          | 1000028    | 4          | 0          |
| 8          | 1000014    | 2          | 0          |
| 8          | 1000019    | 7          | 5          |
| 8          | 1000024    | 2          | 0          |
+------------+------------+------------+------------+



hbase(main):019:0> scan 'INDEX_TEST_A_IN_B_C'
ROW                                           COLUMN+CELL                                                                                                                       
 0\x001000010                                 column=CF1:CF1:B, timestamp=1414936659069, value=0                                                                                
 0\x001000010                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 0\x001000010                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 0\x001000015                                 column=CF1:CF1:B, timestamp=1414936659069, value=5                                                                                
 0\x001000015                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 0\x001000015                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 0\x001000020                                 column=CF1:CF1:B, timestamp=1414936659069, value=0                                                                                
 0\x001000020                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 0\x001000020                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 0\x001000025                                 column=CF1:CF1:B, timestamp=1414936659069, value=5                                                                                
 0\x001000025                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 0\x001000025                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 2\x001000011                                 column=CF1:CF1:B, timestamp=1414936659069, value=3                                                                                
 2\x001000011                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 2\x001000011                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 2\x001000016                                 column=CF1:CF1:B, timestamp=1414936659069, value=8                                                                                
 2\x001000016                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 2\x001000016                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 2\x001000021                                 column=CF1:CF1:B, timestamp=1414936659069, value=3                                                                                
 2\x001000021                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 2\x001000021                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 2\x001000026                                 column=CF1:CF1:B, timestamp=1414936659069, value=8                                                                                
 2\x001000026                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 2\x001000026                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 4\x001000012                                 column=CF1:CF1:B, timestamp=1414936659069, value=6                                                                                
 4\x001000012                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 4\x001000012                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 4\x001000017                                 column=CF1:CF1:B, timestamp=1414936659069, value=1                                                                                
 4\x001000017                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 4\x001000017                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 4\x001000022                                 column=CF1:CF1:B, timestamp=1414936659069, value=6                                                                                
 4\x001000022                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 4\x001000022                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 4\x001000027                                 column=CF1:CF1:B, timestamp=1414936659069, value=1                                                                                
 4\x001000027                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 4\x001000027                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 6\x001000013                                 column=CF1:CF1:B, timestamp=1414936659069, value=9                                                                                
 6\x001000013                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 6\x001000013                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 6\x001000018                                 column=CF1:CF1:B, timestamp=1414936659069, value=4                                                                                
 6\x001000018                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 6\x001000018                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 6\x001000023                                 column=CF1:CF1:B, timestamp=1414936659069, value=9                                                                                
 6\x001000023                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 6\x001000023                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 6\x001000028                                 column=CF1:CF1:B, timestamp=1414936659069, value=4                                                                                
 6\x001000028                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 6\x001000028                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 8\x001000014                                 column=CF1:CF1:B, timestamp=1414936659069, value=2                                                                                
 8\x001000014                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 8\x001000014                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 8\x001000019                                 column=CF1:CF1:B, timestamp=1414936659069, value=7                                                                                
 8\x001000019                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 8\x001000019                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 8\x001000024                                 column=CF1:CF1:B, timestamp=1414936659069, value=2                                                                                
 8\x001000024                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
 8\x001000024                                 column=CF2:CF2:C, timestamp=1414936659069, value=0 


索引 INDEX_TEST_A_B_IN_C_D:


0: jdbc:phoenix:localhost> select * from INDEX_TEST_A_B_IN_C_D;


+------------+------------+------------+------------+------------+
|   CF1:A    |   CF1:B    |    :ID     |   CF2:C    |   CF2:D    |
+------------+------------+------------+------------+------------+
| 0          | 0          | 1000010    | 0          | 0          |
| 0          | 0          | 1000020    | 0          | 0          |
| 0          | 5          | 1000015    | 5          | 5          |
| 0          | 5          | 1000025    | 5          | 5          |
| 2          | 3          | 1000011    | 5          | 7          |
| 2          | 3          | 1000021    | 5          | 7          |
| 2          | 8          | 1000016    | 0          | 2          |
| 2          | 8          | 1000026    | 0          | 2          |
| 4          | 1          | 1000017    | 5          | 9          |
| 4          | 1          | 1000027    | 5          | 9          |
| 4          | 6          | 1000012    | 0          | 4          |
| 4          | 6          | 1000022    | 0          | 4          |
| 6          | 4          | 1000018    | 0          | 6          |
| 6          | 4          | 1000028    | 0          | 6          |
| 6          | 9          | 1000013    | 5          | 1          |
| 6          | 9          | 1000023    | 5          | 1          |
| 8          | 2          | 1000014    | 0          | 8          |
| 8          | 2          | 1000024    | 0          | 8          |
| 8          | 7          | 1000019    | 5          | 3          |
+------------+------------+------------+------------+------------+


hbase(main):020:0> scan 'INDEX_TEST_A_B_IN_C_D'


ROW                                           COLUMN+CELL                                                                                                                       
 0\x000\x001000010                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 0\x000\x001000010                            column=CF2:CF2:D, timestamp=1414936659069, value=0                                                                                
 0\x000\x001000010                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 0\x000\x001000020                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 0\x000\x001000020                            column=CF2:CF2:D, timestamp=1414936659069, value=0                                                                                
 0\x000\x001000020                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 0\x005\x001000015                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 0\x005\x001000015                            column=CF2:CF2:D, timestamp=1414936659069, value=5                                                                                
 0\x005\x001000015                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 0\x005\x001000025                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 0\x005\x001000025                            column=CF2:CF2:D, timestamp=1414936659069, value=5                                                                                
 0\x005\x001000025                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 2\x003\x001000011                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 2\x003\x001000011                            column=CF2:CF2:D, timestamp=1414936659069, value=7                                                                                
 2\x003\x001000011                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 2\x003\x001000021                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 2\x003\x001000021                            column=CF2:CF2:D, timestamp=1414936659069, value=7                                                                                
 2\x003\x001000021                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 2\x008\x001000016                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 2\x008\x001000016                            column=CF2:CF2:D, timestamp=1414936659069, value=2                                                                                
 2\x008\x001000016                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 2\x008\x001000026                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 2\x008\x001000026                            column=CF2:CF2:D, timestamp=1414936659069, value=2                                                                                
 2\x008\x001000026                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 4\x001\x001000017                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 4\x001\x001000017                            column=CF2:CF2:D, timestamp=1414936659069, value=9                                                                                
 4\x001\x001000017                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 4\x001\x001000027                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 4\x001\x001000027                            column=CF2:CF2:D, timestamp=1414936659069, value=9                                                                                
 4\x001\x001000027                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 4\x006\x001000012                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 4\x006\x001000012                            column=CF2:CF2:D, timestamp=1414936659069, value=4                                                                                
 4\x006\x001000012                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 4\x006\x001000022                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 4\x006\x001000022                            column=CF2:CF2:D, timestamp=1414936659069, value=4                                                                                
 4\x006\x001000022                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 6\x004\x001000018                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 6\x004\x001000018                            column=CF2:CF2:D, timestamp=1414936659069, value=6                                                                                
 6\x004\x001000018                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 6\x004\x001000028                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 6\x004\x001000028                            column=CF2:CF2:D, timestamp=1414936659069, value=6                                                                                
 6\x004\x001000028                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 6\x009\x001000013                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 6\x009\x001000013                            column=CF2:CF2:D, timestamp=1414936659069, value=1                                                                                
 6\x009\x001000013                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 6\x009\x001000023                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 6\x009\x001000023                            column=CF2:CF2:D, timestamp=1414936659069, value=1                                                                                
 6\x009\x001000023                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 8\x002\x001000014                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 8\x002\x001000014                            column=CF2:CF2:D, timestamp=1414936659069, value=8                                                                                
 8\x002\x001000014                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 8\x002\x001000024                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
 8\x002\x001000024                            column=CF2:CF2:D, timestamp=1414936659069, value=8                                                                                
 8\x002\x001000024                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
 8\x007\x001000019                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
 8\x007\x001000019                            column=CF2:CF2:D, timestamp=1414936659069, value=3                                                                                
 8\x007\x001000019                            column=CF2:_0, timestamp=1414936659069, value=            




 

posted @ 2014-11-02 22:10  lihui1625  阅读(198)  评论(0编辑  收藏  举报