rapidsai/cudf

[BUG] AST evaluation should check for bounds checking for column_reference

Geschlossen

#19.367 geöffnet am 14.07.2025

 (5 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C++ (735 Forks)batch import
buggood first issuelibcudf

Repository-Metriken

Stars
 (6.000 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 17T 21h) (230 gemergte PRs in 30 T)

Beschreibung

Describe the bug When column_reference is out of bounds, AST errors with C++ exception with description "vector::_M_range_check: __n (which is 2) >= this->size() (which is 2)" thrown in the test body. This error is hard to debug and narrow down exact error.

Steps/Code to reproduce bug Add following test to cpp/tests/ast/transform_tests.cpp

cpp
TEST_F(TransformTest, ColumnReferenceExceed)
{
  auto c_0   = column_wrapper<int32_t>{3, 20, 1, 50};
  auto c_1   = column_wrapper<int32_t>{10, 7, 20, 0};
  auto table = cudf::table_view{{c_0, c_1}};

  auto col_ref_0 = cudf::ast::column_reference(2);

  auto const& expected = c_0;
  auto result          = cudf::compute_column(table, col_ref_0);

  CUDF_TEST_EXPECT_COLUMNS_EQUAL(expected, result->view(), verbosity);
}

Expected behavior Consider bounds checking of column index before https://github.com/rapidsai/cudf/blob/ac03ea89ab835f407356874f41e90bd6a5a89654/cpp/src/ast/expression_parser.cpp#L223 and throw relevant error, or std::out_of_range

Additional context I encountered this bug while debugging filter evaluation for velox.

Contributor Guide