trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] trafodion pull request #1496: [TRAFODION-3008] support a new TMUDF to genera...
Date Mon, 26 Mar 2018 15:41:14 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1496#discussion_r177136353
  
    --- Diff: core/sql/sqludr/SqlUdrPredefSeries.cpp ---
    @@ -0,0 +1,112 @@
    +// @@@ START COPYRIGHT @@@
    +//
    +// Licensed to the Apache Software Foundation (ASF) under one
    +// or more contributor license agreements.  See the NOTICE file
    +// distributed with this work for additional information
    +// regarding copyright ownership.  The ASF licenses this file
    +// to you under the Apache License, Version 2.0 (the
    +// "License"); you may not use this file except in compliance
    +// with the License.  You may obtain a copy of the License at
    +//
    +//   http://www.apache.org/licenses/LICENSE-2.0
    +//
    +// Unless required by applicable law or agreed to in writing,
    +// software distributed under the License is distributed on an
    +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +// KIND, either express or implied.  See the License for the
    +// specific language governing permissions and limitations
    +// under the License.
    +//
    +// @@@ END COPYRIGHT @@@
    +
    +#include "sqludr.h"
    +
    +using namespace tmudr;
    +
    +// sample invocation of the SERIES TMUDF:
    +//
    +// SELECT * FROM UDF(series(1, 100, 2));
    +// SELECT * FROM UDF(series(100, 1, -2));
    +// SELECT * FROM UDF(series(1, 100));
    +
    +/* Step 1: derive a class from tmudr::UDR*/
    +
    +class series : public UDR
    +{
    +public:
    +  // determine output columns dynamically at compile time
    +  void describeParamsAndColumns(UDRInvocationInfo &info);
    +  
    +  // override the runtime method
    +  virtual void processData(UDRInvocationInfo &info,
    +                           UDRPlanInfo &plan);
    +};
    +
    +/* Step 2: Create a factory method*/
    +
    +extern "C" UDR * SERIES()
    +{
    +  return new series();
    +}
    +
    +/*  Step 3: Write the actual UDF code*/
    +void series::describeParamsAndColumns(
    +                           UDRInvocationInfo &info)
    +{
    +  // We always expect one input parameter
    --- End diff --
    
    The comment is incorrect; from the code it looks like we expect either two or three input
parameters.


---

Mime
View raw message