Github user zellerh commented on a diff in the pull request: https://github.com/apache/trafodion/pull/1682#discussion_r213034998 --- Diff: core/sql/sqludr/SqlUdrPredefLogReader.cpp --- @@ -1311,17 +1362,19 @@ bool ReadCppEventsUDFInterface::validateEvent(const UDRInvocationInfo &info, // All other comparisons are assumed to be string compares else { - // convert predicate value + // convert and trim predicate value temp = constStr; constStr.clear(); for(size_t j = 0; j < temp.size(); ++j) constStr += (std::toupper(temp[j])); + constStr.erase(constStr.find_last_not_of(" ")+1); --- End diff -- Actually, changing the code and debugging again made me realize what happens: For a string with something other than blanks, this will always return something other than string::npos. If the string contains all blanks or is empty, it will return -1 (string::npos), and adding 1 will give 0 and erase the entire string, which is again what we want. But it's ugly to rely on string::npos + 1 = 0, so I'll change it anyway. The resulting code looks ugly as well. It's disappointing that std::string makes it so hard to do a simple operation like trim.
---