SandishKumarHN commented on code in PR #38515:
URL: https://github.com/apache/spark/pull/38515#discussion_r1015745863


##########
connector/protobuf/src/test/scala/org/apache/spark/sql/protobuf/ProtobufSerdeSuite.scala:
##########
@@ -177,6 +177,31 @@ class ProtobufSerdeSuite extends SharedSparkSession {
     withFieldMatchType(Deserializer.create(CATALYST_STRUCT, protoNestedFile, 
_))
   }
 
+  test("raise cannot parse protobuf descriptor error") {
+    // passing serde_suite.proto instead serde_suite.desc
+    val testFileDesc = testFile("serde_suite.proto").replace("file:/", "/")
+    val e = intercept[AnalysisException] {
+      ProtobufUtils.buildDescriptor(testFileDesc, "FieldMissingInSQLRoot")
+    }
+
+    checkError(
+      exception = e,
+      errorClass = "CANNOT_PARSE_PROTOBUF_DESCRIPTOR",
+      parameters = Map("descFilePath" -> testFileDesc))
+  }
+
+  test("raise cannot construct protobuf descriptor error") {
+    val testFileDesc = 
testFile("basicmessage_noimports.desc").replace("file:/", "/")
+    val e = intercept[AnalysisException] {
+      ProtobufUtils.parseFileDescriptorSet(testFileDesc)

Review Comment:
   @rangadi  Yes, but the query would catch this error and throw a different 
error right? 



##########
connector/protobuf/src/test/resources/protobuf/basicmessage_noimports.desc:
##########
@@ -0,0 +1,18 @@
+

Review Comment:
   @rangadi yes, it is used in the unit test above, how else can we raise the 
CANNOT_CONSTRUCT_PROTOBUF_DESCRIPTOR exception? 



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to