Hao Chen created KYLIN-1506:
-------------------------------

             Summary: Refactor time-based filter on resource
                 Key: KYLIN-1506
                 URL: https://issues.apache.org/jira/browse/KYLIN-1506
             Project: Kylin
          Issue Type: Sub-task
            Reporter: Hao Chen


Currently all operations like getJobOutputs/getJobs and so on are use two-times 
scan to get the response, for example, currently the scan always:
1. Get keys, sort, get first and last key (in fact which is just get by prefix 
filter)
2. Re-scan the keys with timestamp filter.

{code}
public List<ExecutableOutputPO> getJobOutputs(long timeStartInMillis, long 
timeEndInMillis) throws PersistentException {
        try {
            NavigableSet<String> resources = 
store.listResources(ResourceStore.EXECUTE_OUTPUT_RESOURCE_ROOT);
            if (resources == null || resources.isEmpty()) {
                return Collections.emptyList();
            }
            // Collections.sort(resources);
            String rangeStart = resources.first();
            String rangeEnd = resources.last();
            return store.getAllResources(rangeStart, rangeEnd, 
timeStartInMillis, timeEndInMillis, ExecutableOutputPO.class, 
JOB_OUTPUT_SERIALIZER);
        } catch (IOException e) {
            logger.error("error get all Jobs:", e);
            throw new PersistentException(e);
        }
    }
{code}





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to