OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SqlFirstLastValueInFrame.java
Go to the documentation of this file.
1 package com.mapd.parser.extension.ddl;
2 
3 import com.google.common.base.Preconditions;
4 
5 import org.apache.calcite.sql.SqlAggFunction;
6 import org.apache.calcite.sql.SqlFunctionCategory;
7 import org.apache.calcite.sql.SqlKind;
8 import org.apache.calcite.sql.type.OperandTypes;
9 import org.apache.calcite.sql.type.ReturnTypes;
10 import org.apache.calcite.util.Optionality;
11 
12 import java.util.List;
13 
14 public class SqlFirstLastValueInFrame extends SqlAggFunction {
15  //~ Constructors -----------------------------------------------------------
16 
17  public SqlFirstLastValueInFrame(String functionName, SqlKind kind) {
18  super(functionName,
19  null,
20  kind,
21  ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
22  null,
23  OperandTypes.ANY,
24  SqlFunctionCategory.NUMERIC,
25  true,
26  true,
27  Optionality.FORBIDDEN);
28  Preconditions.checkArgument(
29  kind == SqlKind.FIRST_VALUE || kind == SqlKind.LAST_VALUE);
30  }
31 
32  //~ Methods ----------------------------------------------------------------
33 
34  @Override
35  public boolean allowsNullTreatment() {
36  return true;
37  }
38 
39  @Override
40  public boolean allowsFraming() {
41  return true;
42  }
43 }