-
Notifications
You must be signed in to change notification settings - Fork 28.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-43646][CONNECT][TESTS] Make both SBT and Maven use spark-proto
uber jar to test the connect
module
#42236
Changes from all commits
bd88c72
55c975a
93d64dd
eaa01e5
d9411f9
dc13f71
ac92862
113251b
2563eb4
8ac1c79
9e0333d
4ba45e0
f14b9ab
db17e5b
5b7f230
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3232,14 +3232,15 @@ class PlanGenerationTestSuite | |
"connect/common/src/test/resources/protobuf-tests/common.desc" | ||
|
||
test("from_protobuf messageClassName") { | ||
binary.select(pbFn.from_protobuf(fn.col("bytes"), classOf[StorageLevel].getName)) | ||
binary.select( | ||
pbFn.from_protobuf(fn.col("bytes"), "org.apache.spark.sql.protobuf.protos.TestProtoObj")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Moving the discussion about "why do users need to shade their java classes?" here in a comment thread. cc: @LuciferYang, @advancedxy, @HyukjinKwon. There is no other option. Spark at runtime includes unshaded Protobuf library (2.5.x) in its class path. This is was as of a few months back. Don't know if that changed. Its been this way for years. There is no way to support protobuf Java classes for current versions of Protobuf library without shading. I agree it is not convenient for the customers. That is why descriptor file is documented as the primary API (both for Scala and python). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After #41153, protobuf 2.5 is no longer in classpath :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rangadi I'm sorry that I neglected the historical context of adding these functions. Spark 3.5 no longer depends on Protobuf 2.5, and these functions are currently marked as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That requires removing shading of protobuf classes. It needs more discussion. In general, including non-shaded jars is problematic (that is how original protobuf 2.5 version jar remained unchanged for many years). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, I noticed there's protobu-2.5 jar in the spark-3.4 client tar. For Spark 3.5, do you think it's better to publishing both shading and unshaded version of spark-protobuf jar? If both published, end customers could choose which jar to use and we can documented it clearly. |
||
} | ||
|
||
test("from_protobuf messageClassName options") { | ||
binary.select( | ||
pbFn.from_protobuf( | ||
fn.col("bytes"), | ||
classOf[StorageLevel].getName, | ||
"org.apache.spark.sql.protobuf.protos.TestProtoObj", | ||
Map("recursive.fields.max.depth" -> "2").asJava)) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Project [from_protobuf(bytes#0, org.apache.spark.connect.proto.StorageLevel, None) AS from_protobuf(bytes)#0] | ||
Project [from_protobuf(bytes#0, org.apache.spark.sql.protobuf.protos.TestProtoObj, None) AS from_protobuf(bytes)#0] | ||
+- LocalRelation <empty>, [id#0L, bytes#0] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Project [from_protobuf(bytes#0, org.apache.spark.connect.proto.StorageLevel, None, (recursive.fields.max.depth,2)) AS from_protobuf(bytes)#0] | ||
Project [from_protobuf(bytes#0, org.apache.spark.sql.protobuf.protos.TestProtoObj, None, (recursive.fields.max.depth,2)) AS from_protobuf(bytes)#0] | ||
+- LocalRelation <empty>, [id#0L, bytes#0] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
syntax = "proto3"; | ||
package org.apache.spark.sql.protobuf.protos; | ||
|
||
option java_multiple_files = true; | ||
option java_outer_classname = "TestProto"; | ||
|
||
message TestProtoObj { | ||
int64 v1 = 1; | ||
int32 v2 = 2; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we deem this plan too intricate, we could delete or ignore test cases
from_protobuf messageClassName
andfrom_protobuf messageClassName options
to temporarily abandon this testing scenarioThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Thank you.