Skip to content

Commit 38f9ae6

Browse files
committed
[native] Allow empty file in table scan
1 parent 6ba1e14 commit 38f9ae6

File tree

1 file changed

+0
-50
lines changed

1 file changed

+0
-50
lines changed

presto-native-execution/presto_cpp/main/tests/TaskManagerTest.cpp

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -337,17 +337,6 @@ class TaskManagerTest : public exec::test::OperatorTestBase,
337337
return filePaths;
338338
}
339339

340-
std::vector<std::string> makeEmptyFiles(
341-
const std::shared_ptr<TempDirectoryPath>& dirPath,
342-
int count) {
343-
std::vector<std::string> filePaths = makeFilePaths(dirPath, count);
344-
auto fs = filesystems::getFileSystem(dirPath->getPath(), nullptr);
345-
for (const auto& filePath : filePaths) {
346-
fs->openFileForWrite(filePath);
347-
}
348-
return filePaths;
349-
}
350-
351340
protocol::ScheduledSplit makeSplit(
352341
const std::string& filePath,
353342
long sequenceId) {
@@ -978,45 +967,6 @@ TEST_P(TaskManagerTest, tableScanMultipleTasks) {
978967
outputTaskInfo->taskId, rowType_, "SELECT * FROM tmp WHERE c0 % 5 = 1");
979968
}
980969

981-
// Create a task to scan an empty (invalid) ORC file. Ensure that the error
982-
// propagates via getTaskStatus().
983-
TEST_P(TaskManagerTest, emptyFile) {
984-
const auto tableDir = exec::test::TempDirectoryPath::create();
985-
auto filePaths = makeEmptyFiles(tableDir, 1);
986-
auto planFragment = exec::test::PlanBuilder()
987-
.tableScan(rowType_)
988-
.partitionedOutput({}, 1, {"c0", "c1"})
989-
.planFragment();
990-
991-
// Create task to scan an empty file.
992-
auto source = makeSource("0", filePaths, true);
993-
protocol::TaskId taskId = "scan.0.0.1.0";
994-
protocol::TaskUpdateRequest updateRequest;
995-
updateRequest.sources.push_back(source);
996-
auto taskInfo = createOrUpdateTask(taskId, updateRequest, planFragment);
997-
998-
protocol::Duration longWait("300s");
999-
auto statusRequestState = http::CallbackRequestHandlerState::create();
1000-
1001-
// Keep polling until we see the error. Try for 5 times, sleep 100ms.
1002-
for (size_t i = 0;; i++) {
1003-
if (i > 5) {
1004-
FAIL() << "Didn't get a failure after " << i << " tries";
1005-
}
1006-
1007-
auto taskStatus =
1008-
taskManager_->getTaskStatus(taskId, {}, longWait, statusRequestState)
1009-
.get();
1010-
if (not taskStatus->failures.empty()) {
1011-
EXPECT_EQ(1, taskStatus->failures.size());
1012-
const auto& failure = taskStatus->failures.front();
1013-
EXPECT_THAT(failure.message, testing::ContainsRegex("ORC file is empty"));
1014-
break;
1015-
}
1016-
std::this_thread::sleep_for(std::chrono::milliseconds(100));
1017-
}
1018-
}
1019-
1020970
TEST_P(TaskManagerTest, countAggregation) {
1021971
const auto tableDir = exec::test::TempDirectoryPath::create();
1022972
auto filePaths = makeFilePaths(tableDir, 5);

0 commit comments

Comments
 (0)