You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/10/21 12:54:53 UTC

[GitHub] [shardingsphere] waylink opened a new issue #7877: NullPointException at order by

waylink opened a new issue #7877:
URL: https://github.com/apache/shardingsphere/issues/7877


   **About:**
   version: 5.0.0-RC1-SNAPSHOT
   Sharding: user % 8
   
   origin_sql:  SELECT id, user,  type FROM user_t WHERE (id > 0) ORDER BY id ASC limit 10;
   actual_sql: SELECT id, user,  type FROM user_t_0 WHERE (id > 0) ORDER BY id ASC limit 10;
   
   Exception at: **_tableMetaData_**
   
   
   **code:**
   
       private boolean getOrderValuesCaseSensitiveFromTables(final SelectStatementContext selectStatementContext,
                                                             final PhysicalSchemaMetaData schemaMetaData, final OrderByItem eachOrderByItem) throws SQLException {
           for (SimpleTableSegment eachSimpleTableSegment : selectStatementContext.getAllTables()) {
               String tableName = eachSimpleTableSegment.getTableName().getIdentifier().getValue();
               PhysicalTableMetaData tableMetaData = schemaMetaData.get(tableName);
               Map<String, PhysicalColumnMetaData> columns = **tableMetaData**.getColumns();
               OrderByItemSegment orderByItemSegment = eachOrderByItem.getSegment();
               if (orderByItemSegment instanceof ColumnOrderByItemSegment) {
                   String columnName = ((ColumnOrderByItemSegment) orderByItemSegment).getColumn().getIdentifier().getValue();
                   if (columns.containsKey(columnName)) {
                       return columns.get(columnName).isCaseSensitive();
                   }
               } else if (orderByItemSegment instanceof IndexOrderByItemSegment) {
                   int columnIndex = ((IndexOrderByItemSegment) orderByItemSegment).getColumnIndex();
                   String columnName = queryResult.getColumnName(columnIndex);
                   if (columns.containsKey(columnName)) {
                       return columns.get(columnName).isCaseSensitive();
                   }
               } else {
                   return false;
               }
           }
           return false;
       }
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] kimmking commented on issue #7877: NPE at order by

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #7877:
URL: https://github.com/apache/shardingsphere/issues/7877#issuecomment-714322384


   I test it works well.
   
   ![image](https://user-images.githubusercontent.com/807508/96845010-cc404480-1482-11eb-91f2-982788eade82.png)
   
   ```
   
   schemaName: testproxy
   
   dataSources:
     test0:
       url: jdbc:mysql://127.0.0.1:3306/test0?serverTimezone=UTC&useSSL=false
       username: root
       password: 
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
     test1:
       url: jdbc:mysql://127.0.0.1:3306/test1?serverTimezone=UTC&useSSL=false
       username: root
       password: 
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
   
   # insert into test(id,name,created) values(1,'KK01',now());
   # insert into test(id,name,created) values(2,'KK02',now());
   # insert into test(id,name,created) values(3,'KK03',now());
   # insert into test(id,name,created) values(4,'KK04',now());
   # insert into test(id,name,created) values(5,'KK05',now());
   # insert into test(id,name,created) values(6,'KK06',now());
   # insert into test(id,name,created) values(7,'KK07',now());
   # insert into test(id,name,created) values(8,'KK08',now());
   
   rules:
   - !SHARDING
     tables:
       test:
         actualDataNodes: test${0..1}.test0${0..2}
         tableStrategy:
           standard:
             shardingColumn: id
             shardingAlgorithmName: test_inline
         keyGenerateStrategy:
             column: id
             keyGeneratorName: snowflake
     defaultDatabaseStrategy:
       standard:
         shardingColumn: id
         shardingAlgorithmName: database_inline
     defaultTableStrategy:
       none:
   
     shardingAlgorithms:
       database_inline:
         type: INLINE
         props:
           algorithm-expression: test${id % 2}
           allow-range-query-with-inline-sharding: true
       test_inline:
         type: INLINE
         props:
           algorithm-expression: test0${id % 3}
           allow-range-query-with-inline-sharding: true
   
     keyGenerators:
         snowflake:
           type: SNOWFLAKE
           props:
               worker-id: 123
   
   ```
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] kimmking edited a comment on issue #7877: NPE at order by

Posted by GitBox <gi...@apache.org>.
kimmking edited a comment on issue #7877:
URL: https://github.com/apache/shardingsphere/issues/7877#issuecomment-714322384


   I test it works well.
   
   ![image](https://user-images.githubusercontent.com/807508/96845010-cc404480-1482-11eb-91f2-982788eade82.png)
   
   ```
   
   schemaName: testproxy
   
   dataSources:
     test0:
       url: jdbc:mysql://127.0.0.1:3306/test0?serverTimezone=UTC&useSSL=false
       username: root
       password: 
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
     test1:
       url: jdbc:mysql://127.0.0.1:3306/test1?serverTimezone=UTC&useSSL=false
       username: root
       password: 
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
   
   rules:
   - !SHARDING
     tables:
       test:
         actualDataNodes: test${0..1}.test0${0..2}
         tableStrategy:
           standard:
             shardingColumn: id
             shardingAlgorithmName: test_inline
         keyGenerateStrategy:
             column: id
             keyGeneratorName: snowflake
     defaultDatabaseStrategy:
       standard:
         shardingColumn: id
         shardingAlgorithmName: database_inline
     defaultTableStrategy:
       none:
   
     shardingAlgorithms:
       database_inline:
         type: INLINE
         props:
           algorithm-expression: test${id % 2}
           allow-range-query-with-inline-sharding: true
       test_inline:
         type: INLINE
         props:
           algorithm-expression: test0${id % 3}
           allow-range-query-with-inline-sharding: true
   
     keyGenerators:
         snowflake:
           type: SNOWFLAKE
           props:
               worker-id: 123
   
   ```
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] waylink commented on issue #7877: NullPointException at order by

Posted by GitBox <gi...@apache.org>.
waylink commented on issue #7877:
URL: https://github.com/apache/shardingsphere/issues/7877#issuecomment-713584225


   Get it. https://github.com/apache/shardingsphere/pull/7878


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on issue #7877: NPE at order by

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #7877:
URL: https://github.com/apache/shardingsphere/issues/7877#issuecomment-732087038


   No response


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu closed issue #7877: NPE at order by

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #7877:
URL: https://github.com/apache/shardingsphere/issues/7877


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org