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

    https://github.com/apache/spark/pull/17001#discussion_r103889802
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/ExternalCatalog.scala
 ---
    @@ -30,7 +33,7 @@ import 
org.apache.spark.sql.catalyst.expressions.Expression
      *
      * Implementations should throw [[NoSuchDatabaseException]] when databases 
don't exist.
      */
    -abstract class ExternalCatalog {
    +abstract class ExternalCatalog(conf: SparkConf, hadoopConf: Configuration) 
{
    --- End diff --
    
    @cloud-fan  I found it that if we add a parameter `defaultDB` for 
`ExternalCatalog` and its subclass `InMemoryCatalog` and `HiveExternalCatalog`, 
this change will cause a lot of related code to be modified, such as test cases 
,and other logic which create `InMemoryCatalog` and `HiveExternalCatalog`, for 
example:  currently all the parameters of `InMemoryCatalog` have its own 
default value `class InMemoryCatalog(conf: SparkConf = new 
SparkConf,hadoopConfig: Configuration = new Configuration)`,we can create it 
without an parameters, but if we add a `defaultDB`, we should new a defaultDB 
in the parameter, while we can not create a legal deafultDB because we can not 
get the warehouse path for the defaultDB like this:
    ` `class InMemoryCatalog(conf: SparkConf = new SparkConf,hadoopConfig: 
Configuration = new Configuration, defaultDB: CatalogDatabase = 
CatalogDatabase("default","","${can not get the warehouse path}",Map.empty))``
    
    if we don't provide a default value for defautDB in the parameter, this 
will cause more code change which I think it is not proper.
    
    what about we keep the `provided def warehousePath` in `ExternalCatalog`, 
and add a 
    `lazy val defaultDB = {
        val qualifiedWarehousePath = SessionCatalog
          .makeQualifiedPath(warehousePath, hadoopConf).toString
       CatalogDatabase("default","", qualifiedWarehousePath, Map.empty)
    }` 
    
    this can also avoid call getDatabase



---
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