org.apache.hadoop.hive.ql.io.parquet.timestamp.NanoTime.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(161)

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

NanoTime.<init>介绍

暂无

代码示例

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

private Timestamp convert(Binary binary) {
 ByteBuffer buf = binary.toByteBuffer();
 buf.order(ByteOrder.LITTLE_ENDIAN);
 long timeOfDayNanos = buf.getLong();
 int julianDay = buf.getInt();
 NanoTime nt = new NanoTime(julianDay, timeOfDayNanos);
 return NanoTimeUtils.getTimestamp(nt, skipTimestampConversion);
}

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

public static NanoTime fromBinary(Binary bytes) {
 Preconditions.checkArgument(bytes.length() == 12, "Must be 12 bytes");
 ByteBuffer buf = bytes.toByteBuffer();
 buf.order(ByteOrder.LITTLE_ENDIAN);
 long timeOfDayNanos = buf.getLong();
 int julianDay = buf.getInt();
 return new NanoTime(julianDay, timeOfDayNanos);
}

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

public static NanoTime getNanoTime(Timestamp ts, boolean skipConversion) {
 Calendar calendar = getCalendar(skipConversion);
 calendar.setTime(ts);
 int year = calendar.get(Calendar.YEAR);
 if (calendar.get(Calendar.ERA) == GregorianCalendar.BC) {
  year = 1 - year;
 }
 JDateTime jDateTime = new JDateTime(year,
  calendar.get(Calendar.MONTH) + 1,  //java calendar index starting at 1.
  calendar.get(Calendar.DAY_OF_MONTH));
 int days = jDateTime.getJulianDayNumber();
 long hour = calendar.get(Calendar.HOUR_OF_DAY);
 long minute = calendar.get(Calendar.MINUTE);
 long second = calendar.get(Calendar.SECOND);
 long nanos = ts.getNanos();
 long nanosOfDay = nanos + NANOS_PER_SECOND * second + NANOS_PER_MINUTE * minute +
   NANOS_PER_HOUR * hour;
 return new NanoTime(days, nanosOfDay);
}

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

public static NanoTime fromBinary(Binary bytes) {
 Preconditions.checkArgument(bytes.length() == 12, "Must be 12 bytes");
 ByteBuffer buf = bytes.toByteBuffer();
 buf.order(ByteOrder.LITTLE_ENDIAN);
 long timeOfDayNanos = buf.getLong();
 int julianDay = buf.getInt();
 return new NanoTime(julianDay, timeOfDayNanos);
}

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

public static NanoTime getNanoTime(Timestamp ts, boolean skipConversion) {
 Calendar calendar = getCalendar(skipConversion);
 calendar.setTimeInMillis(ts.toEpochMilli());
 int year = calendar.get(Calendar.YEAR);
 if (calendar.get(Calendar.ERA) == GregorianCalendar.BC) {
  year = 1 - year;
 }
 JDateTime jDateTime = new JDateTime(year,
  calendar.get(Calendar.MONTH) + 1,  //java calendar index starting at 1.
  calendar.get(Calendar.DAY_OF_MONTH));
 int days = jDateTime.getJulianDayNumber();
 long hour = calendar.get(Calendar.HOUR_OF_DAY);
 long minute = calendar.get(Calendar.MINUTE);
 long second = calendar.get(Calendar.SECOND);
 long nanos = ts.getNanos();
 long nanosOfDay = nanos + NANOS_PER_SECOND * second + NANOS_PER_MINUTE * minute +
   NANOS_PER_HOUR * hour;
 return new NanoTime(days, nanosOfDay);
}

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

NanoTime n3 = new NanoTime(n1.getJulianDay() - 1, n1.getTimeOfDayNanos() + TimeUnit.DAYS.toNanos(1));
Assert.assertEquals(ts1, NanoTimeUtils.getTimestamp(n3, false));
n3 = new NanoTime(n1.getJulianDay() + 3, n1.getTimeOfDayNanos() - TimeUnit.DAYS.toNanos(3));
Assert.assertEquals(ts1, NanoTimeUtils.getTimestamp(n3, false));

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

long timeOfDayNanos = buf.getLong();
int julianDay = buf.getInt();
NanoTime nt = new NanoTime(julianDay, timeOfDayNanos);
Timestamp ts = NanoTimeUtils.getTimestamp(nt, skipTimestampConversion);
((TimestampColumnVector) column).set(i, ts);

代码示例来源:origin: com.facebook.presto.hive/hive-apache

public static NanoTime getNanoTime(Timestamp ts, boolean skipConversion) {
 Calendar calendar = getCalendar(skipConversion);
 calendar.setTime(ts);
 JDateTime jDateTime = new JDateTime(calendar.get(Calendar.YEAR),
  calendar.get(Calendar.MONTH) + 1,  //java calendar index starting at 1.
  calendar.get(Calendar.DAY_OF_MONTH));
 int days = jDateTime.getJulianDayNumber();
 long hour = calendar.get(Calendar.HOUR_OF_DAY);
 long minute = calendar.get(Calendar.MINUTE);
 long second = calendar.get(Calendar.SECOND);
 long nanos = ts.getNanos();
 long nanosOfDay = nanos + NANOS_PER_SECOND * second + NANOS_PER_MINUTE * minute +
   NANOS_PER_HOUR * hour;
 return new NanoTime(days, nanosOfDay);
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

public static NanoTime fromBinary(Binary bytes) {
 Preconditions.checkArgument(bytes.length() == 12, "Must be 12 bytes");
 ByteBuffer buf = bytes.toByteBuffer();
 buf.order(ByteOrder.LITTLE_ENDIAN);
 long timeOfDayNanos = buf.getLong();
 int julianDay = buf.getInt();
 return new NanoTime(julianDay, timeOfDayNanos);
}

相关文章