You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "singleDog1123 (via GitHub)" <gi...@apache.org> on 2026/03/23 09:56:11 UTC
[I] How can I use the yyyyMMdd time format for splitting? [shardingsphere]
singleDog1123 opened a new issue, #38545:
URL: https://github.com/apache/shardingsphere/issues/38545
## Question
version:ShardingSphere-JDBC 5.5.1
I want to segment based on the time using the format "table_name_yyyyMMdd". When I set multiple dates, the program fails to route properly. Here is an example of an error: The daily_sharding algorithm was not invoked.
```
rules:
- !SHARDING
tables:
net_node_flow_record:
actualDataNodes: net_flow_record.net_node_flow_record_${20260101..20270101}
tableStrategy:
standard:
shardingColumn: create_time
shardingAlgorithmName: daily_sharding
net_user_flow_record:
actualDataNodes: net_flow_record.net_user_flow_record_${20260101..20270101}
tableStrategy:
standard:
shardingColumn: create_time
shardingAlgorithmName: daily_sharding
```
The following configuration can correctly route. The daily_sharding algorithm was executed
```
rules:
- !SHARDING
tables:
net_node_flow_record:
actualDataNodes: net_flow_record.net_node_flow_record_${['20260323']}
tableStrategy:
standard:
shardingColumn: create_time
shardingAlgorithmName: daily_sharding
net_user_flow_record:
actualDataNodes: net_flow_record.net_user_flow_record_${['20260323']}
tableStrategy:
standard:
shardingColumn: create_time
shardingAlgorithmName: daily_sharding
```
When my configuration was set to `${20260101..20270101}`, the error log was as follows:
```
### Error updating database. Cause: org.apache.ibatis.executor.ExecutorException: Error preparing statement. Cause: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'net_node_flow_record' does not exist.
### The error may exist in org/dromara/net/mapper/NetNodeFlowRecordMapper.java (best guess)
### The error may involve org.dromara.net.mapper.NetNodeFlowRecordMapper.insert
### The error occurred while executing an update
### SQL: INSERT INTO net_node_flow_record (id, node_id, up_num, down_num, total_num, create_time) VALUES (?, ?, ?, ?, ?, ?)
### Cause: org.apache.ibatis.executor.ExecutorException: Error preparing statement. Cause: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'net_node_flow_record' does not exist.
```
If I don't want to manually list all the table names for a certain period in the future, how can I correct this to achieve the desired result?
--
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How can I use the yyyyMMdd time format for splitting? [shardingsphere]
Posted by "singleDog1123 (via GitHub)" <gi...@apache.org>.
singleDog1123 commented on issue #38545:
URL: https://github.com/apache/shardingsphere/issues/38545#issuecomment-4122794703
The problem has been solved. Thank you.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How can I use the yyyyMMdd time format for splitting? [shardingsphere]
Posted by "singleDog1123 (via GitHub)" <gi...@apache.org>.
singleDog1123 commented on issue #38545:
URL: https://github.com/apache/shardingsphere/issues/38545#issuecomment-4114941550
I tried the automatic table division and the configuration is as follows:
```
rules:
- !SHARDING
autoTables:
net_node_flow_record:
actualDataSources: net_flow_record
shardingStrategy:
standard:
shardingColumn: create_time
shardingAlgorithmName: daily_auto_sharding
shardingAlgorithms:
daily_auto_sharding:
type: AUTO_INTERVAL
props:
datetime-lower: "2026-03-01 00:00:00"
datetime-upper: "2026-03-31 23:59:59"
sharding-seconds: 86400
-------
error log:
Cause: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'net_node_flow_record' does not exist.
```
After `debug`, Exception occurred in `org.apache.shardingsphere.infra.binder.engine.segment.from.type.SimpleTableSegmentBinder#checkTableExists` , After inspection, it was found that the `org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema#tables` were empty, which led to the situation where the automatic sharding rule did not take effect at all. How should I solve this?
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How can I use the yyyyMMdd time format for splitting? [shardingsphere]
Posted by "singleDog1123 (via GitHub)" <gi...@apache.org>.
singleDog1123 closed issue #38545: How can I use the yyyyMMdd time format for splitting?
URL: https://github.com/apache/shardingsphere/issues/38545
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How can I use the yyyyMMdd time format for splitting? [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #38545:
URL: https://github.com/apache/shardingsphere/issues/38545#issuecomment-4120031757
Problem Understanding
This is a “capability boundary + configuration syntax” issue, and it does not look like a confirmed product defect. Issue #38545 reports that in ShardingSphere-JDBC 5.5.1, using actualDataNodes: ..._${20260101..20270101} results in TableNotFoundException; a follow-up comment then tried autoTables + AUTO_INTERVAL, but it still failed during the binder stage. Sources: [Issue #38545](https://github.com/apache/shardingsphere/issues/38545), [issue comment](https://github.com/apache/shardingsphere/issues/38545#issuecomment-4114941550)
Fast triage:
Q1 reproducibility evidence: partially satisfied. The version, JDBC mode, YAML, SQL, and error are provided, but the database type/version and governance mode are missing.
Q2 whether the documentation is explicit: yes. The official docs clearly distinguish Groovy range expressions, INTERVAL row expressions, and the AUTO_INTERVAL auto sharding algorithm.
Q3 whether code/tests confirm the current behavior: yes. The repository tests and implementation are consistent with the documentation.
Provisional classification: Misunderstanding / Invalid Usage
This was analysis mode only; no repository files were modified.
Root Cause
OBS-1: The official documentation states that ${begin..end} is a Groovy range interval, not date semantics; ${[... ]} is an enumeration. Source: [Row Value Expressions](https://shardingsphere.apache.org/document/current/en/user-manual/common-config/builtin-algorithm/expr/)
OBS-2: The official documentation also states that <INTERVAL> is the mechanism specifically designed to define time-range strings for actualDataNodes, and SP supports yyyyMMdd. Source: [Row Value Expressions](https://shardingsphere.apache.org/document/current/en/user-manual/common-config/builtin-algorithm/expr/)
OBS-3: The Groovy parser tests only verify numeric range expansion, such as t_order_${0..2}. Source: GroovyInlineExpressionParserTest.java (line 77)
OBS-4: The INTERVAL parser tests verify daily date-suffix generation and support yyyyMMdd. Source: IntervalInlineExpressionParserTest.java (line 36)
OBS-5: The official documentation states that AUTO_INTERVAL is an auto sharding algorithm and “needs to be used by configuring the autoTables sharding rules.” Source: [Sharding Algorithm](https://shardingsphere.apache.org/document/current/en/user-manual/common-config/builtin-algorithm/sharding/)
OBS-6: In the autoTables path, ShardingTable generates actual table nodes through DataNodeUtils.getFormattedDataNodes(...). Source: ShardingTable.java (line 120)
OBS-7: AutoIntervalShardingAlgorithm computes and matches numeric suffixes via String.valueOf(i), not yyyyMMdd string suffixes. Source: AutoIntervalShardingAlgorithm.java (line 82)
OBS-8: The binder throws TableNotFoundException directly when the schema does not contain the logical table. Source: SimpleTableSegmentBinder.java (line 190)
OBS-9: check-table-metadata-enabled defaults to false; by default, metadata loading only picks one actual table rather than all of them. Sources: ConfigurationPropertyKey.java (line 65), SchemaMetaDataUtils.java (line 63), SchemaMetaDataUtilsTest.java (line 146)
OBS-10: There is a disabled test in the repository with the note “remove when autoTables support config actualDataNodes in #33364”, which indicates that the capability boundary between autoTables and actualDataNodes is not currently equivalent. Source: ShardingStandardRouteEngineTest.java (line 91)
INF-1: ${20260101..20270101} is treated as a numeric range and will not generate a valid day-by-day yyyyMMdd sequence. [OBS-1][OBS-3]
INF-2: For “single database, multiple actual tables named by date”, the currently supported modeling approach is actualDataNodes + <INTERVAL>...SP=yyyyMMdd..., not a Groovy range. [OBS-2][OBS-4]
INF-3: autoTables + AUTO_INTERVAL can only route to tables with numeric suffixes; it cannot directly match table names like net_node_flow_record_20260323. [OBS-5][OBS-6][OBS-7][OBS-10]
INF-4: The reported TableNotFoundException is consistent with the current implementation; if the actual table chosen by default metadata loading does not exist or is not usable, ShardingSphereSchema#tables may end up empty as described in the comment. [OBS-8][OBS-9]
Problem Analysis
The direct cause is not that “the sharding algorithm was not implemented,” but that a “Groovy numeric range” was used as if it were a “date range.” The syntax ${20260101..20270101} does not itself mean “one table per day.”
If the real requirement is a physical table naming pattern like net_node_flow_record_yyyyMMdd, the project already provides a corresponding capability, but the entry point is the <INTERVAL> row expression for actualDataNodes, not AUTO_INTERVAL.
The autoTables + AUTO_INTERVAL attempt in the comment still does not match the requirement, because that capability currently targets “auto-managed numbered shards,” not “real tables named with date strings.”
In addition, actualDataNodes only declares node names; it does not create physical tables for the user. Even if the expression is corrected, the target date tables still need to exist beforehand or be maintained by an external DDL mechanism.
The configuration should be changed to something like the following, and the same applies to the other table:
actualDataNodes: <INTERVAL>P=net_flow_record.net_node_flow_record_;SP=yyyyMMdd;DIA=1;DIU=Days;DL=20260101;DU=20270101
Problem Conclusion
Conclusion: this issue is better classified as Misunderstanding / Invalid Usage, not a Bug based on the current evidence. [INF-1][INF-2][INF-3][INF-4]
The recommended issue response should be: for the yyyyMMdd scenario, use the <INTERVAL> expression for actualDataNodes; AUTO_INTERVAL only applies to numbered auto-sharding under autoTables.
If the same kind of error still appears after switching to <INTERVAL>, the next step should be to provide the minimum additional evidence: database type/version, governance mode, the actual table-creation DDL, and whether the corresponding date tables physically exist.
Evidence Confidence: Medium
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org