From 7afc0f0a223a39010474365602aab691e726fae7 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Thu, 18 Mar 2021 09:28:29 -0500 Subject: [PATCH] review changes to handle invalid column names --- cpp/src/io/orc/orc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpp/src/io/orc/orc.cpp b/cpp/src/io/orc/orc.cpp index 6cec7bbe6f6..e1b6c3ace6c 100644 --- a/cpp/src/io/orc/orc.cpp +++ b/cpp/src/io/orc/orc.cpp @@ -538,17 +538,19 @@ std::vector metadata::select_columns(std::vector use_names, if (not use_names.empty()) { int index = 0; for (const auto &use_name : use_names) { + bool name_found = false; for (int i = 0; i < get_num_columns(); ++i, ++index) { if (index >= get_num_columns()) { index = 0; } if (get_column_name(index) == use_name) { + name_found = true; selection.emplace_back(index); if (ff.types[index].kind == orc::TIMESTAMP) { has_timestamp_column = true; } index++; break; } } + CUDF_EXPECTS(name_found, "Unknown column name : " + std::string(use_name)); } - CUDF_EXPECTS(selection.size() > 0, "Filtered out all columns"); } else { // For now, only select all leaf nodes for (int i = 1; i < get_num_columns(); ++i) {