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

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

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

Date.toEpochDay介绍

暂无

代码示例

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

public int getDays() {
 return date.toEpochDay();
}

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

public static int dateToDays(Date d) {
 return d.toEpochDay();
}

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

@Override
public void write(DataOutput out) throws IOException {
 WritableUtils.writeVInt(out, (int) date.toEpochDay());
}

代码示例来源: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

@Deprecated
public static int dateToDays(java.sql.Date d) {
 return Date.ofEpochMilli(d.getTime()).toEpochDay();
}

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

public Object create(Date value) {
 return Date.ofEpochDay(value.toEpochDay());
}

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

public static int millisToDays(long millis) {
 return Date.ofEpochMilli(millis).toEpochDay();
}

代码示例来源: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

/**
 * Set the DateWritableV2 based on the year/month/day of the date in the local timezone.
 * @param d Date value
 */
public void set(Date d) {
 if (d == null) {
  date = new Date();
  return;
 }
 set(d.toEpochDay());
}

代码示例来源: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: apache/hive

hll.addToEstimator((HiveDecimal)val);
} else if (val instanceof Date) {
 hll.addInt(((Date)val).toEpochDay());
} else if (val instanceof Timestamp) {
 hll.addLong(((Timestamp)val).toEpochMilli());

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

final Date date = (Date) value;
 calciteLiteral = rexBuilder.makeDateLiteral(
   DateString.fromDaysSinceEpoch(date.toEpochDay()));
 break;
case TIMESTAMP:

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

public static int dateToDays(Date d) {
 return d.toEpochDay();
}

代码示例来源: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

@Deprecated
public static int dateToDays(java.sql.Date d) {
 return Date.ofEpochMilli(d.getTime()).toEpochDay();
}

代码示例来源: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;
}

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

/**
 * Set the DateWritableV2 based on the year/month/day of the date in the local timezone.
 * @param d Date value
 */
public void set(Date d) {
 if (d == null) {
  date = new Date();
  return;
 }
 set(d.toEpochDay());
}

相关文章