Implementation:Apache Shardingsphere ShadowOperationType Enum
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Shadow_Testing, SQL_Routing |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
Enumeration of SQL operation types used to classify shadow routing decisions.
Description
ShadowOperationType defines the SQL operation categories that shadow algorithms use to determine routing. Values include INSERT, DELETE, UPDATE, SELECT, and HINT_MATCH. The valueFrom static method performs case-insensitive lookup of operation names.
Usage
Use this enum when configuring shadow table rules or implementing custom shadow algorithms that need to match specific SQL operation types.
Code Reference
Source Location
- Repository: Apache_Shardingsphere
- File: features/shadow/api/src/main/java/org/apache/shardingsphere/shadow/spi/ShadowOperationType.java
- Lines: 1-73
Signature
public enum ShadowOperationType {
INSERT,
DELETE,
UPDATE,
SELECT,
HINT_MATCH;
public static Optional<ShadowOperationType> valueFrom(final String name) {
// Case-insensitive lookup
}
}
Import
import org.apache.shardingsphere.shadow.spi.ShadowOperationType;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | Case-insensitive operation type name for valueFrom() |
Outputs
| Name | Type | Description |
|---|---|---|
| valueFrom() returns | Optional<ShadowOperationType> | Matching enum value or empty |
Usage Examples
import org.apache.shardingsphere.shadow.spi.ShadowOperationType;
// Resolve operation type from SQL statement type
Optional<ShadowOperationType> opType = ShadowOperationType.valueFrom("INSERT");
// opType.get() == ShadowOperationType.INSERT
// Case-insensitive matching
Optional<ShadowOperationType> selectOp = ShadowOperationType.valueFrom("select");
// selectOp.get() == ShadowOperationType.SELECT
// Non-matching returns empty
Optional<ShadowOperationType> unknown = ShadowOperationType.valueFrom("MERGE");
// unknown.isPresent() == false
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment