Description
override def eval(input: Row): Any = { val value = child.eval(input) if (value == null) { null } else { val key = ordinal.eval(input) if (key == null) { null } else { if (child.dataType.isInstanceOf[ArrayType]) { // TODO: consider using Array[_] for ArrayType child to avoid // boxing of primitives val baseValue = value.asInstanceOf[Seq[_]] val o = key.asInstanceOf[Int] if (o >= baseValue.size || o < 0) { null } else { baseValue(o) } } else { val baseValue = value.asInstanceOf[Map[Any, _]] val key = ordinal.eval(input) // We evaluate the key again at here baseValue.get(key).orNull } } } }
Attachments
Issue Links
- links to