Login  Register

[GitHub] [carbondata] Indhumathi27 commented on a change in pull request #4118: [CARBONDATA-4167][CARBONDATA-4168] Fix case sensitive issues and input validation for Geo values.

Posted by GitBox on Apr 27, 2021; 4:46am
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/GitHub-carbondata-ShreelekhyaG-opened-a-new-pull-request-4118-WIP-Fix-case-sensitive-issues-and-inpu-tp107430p107922.html


Indhumathi27 commented on a change in pull request #4118:
URL: https://github.com/apache/carbondata/pull/4118#discussion_r620858120



##########
File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/strategy/CarbonSourceStrategy.scala
##########
@@ -62,10 +62,53 @@ private[sql] object CarbonSourceStrategy extends SparkStrategy {
         } catch {
           case _: CarbonPhysicalPlanException => Nil
         }
+      case Project(projectList, _: OneRowRelation) if validateUdf(projectList) => Nil
       case _ => Nil
     }
   }
 
+  private def validateUdf(projects: Seq[NamedExpression]): Boolean = {
+    projects foreach {
+      case alias: Alias if alias.child.isInstanceOf[Expression] =>
+        alias.child match {
+          case Cast(s: ScalaUDF, _, _) => validateGeoUtilUDFs(s)
+          case s: ScalaUDF => validateGeoUtilUDFs(s)
+          case _ =>
+        }
+    }
+    true
+  }
+
+  def validateGeoUtilUDFs(s: ScalaUDF): Boolean = {
+    var geoUdf = false

Review comment:
       Can remove this local variable. If invalid data is provided by user, then it will throw exception. Else, return  true




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

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