Skip to content

Commit efad14f

Browse files
committed
Remove some half finished functions.
1 parent 92e74a4 commit efad14f

File tree

3 files changed

+2
-34
lines changed

3 files changed

+2
-34
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ abstract class CodeGenerator extends Logging {
216216
case EqualTo(e1, e2) =>
217217
(e1, e2).evaluateAs (BooleanType) { case (eval1, eval2) => q"$eval1 == $eval2" }
218218

219+
/* TODO: Fix null semantics.
219220
case In(e1, list) if !list.exists(!_.isInstanceOf[expressions.Literal]) =>
220221
val eval = expressionEvaluator(e1)
221222
@@ -238,6 +239,7 @@ abstract class CodeGenerator extends Logging {
238239
val $nullTerm = false
239240
val $primitiveTerm = $funcName
240241
""".children
242+
*/
241243

242244
case GreaterThan(e1 @ NumericType(), e2 @ NumericType()) =>
243245
(e1, e2).evaluateAs (BooleanType) { case (eval1, eval2) => q"$eval1 > $eval2" }
@@ -352,27 +354,6 @@ abstract class CodeGenerator extends Logging {
352354
$primitiveTerm = ${falseEval.primitiveTerm}
353355
}
354356
""".children
355-
356-
case SubString(str, start, end) =>
357-
val stringEval = expressionEvaluator(str)
358-
val startEval = expressionEvaluator(start)
359-
val endEval = expressionEvaluator(end)
360-
361-
stringEval.code ++ startEval.code ++ endEval.code ++
362-
q"""
363-
var $nullTerm = ${stringEval.nullTerm}
364-
var $primitiveTerm: String =
365-
if($nullTerm) {
366-
null
367-
} else {
368-
val len =
369-
if(${endEval.primitiveTerm} <= ${stringEval.primitiveTerm}.length)
370-
${endEval.primitiveTerm}
371-
else
372-
${stringEval.primitiveTerm}.length
373-
${stringEval.primitiveTerm}.substring(${startEval.primitiveTerm}, len)
374-
}
375-
""".children
376357
}
377358

378359
// If there was no match in the partial function above, we fall back on calling the interpreted

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringOperations.scala

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@ import org.apache.spark.sql.catalyst.types.DataType
2323
import org.apache.spark.sql.catalyst.types.StringType
2424
import org.apache.spark.sql.catalyst.types.BooleanType
2525

26-
case class SubString(string: Expression, start: Expression, end: Expression) extends Expression {
27-
def children = string :: start :: end :: Nil
28-
def references = children.flatMap(_.references).toSet
29-
def dataType = StringType
30-
def nullable = string.nullable
31-
32-
override def eval(input: Row) = ???
33-
34-
override def toString = s"substr($string, $start, $end"
35-
}
36-
3726
trait StringRegexExpression {
3827
self: BinaryExpression =>
3928

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,8 +950,6 @@ private[hive] object HiveQl {
950950
IsNull(nodeToExpr(child))
951951
case Token("TOK_FUNCTION", Token(IN(), Nil) :: value :: list) =>
952952
In(nodeToExpr(value), list.map(nodeToExpr))
953-
case Token("TOK_FUNCTION", Token(SUBSTR(), Nil) :: str :: start :: end :: Nil) =>
954-
SubString(nodeToExpr(str), nodeToExpr(start), nodeToExpr(end))
955953
case Token("TOK_FUNCTION",
956954
Token(BETWEEN(), Nil) ::
957955
Token("KW_FALSE", Nil) ::

0 commit comments

Comments
 (0)