Java Code Examples for org.apache.kylin.common.KylinConfig#getStreamingMaxFragmentSizeInMb()

The following examples show how to use org.apache.kylin.common.KylinConfig#getStreamingMaxFragmentSizeInMb() . 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: ColumnarSegmentStore.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
protected List<DataSegmentFragment> doChooseFragments(KylinConfig config, List<DataSegmentFragment> allFragments,
        boolean ignoreMergedFragments) {
    List<DataSegmentFragment> result = Lists.newArrayList();
    int originFragmentsNum = allFragments.size();
    int minFragments = config.getStreamingMinFragmentsInSegment();
    long maxFragmentSize = config.getStreamingMaxFragmentSizeInMb() * 1024 * 1024L;
    long toMergeDataSize = 0;
    for (int i = 0; i < originFragmentsNum; i++) {
        DataSegmentFragment fragment = allFragments.get(i);
        if (originFragmentsNum - result.size() <= minFragments - 1) {
            return result;
        }
        if (fragment.getFragmentId().getEndId() > latestCheckpointFragment) {
            return result;
        }
        if (ignoreMergedFragments && fragment.isMergedFragment()) {
            if (result.size() > 1) {
                return result;
            } else if (result.size() == 1) {
                toMergeDataSize = 0;
                result.clear();
            }
            continue;
        }
        long fragmentDataSize = fragment.getDataFileSize();
        if (toMergeDataSize + fragmentDataSize <= maxFragmentSize) {
            toMergeDataSize += fragmentDataSize;
            result.add(fragment);
        } else if (result.size() > 1) {
            return result;
        } else if (result.size() == 1) {
            toMergeDataSize = 0;
            result.clear();
        }
    }
    return result;
}
 
Example 2
Source File: ColumnarSegmentStore.java    From kylin with Apache License 2.0 5 votes vote down vote up
protected List<DataSegmentFragment> doChooseFragments(KylinConfig config, List<DataSegmentFragment> allFragments,
        boolean ignoreMergedFragments) {
    List<DataSegmentFragment> result = Lists.newArrayList();
    int originFragmentsNum = allFragments.size();
    int minFragments = config.getStreamingMinFragmentsInSegment();
    long maxFragmentSize = config.getStreamingMaxFragmentSizeInMb() * 1024 * 1024L;
    long toMergeDataSize = 0;
    for (int i = 0; i < originFragmentsNum; i++) {
        DataSegmentFragment fragment = allFragments.get(i);
        if (originFragmentsNum - result.size() <= minFragments - 1) {
            return result;
        }
        if (fragment.getFragmentId().getEndId() > latestCheckpointFragment) {
            return result;
        }
        if (ignoreMergedFragments && fragment.isMergedFragment()) {
            if (result.size() > 1) {
                return result;
            } else if (result.size() == 1) {
                toMergeDataSize = 0;
                result.clear();
            }
            continue;
        }
        long fragmentDataSize = fragment.getDataFileSize();
        if (toMergeDataSize + fragmentDataSize <= maxFragmentSize) {
            toMergeDataSize += fragmentDataSize;
            result.add(fragment);
        } else if (result.size() > 1) {
            return result;
        } else if (result.size() == 1) {
            toMergeDataSize = 0;
            result.clear();
        }
    }
    return result;
}