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.catalog; 018 019import java.util.List; 020 021/** 022 * Represents a table in a database schema. 023 * 024 * <p>Originally derived from Apache Calcite's catalog interfaces. 025 */ 026public interface Table { 027 /** 028 * Returns the name of the table. 029 * 030 * @return Table name 031 */ 032 String getName(); 033 034 /** 035 * Returns the type of the table (e.g., "TABLE", "VIEW", "SYSTEM TABLE"). 036 * 037 * @return Table type 038 */ 039 String getTableType(); 040 041 /** 042 * Returns the schema that this table belongs to. 043 * 044 * @return Schema 045 */ 046 Schema getSchema(); 047 048 /** 049 * Returns all columns in this table, in ordinal order. 050 * 051 * @return List of columns 052 */ 053 List<Column> getColumns(); 054 055 /** 056 * Returns a column by name, or null if not found. 057 * 058 * @param columnName Column name (case-sensitive) 059 * @return Column, or null 060 */ 061 Column getColumn(String columnName); 062 063 /** 064 * Returns the comment or description of the table. 065 * 066 * @return Table comment, or null if none 067 */ 068 String getComment(); 069 070 /** 071 * Returns the primary key columns. 072 * 073 * @return List of primary key column names 074 */ 075 List<String> getPrimaryKeys(); 076}