cloud-fan commented on code in PR #52334:
URL: https://github.com/apache/spark/pull/52334#discussion_r2429625367


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -2200,7 +2205,15 @@ class AstBuilder extends DataTypeAstBuilder
         Limit(expression(ctx.expression), query)
 
       case ctx: SampleByPercentileContext =>
-        val fraction = ctx.percentage.getText.toDouble
+        val fraction = if (ctx.DECIMAL_VALUE() != null) { 
ctx.DECIMAL_VALUE().getText.toDouble }
+        else {
+          // Assert that parameter markers have been substituted before 
reaching AstBuilder
+          assert(ctx.integerValue().getChild(0).getClass.getSimpleName !=

Review Comment:
   ditto: https://github.com/apache/spark/pull/52334/files#r2429594567



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -716,12 +716,17 @@ class AstBuilder extends DataTypeAstBuilder
   private def withCTE(ctx: CtesContext, plan: LogicalPlan): LogicalPlan = {
     val ctes = ctx.namedQuery.asScala.map { nCtx =>
       val namedQuery = visitNamedQuery(nCtx)
-      val rowLevelLimit: Option[Int] = if (nCtx.INTEGER_VALUE() != null) {
+      val rowLevelLimit: Option[Int] = if (nCtx.integerValue() != null) {
         if (ctx.RECURSIVE() == null) {
           operationNotAllowed("Cannot specify MAX RECURSION LEVEL when the CTE 
is not marked as " +
             "RECURSIVE", ctx)
         }
-        Some(nCtx.INTEGER_VALUE().getText().toInt)
+        // Assert that parameter markers have been substituted before reaching 
AstBuilder
+        assert(nCtx.integerValue().getChild(0).getClass.getSimpleName !=

Review Comment:
   ditto: https://github.com/apache/spark/pull/52334/files#r2429594567



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