You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ka...@apache.org on 2025/01/23 07:15:29 UTC
(spark) branch master updated: [SPARK-50957][PROTOBUF] Make protobuf.utils.SchemaConverters private
This is an automated email from the ASF dual-hosted git repository.
kabhwan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 620f55262cab [SPARK-50957][PROTOBUF] Make protobuf.utils.SchemaConverters private
620f55262cab is described below
commit 620f55262cab75485f4e1ee5d85dd24ab8a4c1aa
Author: Siying Dong <do...@gmail.com>
AuthorDate: Thu Jan 23 16:15:16 2025 +0900
[SPARK-50957][PROTOBUF] Make protobuf.utils.SchemaConverters private
### What changes were proposed in this pull request?
Make functions in org.apache.spark.sql.protobuf.utils.SchemaConverters private, especially toSqlType()
### Why are the changes needed?
Right now, protobuf.utils.SchemaConverters.toSqlType() is tagged as a public API, however, it cannot be accessed in public, as one argument is private. So direct calling this function will throw a ClassNotFound exception. This is confusing. It doesn't seem that there is a good need to access this function in public.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
See existing tests
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #49613 from siying/private_tojson.
Authored-by: Siying Dong <do...@gmail.com>
Signed-off-by: Jungtaek Lim <ka...@gmail.com>
---
.../org/apache/spark/sql/protobuf/utils/SchemaConverters.scala | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/connector/protobuf/src/main/scala/org/apache/spark/sql/protobuf/utils/SchemaConverters.scala b/connector/protobuf/src/main/scala/org/apache/spark/sql/protobuf/utils/SchemaConverters.scala
index 56c1f8185061..3273f473ed5c 100644
--- a/connector/protobuf/src/main/scala/org/apache/spark/sql/protobuf/utils/SchemaConverters.scala
+++ b/connector/protobuf/src/main/scala/org/apache/spark/sql/protobuf/utils/SchemaConverters.scala
@@ -22,12 +22,10 @@ import com.google.protobuf.{BoolValue, BytesValue, DoubleValue, FloatValue, Int3
import com.google.protobuf.Descriptors.{Descriptor, FieldDescriptor}
import com.google.protobuf.WireFormat
-import org.apache.spark.annotation.DeveloperApi
import org.apache.spark.internal.Logging
import org.apache.spark.sql.errors.QueryCompilationErrors
import org.apache.spark.sql.types._
-@DeveloperApi
object SchemaConverters extends Logging {
/**
@@ -42,13 +40,13 @@ object SchemaConverters extends Logging {
*
* @since 3.4.0
*/
- def toSqlType(
+ private[protobuf] def toSqlType(
descriptor: Descriptor,
protobufOptions: ProtobufOptions = ProtobufOptions(Map.empty)): SchemaType = {
toSqlTypeHelper(descriptor, protobufOptions)
}
- def toSqlTypeHelper(
+ private[protobuf] def toSqlTypeHelper(
descriptor: Descriptor,
protobufOptions: ProtobufOptions): SchemaType = {
val fields = descriptor.getFields.asScala.flatMap(
@@ -65,7 +63,7 @@ object SchemaConverters extends Logging {
// exceed the maximum recursive depth specified by the recursiveFieldMaxDepth option.
// A return of None implies the field has reached the maximum allowed recursive depth and
// should be dropped.
- def structFieldFor(
+ private def structFieldFor(
fd: FieldDescriptor,
existingRecordNames: Map[String, Int],
protobufOptions: ProtobufOptions): Option[StructField] = {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org