Java Code Examples for org.apache.kylin.metadata.model.PartitionDesc#getPartitionDateFormat()

The following examples show how to use org.apache.kylin.metadata.model.PartitionDesc#getPartitionDateFormat() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JoinedFormatter.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
private void setDateEnv(IJoinedFlatTableDesc flatDesc) {
    DataModelDesc model = flatDesc.getDataModel();
    PartitionDesc partDesc = model.getPartitionDesc();
    SegmentRange segRange = flatDesc.getSegRange();
    long startInclusive = (Long) segRange.start.v;
    long endExclusive = (Long) segRange.end.v;
    //
    String startDate = "";
    String endDate = "";
    String partitionColumnDateFormat = partDesc.getPartitionDateFormat();
    if (partDesc.getPartitionTimeColumn() == null && partDesc.getPartitionDateColumn() == null) {
        startDate = String.valueOf(startInclusive);
        endDate = String.valueOf(endExclusive);
    } else {
        startDate = DateFormat.formatToDateStr(startInclusive, partitionColumnDateFormat);
        endDate = DateFormat.formatToDateStr(endExclusive, partitionColumnDateFormat);
    }
    setKeyValue(START_DATE, startDate);
    setKeyValue(END_DATE, endDate);
}
 
Example 2
Source File: SegmentPruner.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
private static 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;
}
 
Example 3
Source File: JoinedFormatter.java    From kylin with Apache License 2.0 6 votes vote down vote up
private void setDateEnv(IJoinedFlatTableDesc flatDesc) {
    DataModelDesc model = flatDesc.getDataModel();
    PartitionDesc partDesc = model.getPartitionDesc();
    SegmentRange segRange = flatDesc.getSegRange();
    long startInclusive = (Long) segRange.start.v;
    long endExclusive = (Long) segRange.end.v;
    //
    String startDate = "";
    String endDate = "";
    String partitionColumnDateFormat = partDesc.getPartitionDateFormat();
    if (partDesc.getPartitionTimeColumn() == null && partDesc.getPartitionDateColumn() == null) {
        startDate = String.valueOf(startInclusive);
        endDate = String.valueOf(endExclusive);
    } else {
        startDate = DateFormat.formatToDateStr(startInclusive, partitionColumnDateFormat);
        endDate = DateFormat.formatToDateStr(endExclusive, partitionColumnDateFormat);
    }
    setKeyValue(START_DATE, startDate);
    setKeyValue(END_DATE, endDate);
}
 
Example 4
Source File: SegmentPruner.java    From kylin with Apache License 2.0 6 votes vote down vote up
private static 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;
}