Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
majetideepak committed Oct 24, 2024
1 parent aae682d commit 7f01fe0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions velox/connectors/hive/storage_adapters/gcs/GCSUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ inline void setBucketAndKeyFromGCSPath(
key = path.substr(firstSep + 1);
}

inline std::string gcsURI(std::string_view bucket) {
std::stringstream ss;
ss << kGCSScheme << bucket;
return ss.str();
}

inline std::string gcsURI(std::string_view bucket, std::string_view key) {
std::stringstream ss;
ss << kGCSScheme << bucket << kSep << key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ std::shared_ptr<GcsTestbench> GCSInsertTest::testbench_ = nullptr;

TEST_F(GCSInsertTest, gcsInsertTest) {
const int64_t kExpectedRows = 1'000;
const std::string_view newFile = "insertFile.txt";
const auto gcsFile = gcsURI(testbench_->preexistingBucketName(), newFile);
const auto gcsBucket = gcsURI(testbench_->preexistingBucketName());

auto rowType = ROW(
{"c0", "c1", "c2", "c3"}, {BIGINT(), INTEGER(), SMALLINT(), DOUBLE()});
Expand All @@ -100,10 +99,11 @@ TEST_F(GCSInsertTest, gcsInsertTest) {
makeFlatVector<double>(kExpectedRows, [](auto row) { return row; })});

// Insert into GCS with one writer.
auto plan = PlanBuilder()
.values({input})
.tableWrite(gcsFile.data(), dwio::common::FileFormat::PARQUET)
.planNode();
auto plan =
PlanBuilder()
.values({input})
.tableWrite(gcsBucket.data(), dwio::common::FileFormat::PARQUET)
.planNode();

// Execute the write plan.
auto results = AssertQueryBuilder(plan).copyResults(pool());
Expand Down Expand Up @@ -132,7 +132,7 @@ TEST_F(GCSInsertTest, gcsInsertTest) {
// Read from 'writeFileName' and verify the data matches the original.
plan = PlanBuilder().tableScan(rowType).planNode();

auto filePath = fmt::format("{}{}", gcsFile, writeFileName);
auto filePath = fmt::format("{}/{}", gcsBucket, writeFileName);
const int64_t fileSize = fileWriteInfos[0]["fileSize"].asInt();
auto split = HiveConnectorSplitBuilder(filePath)
.fileFormat(dwio::common::FileFormat::PARQUET)
Expand Down

0 comments on commit 7f01fe0

Please sign in to comment.