Skip to content

Commit

Permalink
Remove table scan test
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Feb 24, 2025
1 parent 43b6bb8 commit 65e6415
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 123 deletions.
2 changes: 1 addition & 1 deletion velox/dwio/dwrf/test/E2EFilterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ DEBUG_ONLY_TEST_F(E2EFilterTest, longDecimal) {
30000, // rareMax
true);
},
true,
false,
{"longdecimal_val"},
20);
}
Expand Down
1 change: 0 additions & 1 deletion velox/exec/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ target_link_libraries(
velox_aggregates
velox_dwio_common
velox_dwio_common_exception
velox_dwio_orc_reader
velox_dwio_common_test_utils
velox_dwio_parquet_reader
velox_dwio_parquet_writer
Expand Down
121 changes: 0 additions & 121 deletions velox/exec/tests/TableScanTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "velox/connectors/hive/HivePartitionFunction.h"
#include "velox/dwio/common/CacheInputStream.h"
#include "velox/dwio/common/tests/utils/DataFiles.h"
#include "velox/dwio/orc/reader/OrcReader.h"
#include "velox/exec/Cursor.h"
#include "velox/exec/Exchange.h"
#include "velox/exec/OutputBufferManager.h"
Expand All @@ -46,7 +45,6 @@
#include "velox/exec/tests/utils/PlanBuilder.h"
#include "velox/exec/tests/utils/TempDirectoryPath.h"
#include "velox/expression/ExprToSubfieldFilter.h"
#include "velox/functions/lib/IsNull.h"
#include "velox/type/Timestamp.h"
#include "velox/type/Type.h"
#include "velox/type/tests/SubfieldFiltersBuilder.h"
Expand Down Expand Up @@ -80,7 +78,6 @@ class TableScanTest : public virtual HiveConnectorTestBase {
HiveConnectorTestBase::SetUp();
exec::ExchangeSource::factories().clear();
exec::ExchangeSource::registerFactory(createLocalExchangeSource);
orc::registerOrcReaderFactory();
}

static void SetUpTestCase() {
Expand Down Expand Up @@ -1858,124 +1855,6 @@ TEST_F(TableScanTest, validFileNoData) {
assertQuery(op, split, "");
}

TEST_F(TableScanTest, shortDecimalFilter) {
functions::registerIsNotNullFunction("isnotnull");

std::vector<std::optional<int64_t>> values = {
123456789123456789L,
987654321123456L,
std::nullopt,
2000000000000000L,
5000000000000000L,
987654321987654321L,
100000000000000L,
1230000000123456L,
120000000123456L,
std::nullopt};
auto rowVector = makeRowVector({
makeNullableFlatVector<int64_t>(values, DECIMAL(18, 6)),
});
createDuckDbTable({rowVector});

auto filePath = facebook::velox::test::getDataFilePath(
"velox/exec/tests", "data/short_decimal.orc");
auto split = exec::test::HiveConnectorSplitBuilder(filePath)
.start(0)
.length(fs::file_size(filePath))
.fileFormat(dwio::common::FileFormat::ORC)
.build();

auto rowType = ROW({"d"}, {DECIMAL(18, 6)});

// Is not null.
auto op =
PlanBuilder().tableScan(rowType, {}, "isnotnull(d)", rowType).planNode();
assertQuery(op, split, "SELECT c0 FROM tmp where c0 is not null");

// Is null.
op = PlanBuilder().tableScan(rowType, {}, "is_null(d)", rowType).planNode();
assertQuery(op, split, "SELECT c0 FROM tmp where c0 is null");

// BigintRange.
op =
PlanBuilder()
.tableScan(
rowType,
{},
"d > 2000000000.0::DECIMAL(18, 6) and d < 6000000000.0::DECIMAL(18, 6)",
rowType)
.planNode();
assertQuery(
op,
split,
"SELECT c0 FROM tmp where c0 > 2000000000.0 and c0 < 6000000000.0");

// NegatedBigintRange.
op =
PlanBuilder()
.tableScan(
rowType,
{},
"not(d between 2000000000.0::DECIMAL(18, 6) and 6000000000.0::DECIMAL(18, 6))",
rowType)
.planNode();
assertQuery(
op,
split,
"SELECT c0 FROM tmp where c0 < 2000000000.0 or c0 > 6000000000.0");
}

TEST_F(TableScanTest, longDecimalFilter) {
functions::registerIsNotNullFunction("isnotnull");

std::vector<std::optional<int128_t>> values = {
HugeInt::parse("123456789123456789123456789" + std::string(9, '0')),
HugeInt::parse("987654321123456789" + std::string(9, '0')),
std::nullopt,
HugeInt::parse("2" + std::string(37, '0')),
HugeInt::parse("5" + std::string(37, '0')),
HugeInt::parse("987654321987654321987654321" + std::string(9, '0')),
HugeInt::parse("1" + std::string(26, '0')),
HugeInt::parse("123000000012345678" + std::string(10, '0')),
HugeInt::parse("120000000123456789" + std::string(9, '0')),
HugeInt::parse("9" + std::string(37, '0'))};
auto rowVector = makeRowVector({
makeNullableFlatVector<int128_t>(values, DECIMAL(38, 18)),
});
createDuckDbTable({rowVector});

auto filePath = facebook::velox::test::getDataFilePath(
"velox/exec/tests", "data/long_decimal.orc");
auto split = exec::test::HiveConnectorSplitBuilder(filePath)
.start(0)
.length(fs::file_size(filePath))
.fileFormat(dwio::common::FileFormat::ORC)
.build();

auto rowType = ROW({"d"}, {DECIMAL(38, 18)});
auto op =
PlanBuilder().tableScan(rowType, {}, "isnotnull(d)", rowType).planNode();
assertQuery(op, split, "SELECT c0 FROM tmp where c0 is not null");

// Is null.
op = PlanBuilder().tableScan(rowType, {}, "is_null(d)", rowType).planNode();
assertQuery(op, split, "SELECT c0 FROM tmp where c0 is null");

// HugeintRange.
op =
PlanBuilder()
.tableScan(
rowType,
{},
"d > 2000000000.0::DECIMAL(38, 18) and d < 6000000000.0::DECIMAL(38, 18)",
rowType)
.planNode();
assertQuery(
op,
split,
"SELECT c0 FROM tmp where c0 > 2000000000.0 and c0 < 6000000000.0");
}

// An invalid (size = 0) file.
TEST_F(TableScanTest, emptyFile) {
auto filePath = TempFilePath::create();
Expand Down
Binary file removed velox/exec/tests/data/long_decimal.orc
Binary file not shown.
Binary file removed velox/exec/tests/data/short_decimal.orc
Binary file not shown.

0 comments on commit 65e6415

Please sign in to comment.