Skip to content

Commit

Permalink
Merge pull request #24 from marmbrus/binaryCasts
Browse files Browse the repository at this point in the history
Implement casts binary <=> string.
  • Loading branch information
rxin committed Jan 26, 2014
2 parents 4e50679 + fd084a4 commit 04573a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/scala/catalyst/expressions/Evaluate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ object Evaluate extends Logging {
currentExpression

/* Casts */

// Binary Conversions
case Cast(e @ BinaryType(), StringType) => new String(eval(e).asInstanceOf[Array[Byte]])
case Cast(e @ StringType(), BinaryType) => eval(e).asInstanceOf[String].getBytes

// toString
case Cast(e, StringType) =>
eval(e) match {
Expand Down
1 change: 1 addition & 0 deletions src/test/scala/catalyst/execution/HiveCompatibility.scala
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class HiveCompatibility extends HiveQueryFileTest {
"auto_sortmerge_join_7",
"auto_sortmerge_join_8",
"auto_sortmerge_join_9",
"binary_constant",
"binarysortable_1",
"bucket1",
"bucket_map_join_1",
Expand Down

0 comments on commit 04573a0

Please sign in to comment.