Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Sources/SparkConnect/DataFrame.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ public actor DataFrame: Sendable {
let str = column.array as! AsString
if column.data.isNull(i) {
values.append(nil)
} else if column.data.type.info == ArrowType.ArrowBinary {
let binary = str.asString(i).utf8.map { String(format: "%02x", $0) }.joined(separator: " ")
values.append("[\(binary)]")
} else {
values.append(str.asString(i))
}
Expand Down Expand Up @@ -201,6 +204,9 @@ public actor DataFrame: Sendable {
let str = column.array as! AsString
if column.data.isNull(i) {
values.append("NULL")
} else if column.data.type.info == ArrowType.ArrowBinary {
let binary = str.asString(i).utf8.map { String(format: "%02x", $0) }.joined(separator: " ")
values.append("[\(binary)]")
} else {
values.append(str.asString(i))
}
Expand Down
1 change: 1 addition & 0 deletions Tests/SparkConnectTests/Resources/queries/binary.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SELECT binary('abc')
1 change: 1 addition & 0 deletions Tests/SparkConnectTests/Resources/queries/binary.sql.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[["[61 62 63]"]]
Loading