Github user petermaxlee commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13966#discussion_r69004793
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
 ---
    @@ -162,6 +163,46 @@ case class ConcatWs(children: Seq[Expression])
       }
     }
     
    +@ExpressionDescription(
    +  usage = "_FUNC_(n, str1, str2, ...) - returns the n-th string",
    +  extended = "> SELECT _FUNC_(1, 'scala', 'java') FROM src LIMIT 1;\n" + 
"'scala'")
    +case class Elt(children: Seq[Expression])
    +  extends Expression with ImplicitCastInputTypes with CodegenFallback {
    +
    +  private lazy val indexExpr = children.head
    +  private lazy val stringExprs = children.tail.toArray
    +
    +  /** This expression is always nullable because it returns null if index 
is out of range. */
    +  override def nullable: Boolean = true
    +
    +  override def dataType: DataType = StringType
    +
    +  override def inputTypes: Seq[DataType] = IntegerType +: 
Seq.fill(children.size - 1)(StringType)
    +
    +  override def checkInputDataTypes(): TypeCheckResult = {
    +    if (children.isEmpty) {
    --- End diff --
    
    Good catch. Let me update it.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to