Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 6af85f3

Browse files
committed
Added support for binary colums
1 parent 79cf1bb commit 6af85f3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/main/scala/com/audienceproject/spark/dynamodb/rdd/DynamoRelation.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ private[dynamodb] class DynamoRelation(userSchema: StructType, parameters: Map[S
107107
}).toSeq
108108
StructType(mapFields)
109109
case _: java.lang.Boolean => BooleanType
110+
case _: Array[Byte] => BinaryType
110111
case _ => StringType
111112
}
112113

src/main/scala/com/audienceproject/spark/dynamodb/rdd/TypeConversion.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ private[dynamodb] object TypeConversion {
3838
case DoubleType => nullableGet(_.getDouble)(attrName)
3939
case FloatType => nullableGet(_.getFloat)(attrName)
4040
case DecimalType() => nullableGet(_.getNumber)(attrName)
41+
case BinaryType => nullableGet(_.getBinary)(attrName)
4142
case ArrayType(innerType, _) =>
4243
nullableGet(_.getList)(attrName).andThen(extractArray(convertValue(innerType)))
4344
case MapType(keyType, valueType, _) =>
@@ -57,6 +58,10 @@ private[dynamodb] object TypeConversion {
5758
case DoubleType => nullableConvert(_.doubleValue())
5859
case FloatType => nullableConvert(_.floatValue())
5960
case DecimalType() => nullableConvert(identity)
61+
case BinaryType => {
62+
case byteArray : Array[Byte] => byteArray
63+
case _ => null
64+
}
6065
case ArrayType(innerType, _) => extractArray(convertValue(innerType))
6166
case MapType(keyType, valueType, _) =>
6267
if (keyType != StringType) throw new IllegalArgumentException(s"Invalid Map key type '${keyType.typeName}'. DynamoDB only supports String as Map key type.")

0 commit comments

Comments
 (0)