Package io.druid.segment

Examples of io.druid.segment.QueryableIndex


  @Override
  public Segment getSegment(DataSegment segment) throws SegmentLoadingException
  {
    File segmentFiles = getSegmentFiles(segment);
    final QueryableIndex index = factory.factorize(segmentFiles);

    return new QueryableIndexSegment(segment.getIdentifier(), index);
  }
View Full Code Here


            try {
              List<QueryableIndex> indexes = Lists.newArrayList();
              for (FireHydrant fireHydrant : sink) {
                Segment segment = fireHydrant.getSegment();
                final QueryableIndex queryableIndex = segment.asQueryableIndex();
                log.info("Adding hydrant[%s]", fireHydrant);
                indexes.add(queryableIndex);
              }

              final File mergedFile;
              if (config.isPersistInHeap()) {
                mergedFile = IndexMaker.mergeQueryableIndex(
                    indexes,
                    schema.getAggregators(),
                    mergedTarget
                );
              } else {
                mergedFile = IndexMerger.mergeQueryableIndex(
                    indexes,
                    schema.getAggregators(),
                    mergedTarget
                );
              }

              QueryableIndex index = IndexIO.loadIndex(mergedFile);

              DataSegment segment = dataSegmentPusher.push(
                  mergedFile,
                  sink.getSegment().withDimensions(Lists.newArrayList(index.getAvailableDimensions()))
              );

              segmentPublisher.publishSegment(segment);

              if (!isPushedMarker.createNewFile()) {
View Full Code Here

  @Parameterized.Parameters
  public static Collection<?> constructorFeeder() throws IOException
  {
    final IncrementalIndex rtIndex = makeIncrementalIndex();
    final QueryableIndex mMappedTestIndex = makeQueryableIndex();
    final QueryableIndex mergedRealtimeIndex = makeMergedQueryableIndex();
    return Arrays.asList(
        new Object[][]{
            {
                new IncrementalIndexSegment(rtIndex, null)
            },
View Full Code Here

      IndexMerger.persist(first, DATA_INTERVAL, firstFile);
      IndexMerger.persist(second, DATA_INTERVAL, secondFile);
      IndexMerger.persist(third, DATA_INTERVAL, thirdFile);

      QueryableIndex mergedRealtime = IndexIO.loadIndex(
          IndexMerger.mergeQueryableIndex(
              Arrays.asList(IndexIO.loadIndex(firstFile), IndexIO.loadIndex(secondFile), IndexIO.loadIndex(thirdFile)),
              METRIC_AGGS,
              mergedFile
          )
View Full Code Here

  @Parameterized.Parameters
  public static Collection<?> constructorFeeder() throws IOException
  {
    final IncrementalIndex rtIndex = makeIncrementalIndex();
    final QueryableIndex mMappedTestIndex = makeQueryableIndex();
    final QueryableIndex mergedRealtimeIndex = makeMergedQueryableIndex();
    return Arrays.asList(
        new Object[][]{
            {
                new IncrementalIndexSegment(rtIndex, null)
            },
View Full Code Here

      IndexMerger.persist(first, DATA_INTERVAL, firstFile);
      IndexMerger.persist(second, DATA_INTERVAL, secondFile);
      IndexMerger.persist(third, DATA_INTERVAL, thirdFile);

      QueryableIndex mergedRealtime = IndexIO.loadIndex(
          IndexMerger.mergeQueryableIndex(
              Arrays.asList(IndexIO.loadIndex(firstFile), IndexIO.loadIndex(secondFile), IndexIO.loadIndex(thirdFile)),
              METRIC_AGGS,
              mergedFile
          )
View Full Code Here

            fileToUpload = new File(tmpSegmentDir, "merged");
            IndexMaker.mergeQueryableIndex(indexes, schema.getAggregators(), fileToUpload);
          }

          // Map merged segment so we can extract dimensions
          final QueryableIndex mappedSegment = IndexIO.loadIndex(fileToUpload);

          final DataSegment segmentToUpload = theSink.getSegment()
                                                     .withDimensions(ImmutableList.copyOf(mappedSegment.getAvailableDimensions()))
                                                     .withBinaryVersion(SegmentUtils.getVersionFromDir(fileToUpload));

          dataSegmentPusher.push(fileToUpload, segmentToUpload);

          log.info(
View Full Code Here

      @Override
      public Sequence<SegmentAnalysis> run(Query<SegmentAnalysis> inQ, Map<String, Object> context)
      {
        SegmentMetadataQuery query = (SegmentMetadataQuery) inQ;

        final QueryableIndex index = segment.asQueryableIndex();
        if (index == null) {
          return Sequences.empty();
        }

        final Map<String, ColumnAnalysis> analyzedColumns = analyzer.analyze(index);

        // Initialize with the size of the whitespace, 1 byte per
        long totalSize = analyzedColumns.size() * index.getNumRows();

        Map<String, ColumnAnalysis> columns = Maps.newTreeMap();
        ColumnIncluderator includerator = query.getToInclude();
        for (Map.Entry<String, ColumnAnalysis> entry : analyzedColumns.entrySet()) {
          final String columnName = entry.getKey();
View Full Code Here

      QueryRunnerFactory factory
  )
      throws IOException
  {
    final IncrementalIndex rtIndex = TestIndex.getIncrementalTestIndex(false);
    final QueryableIndex mMappedTestIndex = TestIndex.getMMappedTestIndex();
    final QueryableIndex mergedRealtimeIndex = TestIndex.mergedRealtimeIndex();
    final IncrementalIndex rtIndexOffheap = TestIndex.getIncrementalTestIndex(true);
    return Arrays.asList(
        new Object[][]{
            {
                makeQueryRunner(factory, new IncrementalIndexSegment(rtIndex, segmentId))
View Full Code Here

      QueryRunnerFactory factory
  )
      throws IOException
  {
    final IncrementalIndex rtIndex = TestIndex.getIncrementalTestIndex(false);
    final QueryableIndex mMappedTestIndex = TestIndex.getMMappedTestIndex();
    final QueryableIndex mergedRealtimeIndex = TestIndex.mergedRealtimeIndex();
    final IncrementalIndex rtIndexOffheap = TestIndex.getIncrementalTestIndex(true);

    return Arrays.asList(
        new Object[][]{
            {
View Full Code Here

TOP

Related Classes of io.druid.segment.QueryableIndex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.