You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the doSharding method of ComplexKeysShardingAlgorithm, the inability to obtain columnName and dataNodeInfo prevents the automatic sharding and the application of the sharding algorithm for the automatic sharding strategy in DISTSQL.
To address this issue, PreciseShardingValue and RangeShardingValue should be included in ComplexKeysShardingValue, as shown below:
java
Copy code
public final class ComplexKeysShardingValue<T extends Comparable<?>> implements ShardingValue {
private final String logicTableName;
private final Map<String, PreciseShardingValue<T>> columnNameAndShardingValuesMap;
private final Map<String, RangeShardingValue<T>> columnNameAndRangeValuesMap;
}
My requirements are as follows:
/**
Composite Field Sharding Algorithm
Ensure that the last N digits of the participating fields are consistent.
Support multiple fields for sharding.
Since multiple fields have the same last N digits, routing to the target table can be done with any of the fields.
Use case:
For example, when sharding orders by user ID, querying by order ID alone cannot route to the target table.
In this case, if the last N digits of the order ID are consistent with the user ID, it is possible to query by either the user ID or the order ID.
*/
public class CombineHashMod implements ComplexKeysShardingAlgorithm<Comparable>, ShardingAutoTableAlgorithm {
@OverRide
public Collection doSharding(Collection availableTargetNames, ComplexKeysShardingValue> shardingValue);
}
This discussion was converted from issue #26742 on July 16, 2024 14:32.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In the doSharding method of ComplexKeysShardingAlgorithm, the inability to obtain columnName and dataNodeInfo prevents the automatic sharding and the application of the sharding algorithm for the automatic sharding strategy in DISTSQL.
To address this issue, PreciseShardingValue and RangeShardingValue should be included in ComplexKeysShardingValue, as shown below:
java
Copy code
public final class ComplexKeysShardingValue<T extends Comparable<?>> implements ShardingValue {
}
My requirements are as follows:
/**
Composite Field Sharding Algorithm
Ensure that the last N digits of the participating fields are consistent.
Support multiple fields for sharding.
Since multiple fields have the same last N digits, routing to the target table can be done with any of the fields.
Use case:
For example, when sharding orders by user ID, querying by order ID alone cannot route to the target table.
In this case, if the last N digits of the order ID are consistent with the user ID, it is possible to query by either the user ID or the order ID.
*/
public class CombineHashMod implements ComplexKeysShardingAlgorithm<Comparable>, ShardingAutoTableAlgorithm { @OverRide public Collection doSharding(Collection availableTargetNames, ComplexKeysShardingValue> shardingValue);
}
Beta Was this translation helpful? Give feedback.
All reactions