Skip to content

Commit f98168b

Browse files
committed
[SPARK-55277][SQL] Add protobuf_funcs group for Protobuf SQL functions
Similar to how Avro functions have their own 'avro_funcs' group, Protobuf functions (from_protobuf, to_protobuf) should have their own 'protobuf_funcs' group instead of being grouped under 'misc_funcs'. This improves consistency with how other format-specific functions are organized and makes the documentation clearer for users. ### What changes were proposed in this pull request? - Move from_protobuf and to_protobuf from misc_funcs to protobuf_funcs - Add protobuf_funcs to the groups set in gen-sql-functions-docs.py ### Why are the changes needed? Consistency with avro_funcs, json_funcs, csv_funcs, xml_funcs groupings. ### Does this PR introduce _any_ user-facing change? No functional changes. The only difference is in how functions are grouped in documentation. ### How was this patch tested? Existing tests. ### Was this patch authored or co-authored using generative AI tooling? Yes, GitHub Copilot was used to assist with this change.
1 parent 4a58b84 commit f98168b

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/ExpressionInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public class ExpressionInfo {
4848
"bitwise_funcs", "collection_funcs", "predicate_funcs", "conditional_funcs",
4949
"conversion_funcs", "csv_funcs", "datetime_funcs", "generator_funcs", "hash_funcs",
5050
"json_funcs", "lambda_funcs", "map_funcs", "math_funcs", "misc_funcs",
51-
"string_funcs", "struct_funcs", "window_funcs", "xml_funcs", "table_funcs",
52-
"url_funcs", "variant_funcs", "vector_funcs", "st_funcs"));
51+
"protobuf_funcs", "string_funcs", "struct_funcs", "window_funcs", "xml_funcs",
52+
"table_funcs", "url_funcs", "variant_funcs", "vector_funcs", "st_funcs"));
5353

5454
private static final Set<String> validSources =
5555
new HashSet<>(Arrays.asList("built-in", "hive", "python_udf", "scala_udf", "sql_udf",

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/toFromProtobufSqlFunctions.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import org.apache.spark.util.Utils
5858
To deserialize the data with a compatible and evolved schema, the expected Protobuf schema can be
5959
set via the corresponding option.
6060
""",
61-
group = "misc_funcs",
61+
group = "protobuf_funcs",
6262
since = "4.0.0"
6363
)
6464
// scalastyle:on line.size.limit
@@ -195,7 +195,7 @@ case class FromProtobuf(
195195
> SELECT _FUNC_(s, 'Person', '/path/to/descriptor.desc', map('emitDefaultValues', 'true')) IS NULL FROM (SELECT NULL AS s);
196196
[true]
197197
""",
198-
group = "misc_funcs",
198+
group = "protobuf_funcs",
199199
since = "4.0.0"
200200
)
201201
// scalastyle:on line.size.limit

sql/core/src/test/scala/org/apache/spark/sql/expressions/ExpressionInfoSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class ExpressionInfoSuite extends SparkFunSuite with SharedSparkSession {
5959
"agg_funcs", "array_funcs", "avro_funcs", "binary_funcs", "bitwise_funcs", "collection_funcs",
6060
"predicate_funcs", "conditional_funcs", "conversion_funcs", "csv_funcs", "datetime_funcs",
6161
"generator_funcs", "hash_funcs", "json_funcs", "lambda_funcs", "map_funcs", "math_funcs",
62-
"misc_funcs", "string_funcs", "struct_funcs", "window_funcs", "xml_funcs", "table_funcs",
63-
"url_funcs", "variant_funcs", "vector_funcs", "st_funcs").sorted
62+
"misc_funcs", "protobuf_funcs", "string_funcs", "struct_funcs", "window_funcs", "xml_funcs",
63+
"table_funcs", "url_funcs", "variant_funcs", "vector_funcs", "st_funcs").sorted
6464
val invalidGroupName = "invalid_group_funcs"
6565
checkError(
6666
exception = intercept[SparkIllegalArgumentException] {

sql/gen-sql-functions-docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"bitwise_funcs", "conversion_funcs", "csv_funcs",
3737
"xml_funcs", "lambda_funcs", "collection_funcs",
3838
"url_funcs", "hash_funcs", "struct_funcs",
39-
"table_funcs", "variant_funcs"
39+
"table_funcs", "variant_funcs", "protobuf_funcs"
4040
}
4141

4242

0 commit comments

Comments
 (0)