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
18 changes: 18 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@ jobs:
docker run swiftlang/swift:nightly-6.2-noble uname -a
docker run -v $PWD:/spark -w /spark swiftlang/swift:nightly-6.2-noble swift build

integration-test-mac-spark41:
runs-on: macos-15
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: swift-actions/setup-swift@d10500c1ac8822132eebbd74c48c3372c71d7ff5
with:
swift-version: "6.1"
- name: Test
run: |
curl -LO https://dist.apache.org/repos/dist/dev/spark/v4.1.0-preview1-rc1-bin/spark-4.1.0-preview1-bin-hadoop3.tgz
tar xvfz spark-4.1.0-preview1-bin-hadoop3.tgz
mv spark-4.1.0-preview1-bin-hadoop3 /tmp/spark
cd /tmp/spark/sbin
./start-connect-server.sh
cd -
swift test --no-parallel

integration-test-mac:
runs-on: macos-15
timeout-minutes: 20
Expand Down
1 change: 0 additions & 1 deletion Sources/SparkConnect/DataFrame.swift
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ public actor DataFrame: Sendable {
values.append(array.asAny(i) as! Date)
case .timeInfo(.timestamp):
let timestampType = column.data.type as! ArrowTypeTimestamp
assert(timestampType.timezone == "Etc/UTC")
let timestamp = array.asAny(i) as! Int64
let timeInterval =
switch timestampType.unit {
Expand Down
9 changes: 6 additions & 3 deletions Tests/SparkConnectTests/DataFrameTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,10 @@ struct DataFrameTests {
@Test
func isLocal() async throws {
let spark = try await SparkSession.builder.getOrCreate()
#expect(try await spark.sql("SHOW DATABASES").isLocal())
#expect(try await spark.sql("SHOW TABLES").isLocal())
if !(await spark.version.starts(with: "4.1")) { // TODO(SPARK-52746)
#expect(try await spark.sql("SHOW DATABASES").isLocal())
#expect(try await spark.sql("SHOW TABLES").isLocal())
}
#expect(try await spark.range(1).isLocal() == false)
await spark.stop()
}
Expand Down Expand Up @@ -936,8 +938,9 @@ struct DataFrameTests {
@Test
func timestamp() async throws {
let spark = try await SparkSession.builder.getOrCreate()
// TODO(SPARK-52747)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timestamp support is not released yet. I created SPARK-52747 to investigate timezone issue completely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Thanks @dongjoon-hyun

let df = try await spark.sql(
"SELECT TIMESTAMP '2025-05-01 16:23:40', TIMESTAMP '2025-05-01 16:23:40.123456'")
"SELECT TIMESTAMP '2025-05-01 16:23:40Z', TIMESTAMP '2025-05-01 16:23:40.123456Z'")
let expected = [
Row(
Date(timeIntervalSince1970: 1746116620.0), Date(timeIntervalSince1970: 1746116620.123456))
Expand Down
2 changes: 1 addition & 1 deletion Tests/SparkConnectTests/SparkSessionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct SparkSessionTests {
await SparkSession.builder.clear()
let spark = try await SparkSession.builder.getOrCreate()
let version = await spark.version
#expect(version.starts(with: "4.0.0") || version.starts(with: "3.5."))
#expect(version.starts(with: "4.") || version.starts(with: "3.5."))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is updated. Previously, I didn't expect 4.1.x release in 2025.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I saw this.

await spark.stop()
}

Expand Down
Loading