Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13966#discussion_r68930450
  
    --- 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 --
    
    should we make sure the number of children is greater than 1? What's hive's 
hehaviour when call `etl(0)`?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to