gpt4 book ai didi

org.apache.phoenix.expression.function.YearFunction类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 04:49:31 28 4
gpt4 key购买 nike

本文整理了Java中org.apache.phoenix.expression.function.YearFunction类的一些代码示例,展示了YearFunction类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearFunction类的具体详情如下:
包路径:org.apache.phoenix.expression.function.YearFunction
类名称:YearFunction

YearFunction介绍

[英]Implementation of the Year() buildin. Input Date/Timestamp.
[中]年()建设的实施。输入日期/时间戳。

代码示例

代码示例来源:origin: apache/phoenix

@Override
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
  Expression expression = getChildExpression();
  if (!expression.evaluate(tuple, ptr)) {
    return false;
  }
  if ( ptr.getLength() == 0) {
    return true; //means null
  }
  long dateTime = inputCodec.decodeLong(ptr, expression.getSortOrder());
  DateTime dt = new DateTime(dateTime);
  int year = dt.getYear();
  PDataType returnType = getDataType();
  byte[] byteValue = new byte[returnType.getByteSize()];
  returnType.getCodec().encodeInt(year, byteValue, 0);
  ptr.set(byteValue);
  return true;
}

代码示例来源:origin: org.apache.phoenix/phoenix-core

@Override
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
  Expression expression = getChildExpression();
  if (!expression.evaluate(tuple, ptr)) {
    return false;
  }
  if ( ptr.getLength() == 0) {
    return true; //means null
  }
  long dateTime = inputCodec.decodeLong(ptr, expression.getSortOrder());
  DateTime dt = new DateTime(dateTime);
  int year = dt.getYear();
  PDataType returnType = getDataType();
  byte[] byteValue = new byte[returnType.getByteSize()];
  returnType.getCodec().encodeInt(year, byteValue, 0);
  ptr.set(byteValue);
  return true;
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

@Override
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
  Expression expression = getChildExpression();
  if (!expression.evaluate(tuple, ptr)) {
    return false;
  }
  if ( ptr.getLength() == 0) {
    return true; //means null
  }
  long dateTime = inputCodec.decodeLong(ptr, expression.getSortOrder());
  DateTime dt = new DateTime(dateTime);
  int year = dt.getYear();
  PDataType returnType = getDataType();
  byte[] byteValue = new byte[returnType.getByteSize()];
  returnType.getCodec().encodeInt(year, byteValue, 0);
  ptr.set(byteValue);
  return true;
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com