本文整理了Java中org.apache.kylin.common.util.DateFormat.formatToTimeWithoutMilliStr()
方法的一些代码示例,展示了DateFormat.formatToTimeWithoutMilliStr()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateFormat.formatToTimeWithoutMilliStr()
方法的具体详情如下:
包路径:org.apache.kylin.common.util.DateFormat
类名称:DateFormat
方法名:formatToTimeWithoutMilliStr
暂无
代码示例来源:origin: apache/kylin
/**
*
* @param id
* @return return like "0000001430812800000"
*/
@Override
protected String getValueFromIdImpl(int id) {
if (id == nullId())
return null;
long millis = 1000L * id;
return DateFormat.formatToTimeWithoutMilliStr(millis);
}
代码示例来源:origin: apache/kylin
public void encodeDecode(String origin) {
long a = encode(origin);
String back = decode(a);
String originChoppingMilis = DateFormat.formatToTimeWithoutMilliStr(DateFormat.stringToMillis(origin));
String backMillis = DateFormat.formatToTimeWithoutMilliStr(Long.parseLong(back));
Assert.assertEquals(originChoppingMilis, backMillis);
}
代码示例来源:origin: apache/kylin
case 1:
normalized = TimeUtil.getMinuteStart(t);
result.add(DateFormat.formatToTimeWithoutMilliStr(normalized));
break;
case 2:
normalized = TimeUtil.getHourStart(t);
result.add(DateFormat.formatToTimeWithoutMilliStr(normalized));
break;
case 3:
代码示例来源:origin: apache/kylin
private String tsRangeToStr(long ts, PartitionDesc part) {
String value;
DataType partitionColType = part.getPartitionDateColumnRef().getType();
if (partitionColType.isDate()) {
value = DateFormat.formatToDateStr(ts);
} else if (partitionColType.isTimeFamily()) {
value = DateFormat.formatToTimeWithoutMilliStr(ts);
} else if (partitionColType.isStringFamily() || partitionColType.isIntegerFamily()) {//integer like 20160101
String partitionDateFormat = part.getPartitionDateFormat();
if (StringUtils.isEmpty(partitionDateFormat)) {
value = "" + ts;
} else {
value = DateFormat.formatToDateStr(ts, partitionDateFormat);
}
} else {
throw new RuntimeException("Type " + partitionColType + " is not valid partition column type");
}
return value;
}
代码示例来源:origin: apache/kylin
private ByteArray encodeTime(long ts, int index, int roundingFlag) {
String value;
DataType partitionColType = info.getColumnType(index);
if (partitionColType.isDate()) {
value = DateFormat.formatToDateStr(ts);
} else if (partitionColType.isTimeFamily()) {
value = DateFormat.formatToTimeWithoutMilliStr(ts);
} else if (partitionColType.isStringFamily() || partitionColType.isIntegerFamily()) {//integer like 20160101
String partitionDateFormat = segment.getModel().getPartitionDesc().getPartitionDateFormat();
if (StringUtils.isEmpty(partitionDateFormat)) {
value = "" + ts;
} else {
value = DateFormat.formatToDateStr(ts, partitionDateFormat);
}
} else {
throw new RuntimeException("Type " + partitionColType + " is not valid partition column type");
}
ByteBuffer buffer = ByteBuffer.allocate(info.getMaxColumnLength());
info.getCodeSystem().encodeColumnValue(index, value, roundingFlag, buffer);
return ByteArray.copyOf(buffer.array(), 0, buffer.position());
}
}
代码示例来源:origin: apache/kylin
public void encodeDecode(String origin) {
int a = dict.getIdFromValue(origin);
String back = dict.getValueFromId(a);
String originChoppingMilis = DateFormat.formatToTimeWithoutMilliStr(DateFormat.stringToMillis(origin));
Assert.assertEquals(originChoppingMilis, back);
}
代码示例来源:origin: org.apache.kylin/kylin-core-dictionary
/**
*
* @param id
* @return return like "0000001430812800000"
*/
@Override
protected String getValueFromIdImpl(int id) {
if (id == nullId())
return null;
long millis = 1000L * id;
return DateFormat.formatToTimeWithoutMilliStr(millis);
}
代码示例来源:origin: org.apache.kylin/kylin-source-kafka
case 1:
normalized = TimeUtil.getMinuteStart(t);
result.add(DateFormat.formatToTimeWithoutMilliStr(normalized));
break;
case 2:
normalized = TimeUtil.getHourStart(t);
result.add(DateFormat.formatToTimeWithoutMilliStr(normalized));
break;
case 3:
代码示例来源:origin: org.apache.kylin/kylin-core-cube
private String tsRangeToStr(long ts, PartitionDesc part) {
String value;
DataType partitionColType = part.getPartitionDateColumnRef().getType();
if (partitionColType.isDate()) {
value = DateFormat.formatToDateStr(ts);
} else if (partitionColType.isTimeFamily()) {
value = DateFormat.formatToTimeWithoutMilliStr(ts);
} else if (partitionColType.isStringFamily() || partitionColType.isIntegerFamily()) {//integer like 20160101
String partitionDateFormat = part.getPartitionDateFormat();
if (StringUtils.isEmpty(partitionDateFormat)) {
value = "" + ts;
} else {
value = DateFormat.formatToDateStr(ts, partitionDateFormat);
}
} else {
throw new RuntimeException("Type " + partitionColType + " is not valid partition column type");
}
return value;
}
代码示例来源:origin: org.apache.kylin/kylin-core-cube
private ByteArray encodeTime(long ts, int index, int roundingFlag) {
String value;
DataType partitionColType = info.getColumnType(index);
if (partitionColType.isDate()) {
value = DateFormat.formatToDateStr(ts);
} else if (partitionColType.isTimeFamily()) {
value = DateFormat.formatToTimeWithoutMilliStr(ts);
} else if (partitionColType.isStringFamily() || partitionColType.isIntegerFamily()) {//integer like 20160101
String partitionDateFormat = segment.getModel().getPartitionDesc().getPartitionDateFormat();
if (StringUtils.isEmpty(partitionDateFormat)) {
value = "" + ts;
} else {
value = DateFormat.formatToDateStr(ts, partitionDateFormat);
}
} else {
throw new RuntimeException("Type " + partitionColType + " is not valid partition column type");
}
ByteBuffer buffer = ByteBuffer.allocate(info.getMaxColumnLength());
info.getCodeSystem().encodeColumnValue(index, value, roundingFlag, buffer);
return ByteArray.copyOf(buffer.array(), 0, buffer.position());
}
}
内容来源于网络,如有侵权,请联系作者删除!