001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to you under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package gudusoft.gsqlparser.ext.calcite.catalog; 018 019import org.checkerframework.checker.nullness.qual.Nullable; 020 021import java.util.List; 022 023/** 024 * Represents a table in a database schema. 025 * 026 * <p>This is a standalone version that can be used independently of Apache Calcite. 027 */ 028public interface Table { 029 /** 030 * Returns the name of the table. 031 * 032 * @return Table name 033 */ 034 String getName(); 035 036 /** 037 * Returns the type of the table (e.g., "TABLE", "VIEW", "SYSTEM TABLE"). 038 * 039 * @return Table type 040 */ 041 String getTableType(); 042 043 /** 044 * Returns the schema that this table belongs to. 045 * 046 * @return Schema 047 */ 048 Schema getSchema(); 049 050 /** 051 * Returns all columns in this table, in ordinal order. 052 * 053 * @return List of columns 054 */ 055 List<Column> getColumns(); 056 057 /** 058 * Returns a column by name, or null if not found. 059 * 060 * @param columnName Column name (case-sensitive) 061 * @return Column, or null 062 */ 063 @Nullable Column getColumn(String columnName); 064 065 /** 066 * Returns the comment or description of the table. 067 * 068 * @return Table comment, or null if none 069 */ 070 @Nullable String getComment(); 071 072 /** 073 * Returns the primary key columns. 074 * 075 * @return List of primary key column names 076 */ 077 List<String> getPrimaryKeys(); 078}