Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Apache Shardingsphere ShadowOperationType Enum

From Leeroopedia


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

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