PaimonSysTable.java
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.doris.datasource.systable;
import org.apache.doris.datasource.ExternalTable;
import org.apache.doris.datasource.paimon.PaimonExternalTable;
import org.apache.doris.datasource.paimon.PaimonSysExternalTable;
import org.apache.paimon.table.system.SystemTableLoader;
import java.util.Collections;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* System table type for Paimon system tables.
*
* <p>Paimon system tables are classified into two categories:
* <ul>
* <li><b>Data tables</b> (e.g., binlog, audit_log, ro): Read actual ORC/Parquet data files,
* benefit from native vectorized readers</li>
* <li><b>Metadata tables</b> (snapshots, partitions, etc.): Read metadata/manifest files,
* use JNI readers</li>
* </ul>
*
* <p>All Paimon system tables use the native table execution path (FileQueryScanNode)
* instead of the TVF path (MetadataScanNode).
*/
public class PaimonSysTable extends NativeSysTable {
/**
* All supported Paimon system tables (both data and metadata).
* Key is the system table name (e.g., "snapshots", "binlog").
*/
public static final Map<String, SysTable> SUPPORTED_SYS_TABLES = Collections.unmodifiableMap(
SystemTableLoader.SYSTEM_TABLES.stream()
.map(PaimonSysTable::new)
.collect(Collectors.toMap(SysTable::getSysTableName, Function.identity())));
private PaimonSysTable(String tableName) {
super(tableName);
}
@Override
public ExternalTable createSysExternalTable(ExternalTable sourceTable) {
if (!(sourceTable instanceof PaimonExternalTable)) {
throw new IllegalArgumentException(
"Expected PaimonExternalTable but got " + sourceTable.getClass().getSimpleName());
}
return new PaimonSysExternalTable((PaimonExternalTable) sourceTable, getSysTableName());
}
}