[ 
https://issues.apache.org/jira/browse/TAJO-922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14501270#comment-14501270
 ] 

ASF GitHub Bot commented on TAJO-922:
-------------------------------------

Github user jihoonson commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/535#discussion_r28643215
  
    --- Diff: 
tajo-core/src/main/java/org/apache/tajo/engine/function/builtin/NtileDouble.java
 ---
    @@ -0,0 +1,105 @@
    +/**
    + * 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.
    + */
    +
    +package org.apache.tajo.engine.function.builtin;
    +
    +import org.apache.tajo.catalog.CatalogUtil;
    +import org.apache.tajo.catalog.Column;
    +import org.apache.tajo.common.TajoDataTypes;
    +import org.apache.tajo.datum.Datum;
    +import org.apache.tajo.datum.DatumFactory;
    +import org.apache.tajo.datum.Int8Datum;
    +import org.apache.tajo.engine.function.annotation.Description;
    +import org.apache.tajo.engine.function.annotation.ParamTypes;
    +import org.apache.tajo.plan.function.AggFunction;
    +import org.apache.tajo.plan.function.FunctionContext;
    +import org.apache.tajo.storage.Tuple;
    +
    +@Description(
    +    functionName = "ntile",
    +    description = "integer ranging from 1 to the argument value",
    +    example = "> SELECT ntile(expr);",
    +    returnType = TajoDataTypes.Type.INT8,
    +    paramTypes = {@ParamTypes(paramTypes = {TajoDataTypes.Type.INT8})}
    +)
    +public class NtileDouble extends AggFunction<Datum> {
    +  public NtileDouble() {
    +    super(new Column[] {
    +        new Column("expr", TajoDataTypes.Type.INT8)
    +    });
    +  }
    +  @Override
    +  public FunctionContext newContext() {
    +    return new NtileContext();
    +  }
    +
    +  @Override
    +  public void eval(FunctionContext ctx, Tuple params) {
    +    NtileContext ntileCtx = (NtileContext) ctx;
    +    if (ntileCtx.params == -1)
    +      ntileCtx.params = params.get(0).asInt4();
    +    ntileCtx.totCont++;
    +  }
    +
    +  @Override
    +  public Datum getPartialResult(FunctionContext ctx) {
    +    Datum d = null;
    --- End diff --
    
    Have you really finished the implementation of this function?


> Add NTH_VALUE window function
> -----------------------------
>
>                 Key: TAJO-922
>                 URL: https://issues.apache.org/jira/browse/TAJO-922
>             Project: Tajo
>          Issue Type: Sub-task
>          Components: function/udf, physical operator
>            Reporter: Hyunsik Choi
>            Assignee: Seungun Choe
>             Fix For: window function
>
>         Attachments: TAJO-922.patch
>
>
> The NTH_VALUE window function returns the value of the specified row of the 
> window frame relative to the first row of the window. We need to implement it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to