[SPARK-2730][SQL] When retrieving a value from a Map, GetItem evaluates key twice
authorYin Huai <huai@cse.ohio-state.edu>
Tue, 29 Jul 2014 19:23:34 +0000 (12:23 -0700)
committerMichael Armbrust <michael@databricks.com>
Tue, 29 Jul 2014 19:23:49 +0000 (12:23 -0700)
JIRA: https://issues.apache.org/jira/browse/SPARK-2730

Author: Yin Huai <huai@cse.ohio-state.edu>

Closes #1637 from yhuai/SPARK-2730 and squashes the following commits:

1a9f24e [Yin Huai] Remove unnecessary key evaluation.

(cherry picked from commit e3643485de8fdaf5c52b266fead1b13214f29d5e)
Signed-off-by: Michael Armbrust <michael@databricks.com>
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypes.scala

index 5d3bb25..0acb290 100644 (file)
@@ -61,7 +61,6 @@ case class GetItem(child: Expression, ordinal: Expression) extends Expression {
           }
         } else {
           val baseValue = value.asInstanceOf[Map[Any, _]]
-          val key = ordinal.eval(input)
           baseValue.get(key).orNull
         }
       }