Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17483#discussion_r109325537
  
    --- Diff: R/pkg/R/catalog.R ---
    @@ -0,0 +1,478 @@
    +#
    +# 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.
    +#
    +
    +# catalog.R: SparkSession catalog functions
    +
    +#' Create an external table
    +#'
    +#' Creates an external table based on the dataset in a data source,
    +#' Returns a SparkDataFrame associated with the external table.
    +#'
    +#' The data source is specified by the \code{source} and a set of 
options(...).
    +#' If \code{source} is not specified, the default data source configured by
    +#' "spark.sql.sources.default" will be used.
    +#'
    +#' @param tableName a name of the table.
    +#' @param path the path of files to load.
    +#' @param source the name of external data source.
    +#' @param schema the schema of the data for certain data source.
    +#' @param ... additional argument(s) passed to the method.
    +#' @return A SparkDataFrame.
    +#' @rdname createExternalTable
    +#' @export
    +#' @examples
    +#'\dontrun{
    +#' sparkR.session()
    +#' df <- createExternalTable("myjson", path="path/to/json", source="json", 
schema)
    +#' }
    +#' @name createExternalTable
    +#' @method createExternalTable default
    +#' @note createExternalTable since 1.4.0
    +createExternalTable.default <- function(tableName, path = NULL, source = 
NULL, schema = NULL, ...) {
    +  sparkSession <- getSparkSession()
    +  options <- varargsToStrEnv(...)
    +  if (!is.null(path)) {
    +    options[["path"]] <- path
    +  }
    +  catalog <- callJMethod(sparkSession, "catalog")
    +  if (!is.null(schema)) {
    +    sdf <- callJMethod(catalog, "createExternalTable", tableName, source, 
options)
    +  } else {
    +    sdf <- callJMethod(catalog, "createExternalTable", tableName, source, 
schema$jobj, options)
    +  }
    +  dataFrame(sdf)
    +}
    +
    +createExternalTable <- function(x, ...) {
    --- End diff --
    
    > If you drop a managed table both data and meta data will be deleted if 
you drop an external table only metadata is deleted, external table is a way to 
protect data against accidental drop commands.
    
    Thus, it is a pretty important concept. It could be either Hive or Spark 
native one. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to