org.apache.hadoop.hive.common.type.Date.setTimeInDays()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(207)

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

Date.setTimeInDays介绍

暂无

代码示例

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

public Object set(Object o, Date value) {
 if (value == null) {
  return null;
 }
 ((Date) o).setTimeInDays(value.toEpochDay());
 return o;
}

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

@Override
public void readFields(DataInput in) throws IOException {
 date.setTimeInDays(WritableUtils.readVInt(in));
}

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

protected Date nextDay(Date d, int dayOfWeek) {
 date.setTimeInDays(d.toEpochDay());
 int currDayOfWeek = date.getDayOfWeek();
 int daysToAdd;
 if (currDayOfWeek < dayOfWeek) {
  daysToAdd = dayOfWeek - currDayOfWeek;
 } else {
  daysToAdd = 7 - currDayOfWeek + dayOfWeek;
 }
 date.setTimeInDays(date.toEpochDay() + daysToAdd);
 return date;
}

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

public Object set(Object o, DateWritableV2 d) {
 if (d == null) {
  return null;
 }
 ((Date) o).setTimeInDays(d.get().toEpochDay());
 return o;
}

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

/**
 * Perform date + int operation .
 * @param dt the date
 * @param interval the int (days)
 * @return the resulting date
 */
public Date add(Date dt, int interval) {
 if (dt == null) {
  return null;
 }
 Date dtResult = new Date();
 dtResult.setTimeInDays(dt.toEpochDay() + interval);
 return dtResult;
}

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

protected Date lastDay(Date d) {
  date.setTimeInDays(d.toEpochDay());
  date.setDayOfMonth(date.lengthOfMonth());
  return date;
 }
}

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

private Date evalDate(Date d) throws UDFArgumentException {
 date.setTimeInDays(d.toEpochDay());
 if ("MONTH".equals(fmtInput) || "MON".equals(fmtInput) || "MM".equals(fmtInput)) {
  date.setDayOfMonth(1);
  return date;
 } else if ("QUARTER".equals(fmtInput) || "Q".equals(fmtInput)) {
  int month = date.getMonth() - 1;
  int quarter = month / 3;
  int monthToSet = quarter * 3 + 1;
  date.setMonth(monthToSet);
  date.setDayOfMonth(1);
  return date;
 } else if ("YEAR".equals(fmtInput) || "YYYY".equals(fmtInput) || "YY".equals(fmtInput)) {
  date.setMonth(1);
  date.setDayOfMonth(1);
  return date;
 } else {
  return null;
 }
}

代码示例来源:origin: org.apache.hive/hive-serde

public Object set(Object o, Date value) {
 if (value == null) {
  return null;
 }
 ((Date) o).setTimeInDays(value.toEpochDay());
 return o;
}

代码示例来源:origin: org.apache.hive/hive-serde

@Override
public void readFields(DataInput in) throws IOException {
 date.setTimeInDays(WritableUtils.readVInt(in));
}

代码示例来源:origin: org.apache.hive/hive-serde

public Object set(Object o, DateWritableV2 d) {
 if (d == null) {
  return null;
 }
 ((Date) o).setTimeInDays(d.get().toEpochDay());
 return o;
}

相关文章