|
||||
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 package org.apache.spark.sql.connector.catalog; 0019 0020 import org.apache.spark.annotation.Evolving; 0021 import org.apache.spark.sql.util.CaseInsensitiveStringMap; 0022 0023 /** 0024 * An interface, which TableProviders can implement, to support table existence checks and creation 0025 * through a catalog, without having to use table identifiers. For example, when file based data 0026 * sources use the `DataFrameWriter.save(path)` method, the option `path` can translate to a 0027 * PathIdentifier. A catalog can then use this PathIdentifier to check the existence of a table, or 0028 * whether a table can be created at a given directory. 0029 * 0030 * @since 3.0.0 0031 */ 0032 @Evolving 0033 public interface SupportsCatalogOptions extends TableProvider { 0034 /** 0035 * Return a {@link Identifier} instance that can identify a table for a DataSource given 0036 * DataFrame[Reader|Writer] options. 0037 * 0038 * @param options the user-specified options that can identify a table, e.g. file path, Kafka 0039 * topic name, etc. It's an immutable case-insensitive string-to-string map. 0040 */ 0041 Identifier extractIdentifier(CaseInsensitiveStringMap options); 0042 0043 /** 0044 * Return the name of a catalog that can be used to check the existence of, load, and create 0045 * a table for this DataSource given the identifier that will be extracted by 0046 * {@link #extractIdentifier(CaseInsensitiveStringMap) extractIdentifier}. A `null` value can 0047 * be used to defer to the V2SessionCatalog. 0048 * 0049 * @param options the user-specified options that can identify a table, e.g. file path, Kafka 0050 * topic name, etc. It's an immutable case-insensitive string-to-string map. 0051 */ 0052 default String extractCatalog(CaseInsensitiveStringMap options) { 0053 return CatalogManager.SESSION_CATALOG_NAME(); 0054 } 0055 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |