Skip to content

Commit

Permalink
Merge branch 'master' into snow-1325562
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-bli committed Jul 29, 2024
2 parents 7c847a9 + 491d299 commit e8a4dca
Showing 1 changed file with 0 additions and 101 deletions.
101 changes: 0 additions & 101 deletions src/it/scala/net/snowflake/spark/snowflake/CloudStorageSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -196,106 +196,5 @@ class CloudStorageSuite extends IntegrationSuiteBase {
"write a empty DataFrame to GCS with down-scoped-token")
}
}

// GCS_USE_DOWNSCOPED_CREDENTIAL is not a public parameter, user can't set it.
// Only the snowflake test account can set it for testing purpose.
// From Dec 2023, GCS_USE_DOWNSCOPED_CREDENTIAL may be configured as true for all deployments
// and this test case can be removed at that time.
test("write a small DataFrame to GCS with presigned-url (Can be removed by Dec 2023)") {
// Only run this test on GCS
if ("gcp".equals(System.getenv("SNOWFLAKE_TEST_ACCOUNT"))) {
val df = sparkSession.read
.format(SNOWFLAKE_SOURCE_NAME)
.options(connectorOptionsNoTable)
.option("dbtable", test_table1)
.load()

// write a small DataFrame to a snowflake table
df.write
.format(SNOWFLAKE_SOURCE_NAME)
.options(connectorOptionsNoTable)
.option("dbtable", test_table_write)
// GCS_USE_DOWNSCOPED_CREDENTIAL is not a public parameter, user can't set it.
// The default value of GCS_USE_DOWNSCOPED_CREDENTIAL will be true from Dec 2023
// The option set can be removed after Dec 2023
.option("GCS_USE_DOWNSCOPED_CREDENTIAL", "false")
.mode(SaveMode.Overwrite)
.save()

// Check the source table and target table has same agg_hash.
assert(getHashAgg(test_table1) == getHashAgg(test_table_write))
} else {
println("skip test for non-GCS platform: " +
"write a small DataFrame to GCS with presigned-url (Can be removed by Dec 2023)")
}
}

// GCS_USE_DOWNSCOPED_CREDENTIAL is not a public parameter, user can't set it.
// Only the snowflake test account can set it for testing purpose.
// From Dec 2023, GCS_USE_DOWNSCOPED_CREDENTIAL may be configured as true for all deployments
// and this test case can be removed at that time.
test("write a big DataFrame to GCS with presigned-url (Can be removed by Dec 2023)") {
// Only run this test on GCS
if ("gcp".equals(System.getenv("SNOWFLAKE_TEST_ACCOUNT"))) {
setupLargeResultTable
val df = sparkSession.read
.format(SNOWFLAKE_SOURCE_NAME)
.options(connectorOptionsNoTable)
.option("partition_size_in_mb", 1) // generate multiple partitions
.option("dbtable", test_table_large_result)
.load()

// write a small DataFrame to a snowflake table
df.write
.format(SNOWFLAKE_SOURCE_NAME)
.options(connectorOptionsNoTable)
.option("dbtable", test_table_write)
// GCS_USE_DOWNSCOPED_CREDENTIAL is not a public parameter, user can't set it.
// The default value of GCS_USE_DOWNSCOPED_CREDENTIAL will be true from Dec 2023
// The option set can be removed after Dec 2023
.option("GCS_USE_DOWNSCOPED_CREDENTIAL", "false")
.mode(SaveMode.Overwrite)
.save()

// Check the source table and target table has same agg_hash.
assert(getHashAgg(test_table_large_result) == getHashAgg(test_table_write))
} else {
println("skip test for non-GCS platform: " +
"write a big DataFrame to GCS with presigned-url (Can be removed by Dec 2023)")
}
}

// GCS_USE_DOWNSCOPED_CREDENTIAL is not a public parameter, user can't set it.
// Only the snowflake test account can set it for testing purpose.
// From Dec 2023, GCS_USE_DOWNSCOPED_CREDENTIAL may be configured as true for all deployments
// and this test case can be removed at that time.
test("write a empty DataFrame to GCS with presigned-url (Can be removed by Dec 2023)") {
// Only run this test on GCS
if ("gcp".equals(System.getenv("SNOWFLAKE_TEST_ACCOUNT"))) {
val df = sparkSession.read
.format(SNOWFLAKE_SOURCE_NAME)
.options(connectorOptionsNoTable)
.option("query", s"select * from $test_table1 where 1 = 2")
.load()

// write a small DataFrame to a snowflake table
df.write
.format(SNOWFLAKE_SOURCE_NAME)
.options(connectorOptionsNoTable)
.option("dbtable", test_table_write)
// GCS_USE_DOWNSCOPED_CREDENTIAL is not a public parameter, user can't set it.
// The default value of GCS_USE_DOWNSCOPED_CREDENTIAL will be true from Dec 2023
// The option set can be removed after Dec 2023
.option("GCS_USE_DOWNSCOPED_CREDENTIAL", "false")
.mode(SaveMode.Overwrite)
.save()

// Check the source table and target table has same agg_hash.
assert(getRowCount(test_table_write) == 0)
} else {
println("skip test for non-GCS platform: " +
"write a empty DataFrame to GCS with presigned-url (Can be removed by Dec 2023)")
}
}
}
// scalastyle:on println

0 comments on commit e8a4dca

Please sign in to comment.