vladimirg-db commented on code in PR #52333:
URL: https://github.com/apache/spark/pull/52333#discussion_r2348521213


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeExtractors.scala:
##########
@@ -69,31 +66,42 @@ object ExtractValue {
   def extractValue(
       child: Expression,
       extraction: Expression,
-      resolver: Resolver): Option[Expression] = {
+      resolver: Resolver): Either[Expression, Throwable] = {
     (child.dataType, extraction) match {
       case (StructType(fields), NonNullLiteral(v, _: StringType)) =>
         val fieldName = v.toString
-        val ordinal = findField(fields, fieldName, resolver)
-        Some(GetStructField(child, ordinal, Some(fieldName)))
+        findField(fields, fieldName, resolver) match {
+          case Left(ordinal) => Left(GetStructField(child, ordinal, 
Some(fieldName)))
+          case Right(throwable) => Right(throwable)

Review Comment:
   It actually does not compile, I assume because those `Either`'s are of 
different generic types:
   
   <img width="1146" height="99" alt="image" 
src="https://github.com/user-attachments/assets/c376d7aa-6a3c-4c11-83f3-02415d2857dd";
 />
   



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to