[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-20 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r381969188
 
 

 ##
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/Catalogs.scala
 ##
 @@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.sql.connector.catalog
+
+import java.lang.reflect.InvocationTargetException
+import java.util
+import java.util.NoSuchElementException
+import java.util.regex.Pattern
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.util.CaseInsensitiveStringMap
+import org.apache.spark.util.Utils
+
+private[sql] object Catalogs {
+  /**
+   * Load and configure a catalog by name.
+   * 
+   * This loads, instantiates, and initializes the catalog plugin for each 
call; it does not cache
+   * or reuse instances.
+   *
+   * @param name a String catalog name
+   * @param conf a SQLConf
+   * @return an initialized CatalogPlugin
+   * @throws CatalogNotFoundException if the plugin class cannot be found
+   * @throws SparkException   if the plugin class cannot be 
instantiated
+   */
+  @throws[CatalogNotFoundException]
+  @throws[SparkException]
+  def load(name: String, conf: SQLConf): CatalogPlugin = {
+var pluginClassName = ""
+try {
+  pluginClassName = conf.getConfString("spark.sql.catalog." + name)
+} catch {
+  case _: NoSuchElementException =>
+throw new CatalogNotFoundException(
+  s"Catalog '$name' plugin class not found: spark.sql.catalog.$name is 
not defined")
+}
+val loader = Utils.getContextOrSparkClassLoader
+try {
+  val pluginClass = loader.loadClass(pluginClassName)
+  if (!classOf[CatalogPlugin].isAssignableFrom(pluginClass)) throw new 
SparkException(
+s"Plugin class for catalog '$name' does not implement CatalogPlugin: 
$pluginClassName")
+  val plugin = classOf[CatalogPlugin].cast(
 
 Review comment:
   nit: 
`pluginClass.getDeclaredConstructor().newInstance().asInstanceOf[CatalogPlugin]`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-20 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r381966033
 
 

 ##
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/Catalogs.scala
 ##
 @@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.sql.connector.catalog
+
+import java.lang.reflect.InvocationTargetException
+import java.util
+import java.util.NoSuchElementException
+import java.util.regex.Pattern
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.util.CaseInsensitiveStringMap
+import org.apache.spark.util.Utils
+
+private[sql] object Catalogs {
+  /**
+   * Load and configure a catalog by name.
+   * 
+   * This loads, instantiates, and initializes the catalog plugin for each 
call; it does not cache
+   * or reuse instances.
+   *
+   * @param name a String catalog name
+   * @param conf a SQLConf
+   * @return an initialized CatalogPlugin
+   * @throws CatalogNotFoundException if the plugin class cannot be found
+   * @throws SparkException   if the plugin class cannot be 
instantiated
+   */
+  @throws[CatalogNotFoundException]
+  @throws[SparkException]
+  def load(name: String, conf: SQLConf): CatalogPlugin = {
+var pluginClassName = ""
+try {
+  pluginClassName = conf.getConfString("spark.sql.catalog." + name)
+} catch {
+  case _: NoSuchElementException =>
+throw new CatalogNotFoundException(
+  s"Catalog '$name' plugin class not found: spark.sql.catalog.$name is 
not defined")
+}
+val loader = Utils.getContextOrSparkClassLoader
+try {
+  val pluginClass = loader.loadClass(pluginClassName)
+  if (!classOf[CatalogPlugin].isAssignableFrom(pluginClass)) throw new 
SparkException(
 
 Review comment:
   nit:
   ```
   if (...) {
 throw ...
   }
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-20 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r381965830
 
 

 ##
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/Catalogs.scala
 ##
 @@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.sql.connector.catalog
+
+import java.lang.reflect.InvocationTargetException
+import java.util
+import java.util.NoSuchElementException
+import java.util.regex.Pattern
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.util.CaseInsensitiveStringMap
+import org.apache.spark.util.Utils
+
+private[sql] object Catalogs {
+  /**
+   * Load and configure a catalog by name.
+   * 
+   * This loads, instantiates, and initializes the catalog plugin for each 
call; it does not cache
+   * or reuse instances.
+   *
+   * @param name a String catalog name
+   * @param conf a SQLConf
+   * @return an initialized CatalogPlugin
+   * @throws CatalogNotFoundException if the plugin class cannot be found
+   * @throws SparkException   if the plugin class cannot be 
instantiated
+   */
+  @throws[CatalogNotFoundException]
+  @throws[SparkException]
+  def load(name: String, conf: SQLConf): CatalogPlugin = {
+var pluginClassName = ""
+try {
+  pluginClassName = conf.getConfString("spark.sql.catalog." + name)
 
 Review comment:
   we can make it more scala-ish:
   ```
   val pluginClassName = try {
 ...
   } ...
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-20 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r381930412
 
 

 ##
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/types/DataType.scala
 ##
 @@ -488,6 +488,8 @@ object DataType {
 
 /**
  * Jackson serializer for [[DataType]]. Internally this delegates to json4s 
based serialization.
+ *
+ * @since 3.0.0
  */
 class DataTypeJsonSerializer extends JsonSerializer[DataType] {
 
 Review comment:
   classes in the catalyst package are treated as private classes and we don't 
really need to add the `private[sql]`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-20 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r381890133
 
 

 ##
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/types/numerics.scala
 ##
 @@ -22,7 +22,7 @@ import scala.math.Ordering
 
 import org.apache.spark.sql.types.Decimal.DecimalIsConflicted
 
-object ByteExactNumeric extends ByteIsIntegral with Ordering.ByteOrdering {
+private[sql] object ByteExactNumeric extends ByteIsIntegral with 
Ordering.ByteOrdering {
 
 Review comment:
   I'm OK with it. But we should also move this file to a private package.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-20 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r381890238
 
 

 ##
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/types/numerics.scala
 ##
 @@ -22,7 +22,7 @@ import scala.math.Ordering
 
 import org.apache.spark.sql.types.Decimal.DecimalIsConflicted
 
-object ByteExactNumeric extends ByteIsIntegral with Ordering.ByteOrdering {
+private[sql] object ByteExactNumeric extends ByteIsIntegral with 
Ordering.ByteOrdering {
 
 Review comment:
   we can move it in followup


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-20 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r381889311
 
 

 ##
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/types/DataType.scala
 ##
 @@ -488,6 +488,8 @@ object DataType {
 
 /**
  * Jackson serializer for [[DataType]]. Internally this delegates to json4s 
based serialization.
+ *
+ * @since 3.0.0
  */
 class DataTypeJsonSerializer extends JsonSerializer[DataType] {
 
 Review comment:
   these 2 were added in 
https://github.com/apache/spark/pull/26127/files#diff-df78a74ef92d9b8fb4ac142ff9a62464R490
   
   I don't think we want to publish them. Can we move them to a private 
package? like `xxx.catalyst.utils`
   also cc @hvanhovell 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-20 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r381886953
 
 

 ##
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/Catalogs.scala
 ##
 @@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.sql.connector.catalog
+
+import java.lang.reflect.InvocationTargetException
+import java.util
+import java.util.NoSuchElementException
+import java.util.regex.Pattern
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.util.CaseInsensitiveStringMap
+import org.apache.spark.util.Utils
+
+private[sql] object Catalogs {
+  /**
+   * Load and configure a catalog by name.
+   * 
+   * This loads, instantiates, and initializes the catalog plugin for each 
call; it does not cache
+   * or reuse instances.
+   *
+   * @param name a String catalog name
+   * @param conf a SQLConf
+   * @return an initialized CatalogPlugin
+   * @throws CatalogNotFoundException if the plugin class cannot be found
+   * @throws SparkException   if the plugin class cannot be 
instantiated
+   */
+@throws[CatalogNotFoundException]
 
 Review comment:
   is the indentation corrected?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-14 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r379300527
 
 

 ##
 File path: 
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/Catalogs.java
 ##
 @@ -48,6 +48,7 @@ private Catalogs() {
* @return an initialized CatalogPlugin
* @throws CatalogNotFoundException if the plugin class cannot be found
* @throws SparkException if the plugin class cannot be instantiated
+   * @since 3.0.0
 
 Review comment:
   If it doesn't work, we can rewrite in with Scala and use `private[sql]`.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-13 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r379244642
 
 

 ##
 File path: core/src/main/scala/org/apache/spark/rpc/RpcEndpointRef.scala
 ##
 @@ -108,7 +108,7 @@ private[spark] abstract class RpcEndpointRef(conf: 
SparkConf)
 /**
  * An exception thrown if the RPC is aborted.
  */
-class RpcAbortException(message: String) extends Exception(message)
+private[spark] class RpcAbortException(message: String) extends 
Exception(message)
 
 Review comment:
   shall we just make the `rpc` package private?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-13 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r379244165
 
 

 ##
 File path: project/SparkBuild.scala
 ##
 @@ -834,6 +834,7 @@ object Unidoc {
   
.map(_.filterNot(_.getCanonicalPath.contains("org/apache/spark/util/collection")))
   
.map(_.filterNot(_.getCanonicalPath.contains("org/apache/spark/util/kvstore")))
   
.map(_.filterNot(_.getCanonicalPath.contains("org/apache/spark/sql/catalyst")))
+  
.map(_.filterNot(_.getCanonicalPath.contains("org/apache/spark/sql/dynamicpruning")))
 
 Review comment:
   shall we send a PR to move package first?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-13 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r379244083
 
 

 ##
 File path: 
sql/catalyst/src/main/java/org/apache/spark/sql/connector/expressions/Transform.java
 ##
 @@ -24,6 +24,8 @@
  * 
  * For example, the transform date(ts) is used to derive a date value from a 
timestamp column. The
  * transform name is "date" and its argument is a reference to the "ts" column.
+ *
+ * @since 3.0.0
  */
 @Experimental
 
 Review comment:
   I think all DS v2 classes are still evolving. Shall we use `@Evolving` 
consistently? e.g. 
https://github.com/apache/spark/pull/27560/files#diff-ab2a72871faeb3ad8bae1d7f951899deR29
   
   cc @brkyvz @rdblue 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] Review and fix issues in SQL API docs

2020-02-13 Thread GitBox
cloud-fan commented on a change in pull request #27560: [SPARK-30809][SQL] 
Review and fix issues in SQL API docs
URL: https://github.com/apache/spark/pull/27560#discussion_r379243643
 
 

 ##
 File path: 
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/Catalogs.java
 ##
 @@ -48,6 +48,7 @@ private Catalogs() {
* @return an initialized CatalogPlugin
* @throws CatalogNotFoundException if the plugin class cannot be found
* @throws SparkException if the plugin class cannot be instantiated
+   * @since 3.0.0
 
 Review comment:
   This is a private class (`@Private`)


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org