yflytom opened a new issue, #25470:
URL: https://github.com/apache/shardingsphere/issues/25470

   ## Question
   
   **For English only**, other languages will not accept.
   
   The shard key has no value, how to override the shardingjdbc source code to 
set the query table range, and query all tables without specifying it
   
   分片key没有值,如何重写shardingjdbc源码,来设置查询表范围,不指定就查询了所有配置的表,
   
   我的配置:
   
   ```yml
       rules:
         sharding:
           # 数据分片配置
           tables:
             event_signal_his:
   #            actual-data-nodes: 
sharding_station.event_signal_his_2022${['07','08','09','10','11','12']},sharding_station.event_signal_his_2023${['01','02','03']}
               actual-data-nodes: 
sharding_station.event_signal_his_2022${['07','08','09','10','11','12']},sharding_station.event_signal_his_$->{2023..2050}$->{(1..12).collect(i->i.toString().padLeft(2,'0'))}
               # 分表策略
               table-strategy:
                 standard:
                   # 分表字段
                   sharding-column: HAPPEN_TIME
                   # 自定义名称
                   sharding-algorithm-name: event-signal-his-alg
             target_collection_his:
   #            actual-data-nodes: 
sharding_station.target_collection_his_2022${['07','08','09','10','11','12']},sharding_station.target_collection_his_2023${['01','02','03']}
               actual-data-nodes: 
sharding_station.target_collection_his_2022${['07','08','09','10','11','12']},sharding_station.target_collection_his_$->{2023..2050}$->{(1..4).collect(i->i.toString().padLeft(2,'0'))}
               table-strategy:
                 standard:
                   sharding-column: COLLECT_TIME
                   sharding-algorithm-name: target-collection-his-alg
           #        binding-tables:  # 
绑定表,也就是实际上哪些配置的sharidng表规则需要实际生效的列表,配置为yaml列表,并且允许单个条目中以逗号切割,所配置表必须已经配置为逻辑表
           #          - event_signal_his,需要链表的表
           # 分片算法配置
           sharding-algorithms:
             event-signal-his-alg: # 分片算法名称
               type: CLASS_BASED # 声明类引用
               props: # 分片算法属性配置
                 strategy: STANDARD
                 algorithmClassName: 
com.nrec.integration.sharding.alg.YearMonthShardingAlgorithm
             target-collection-his-alg:
               type: CLASS_BASED
               props:
                 strategy: STANDARD
                 algorithmClassName: 
com.nrec.integration.sharding.alg.YearMonthShardingAlgorithm
   ```
   I have configured a custom sharding policy, but when the shard key is not 
specified or has no value, the custom sharding policy will not be used
   
   我配置了自定义分片策略,但是当分片键不指定或者没有值时,是不会走自定义分片策略
   
   Find many ways to intercept through SQL, but it is difficult to modify SQL 
and parse (SQL has more nested logic in SQL), so I want to modify the scope of 
the query table by rewriting the shardingjdbc source code, and give the shard 
key a start and end date
   
   
找了很多方法通过sql拦截,但是难度较大需要修改sql以及解析(sql内部嵌套逻辑较多),所以想通过重写shardingjdbc源码来修改查询表的范围,给分片键一个开始结束日期
   
   Which class method in the source code should be rewritten to implement the 
requirements above
   
   应该重写源码中的哪个类方法实现上面的需求


-- 
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.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to