zoukankan      html  css  js  c++  java
  • 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                                                                                                                       
     0x001000010                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     0x001000015                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     0x001000020                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     0x001000025                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     2x001000011                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     2x001000016                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     2x001000021                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     2x001000026                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     4x001000012                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     4x001000017                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     4x001000022                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     4x001000027                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     6x001000013                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     6x001000018                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     6x001000023                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     6x001000028                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     8x001000014                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     8x001000019                                 column=_0:_0, timestamp=1414936659069, value=                                                                                     
     8x001000024                                 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                                                                                                                       
     0x001000010                                 column=CF1:CF1:B, timestamp=1414936659069, value=0                                                                                
     0x001000010                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     0x001000010                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     0x001000015                                 column=CF1:CF1:B, timestamp=1414936659069, value=5                                                                                
     0x001000015                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     0x001000015                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     0x001000020                                 column=CF1:CF1:B, timestamp=1414936659069, value=0                                                                                
     0x001000020                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     0x001000020                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     0x001000025                                 column=CF1:CF1:B, timestamp=1414936659069, value=5                                                                                
     0x001000025                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     0x001000025                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     2x001000011                                 column=CF1:CF1:B, timestamp=1414936659069, value=3                                                                                
     2x001000011                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     2x001000011                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     2x001000016                                 column=CF1:CF1:B, timestamp=1414936659069, value=8                                                                                
     2x001000016                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     2x001000016                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     2x001000021                                 column=CF1:CF1:B, timestamp=1414936659069, value=3                                                                                
     2x001000021                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     2x001000021                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     2x001000026                                 column=CF1:CF1:B, timestamp=1414936659069, value=8                                                                                
     2x001000026                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     2x001000026                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     4x001000012                                 column=CF1:CF1:B, timestamp=1414936659069, value=6                                                                                
     4x001000012                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     4x001000012                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     4x001000017                                 column=CF1:CF1:B, timestamp=1414936659069, value=1                                                                                
     4x001000017                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     4x001000017                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     4x001000022                                 column=CF1:CF1:B, timestamp=1414936659069, value=6                                                                                
     4x001000022                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     4x001000022                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     4x001000027                                 column=CF1:CF1:B, timestamp=1414936659069, value=1                                                                                
     4x001000027                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     4x001000027                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     6x001000013                                 column=CF1:CF1:B, timestamp=1414936659069, value=9                                                                                
     6x001000013                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     6x001000013                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     6x001000018                                 column=CF1:CF1:B, timestamp=1414936659069, value=4                                                                                
     6x001000018                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     6x001000018                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     6x001000023                                 column=CF1:CF1:B, timestamp=1414936659069, value=9                                                                                
     6x001000023                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     6x001000023                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     6x001000028                                 column=CF1:CF1:B, timestamp=1414936659069, value=4                                                                                
     6x001000028                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     6x001000028                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     8x001000014                                 column=CF1:CF1:B, timestamp=1414936659069, value=2                                                                                
     8x001000014                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     8x001000014                                 column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     8x001000019                                 column=CF1:CF1:B, timestamp=1414936659069, value=7                                                                                
     8x001000019                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     8x001000019                                 column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     8x001000024                                 column=CF1:CF1:B, timestamp=1414936659069, value=2                                                                                
     8x001000024                                 column=CF1:_0, timestamp=1414936659069, value=                                                                                    
     8x001000024                                 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                                                                                                                       
     0x000x001000010                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     0x000x001000010                            column=CF2:CF2:D, timestamp=1414936659069, value=0                                                                                
     0x000x001000010                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     0x000x001000020                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     0x000x001000020                            column=CF2:CF2:D, timestamp=1414936659069, value=0                                                                                
     0x000x001000020                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     0x005x001000015                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     0x005x001000015                            column=CF2:CF2:D, timestamp=1414936659069, value=5                                                                                
     0x005x001000015                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     0x005x001000025                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     0x005x001000025                            column=CF2:CF2:D, timestamp=1414936659069, value=5                                                                                
     0x005x001000025                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     2x003x001000011                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     2x003x001000011                            column=CF2:CF2:D, timestamp=1414936659069, value=7                                                                                
     2x003x001000011                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     2x003x001000021                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     2x003x001000021                            column=CF2:CF2:D, timestamp=1414936659069, value=7                                                                                
     2x003x001000021                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     2x008x001000016                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     2x008x001000016                            column=CF2:CF2:D, timestamp=1414936659069, value=2                                                                                
     2x008x001000016                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     2x008x001000026                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     2x008x001000026                            column=CF2:CF2:D, timestamp=1414936659069, value=2                                                                                
     2x008x001000026                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     4x001x001000017                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     4x001x001000017                            column=CF2:CF2:D, timestamp=1414936659069, value=9                                                                                
     4x001x001000017                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     4x001x001000027                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     4x001x001000027                            column=CF2:CF2:D, timestamp=1414936659069, value=9                                                                                
     4x001x001000027                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     4x006x001000012                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     4x006x001000012                            column=CF2:CF2:D, timestamp=1414936659069, value=4                                                                                
     4x006x001000012                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     4x006x001000022                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     4x006x001000022                            column=CF2:CF2:D, timestamp=1414936659069, value=4                                                                                
     4x006x001000022                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     6x004x001000018                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     6x004x001000018                            column=CF2:CF2:D, timestamp=1414936659069, value=6                                                                                
     6x004x001000018                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     6x004x001000028                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     6x004x001000028                            column=CF2:CF2:D, timestamp=1414936659069, value=6                                                                                
     6x004x001000028                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     6x009x001000013                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     6x009x001000013                            column=CF2:CF2:D, timestamp=1414936659069, value=1                                                                                
     6x009x001000013                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     6x009x001000023                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     6x009x001000023                            column=CF2:CF2:D, timestamp=1414936659069, value=1                                                                                
     6x009x001000023                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     8x002x001000014                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     8x002x001000014                            column=CF2:CF2:D, timestamp=1414936659069, value=8                                                                                
     8x002x001000014                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     8x002x001000024                            column=CF2:CF2:C, timestamp=1414936659069, value=0                                                                                
     8x002x001000024                            column=CF2:CF2:D, timestamp=1414936659069, value=8                                                                                
     8x002x001000024                            column=CF2:_0, timestamp=1414936659069, value=                                                                                    
     8x007x001000019                            column=CF2:CF2:C, timestamp=1414936659069, value=5                                                                                
     8x007x001000019                            column=CF2:CF2:D, timestamp=1414936659069, value=3                                                                                
     8x007x001000019                            column=CF2:_0, timestamp=1414936659069, value=            




  • 相关阅读:
    解决移动端页面在苹果端滑不到底部的问题
    js点击事件在苹果端失效的问题
    小程序开发基本步骤
    css多行文本省略号(...)
    js判断pc端和移动端的方法
    主流浏览器css兼容问题的总结
    让ie6对png透明图片支持起来
    ajax的探究与使用
    css3实现逐渐变大的圆填充div背景的效果
    js中setTimeout()时间参数设置为0的探讨
  • 原文地址:https://www.cnblogs.com/leeeee/p/7276400.html
Copyright © 2011-2022 走看看