[
https://issues.apache.org/jira/browse/TRAFODION-3177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16593886#comment-16593886
]
ASF GitHub Bot commented on TRAFODION-3177:
-------------------------------------------
Github user zellerh commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1682#discussion_r213030480
--- 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 --
That's a very good point. Actually, when I made the change I googled "trim
string C++" and found something like this:
https://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring.
Then I just copied the solution without thinking too much of it.
When I debug it, it works fine and does not delete the entire string, but
I'm not sure why. Adding 1 to string::npos clearly doesn't seem like a good
idea.
I'll change the code.
> Error when selecting count(*) from event_log_reader UDF
> -------------------------------------------------------
>
> Key: TRAFODION-3177
> URL: https://issues.apache.org/jira/browse/TRAFODION-3177
> Project: Apache Trafodion
> Issue Type: Bug
> Components: sql-general
> Affects Versions: 2.1-incubating
> Reporter: Hans Zeller
> Assignee: Hans Zeller
> Priority: Major
> Fix For: 2.4
>
>
> When selecting no columns from the event_log_reader UDF, like in a select
> count( * ), I am getting the following error:
> {quote}>>prepare s from select count( * ) from udf(event_log_reader());
> *
> **
> *** ERROR[11252] Trying to access column number 11 but column list has only
> 10 elements (SQLSTATE 38900){quote}
> This is the same for both the predefined UDF or the one in schema "_LIBMGR_".
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)