risingwave_common/session_config/
iceberg_query_storage_mode.rs

1// Copyright 2026 RisingWave Labs
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Storage mode for batch SELECT on Iceberg engine tables.
16//! Iceberg engine tables have both Hummock (row store) and Iceberg (columnar) storage.
17//! This setting controls which storage is used for batch queries.
18
19use std::fmt::Formatter;
20use std::str::FromStr;
21
22#[derive(Copy, Default, Debug, Clone, PartialEq, Eq)]
23pub enum IcebergQueryStorageMode {
24    /// Decided by the optimizer.
25    Auto,
26
27    /// Force batch SELECT to use Iceberg (columnar) storage.
28    #[default]
29    Iceberg,
30
31    /// Force batch SELECT to use Hummock (row) storage.
32    Hummock,
33}
34
35impl FromStr for IcebergQueryStorageMode {
36    type Err = &'static str;
37
38    fn from_str(s: &str) -> Result<Self, Self::Err> {
39        if s.eq_ignore_ascii_case("auto") {
40            Ok(Self::Auto)
41        } else if s.eq_ignore_ascii_case("iceberg") {
42            Ok(Self::Iceberg)
43        } else if s.eq_ignore_ascii_case("hummock") {
44            Ok(Self::Hummock)
45        } else {
46            Err("expect one of [auto, iceberg, hummock]")
47        }
48    }
49}
50
51impl std::fmt::Display for IcebergQueryStorageMode {
52    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
53        match self {
54            Self::Auto => write!(f, "auto"),
55            Self::Iceberg => write!(f, "iceberg"),
56            Self::Hummock => write!(f, "hummock"),
57        }
58    }
59}