Package io.druid.segment

Examples of io.druid.segment.LongColumnSelector


          {
            @Override
            public LongColumnSelector makeLongColumnSelector(String columnName)
            {
              if(columnName.equals(Column.TIME_COLUMN_NAME)){
                return new LongColumnSelector()
                {
                  @Override
                  public long get()
                  {
                    return in.get().getTimestampFromEpoch();
                  }
                };
              }
              final String metricName = columnName.toLowerCase();
              return new LongColumnSelector()
              {
                @Override
                public long get()
                {
                  return in.get().getLongMetric(metricName);
View Full Code Here


              public LongColumnSelector makeLongColumnSelector(String columnName)
              {
                final String metricName = columnName.toLowerCase();

                if(metricName.equals(Column.TIME_COLUMN_NAME)){
                  return new LongColumnSelector()
                  {
                    @Override
                    public long get()
                    {
                      return currEntry.getKey().getTimestamp();
                    }
                  };
                }
                final Integer metricIndexInt = index.getMetricIndex(metricName);
                if (metricIndexInt == null) {
                  return new LongColumnSelector()
                  {
                    @Override
                    public long get()
                    {
                      return 0L;
                    }
                  };
                }

                final int metricIndex = metricIndexInt;
                final BufferAggregator agg = index.getAggregator(metricIndex);

                return new LongColumnSelector()
                {
                  @Override
                  public long get()
                  {
                    return agg.getLong(
View Full Code Here

                  {
                    @Nullable
                    @Override
                    public Sequence<InputRow> apply(final Cursor cursor)
                    {
                      final LongColumnSelector timestampColumnSelector = cursor.makeLongColumnSelector(Column.TIME_COLUMN_NAME);

                      final Map<String, DimensionSelector> dimSelectors = Maps.newHashMap();
                      for (String dim : dims) {
                        final DimensionSelector dimSelector = cursor.makeDimensionSelector(dim);
                        // dimSelector is null if the dimension is not present
                        if (dimSelector != null) {
                          dimSelectors.put(dim, dimSelector);
                        }
                      }

                      final Map<String, ObjectColumnSelector> metSelectors = Maps.newHashMap();
                      for (String metric : metrics) {
                        final ObjectColumnSelector metricSelector = cursor.makeObjectColumnSelector(metric);
                        if (metricSelector != null) {
                          metSelectors.put(metric, metricSelector);
                        }
                      }

                      return Sequences.simple(
                          new Iterable<InputRow>()
                          {
                            @Override
                            public Iterator<InputRow> iterator()
                            {
                              return new Iterator<InputRow>()
                              {
                                @Override
                                public boolean hasNext()
                                {
                                  return !cursor.isDone();
                                }

                                @Override
                                public InputRow next()
                                {
                                  final Map<String, Object> theEvent = Maps.newLinkedHashMap();
                                  final long timestamp = timestampColumnSelector.get();
                                  theEvent.put(EventHolder.timestampKey, new DateTime(timestamp));

                                  for (Map.Entry<String, DimensionSelector> dimSelector : dimSelectors.entrySet()) {
                                    final String dim = dimSelector.getKey();
                                    final DimensionSelector selector = dimSelector.getValue();
View Full Code Here

                cursor.getTime(),
                query.getPagingSpec()
                     .getThreshold()
            );

            final LongColumnSelector timestampColumnSelector = cursor.makeLongColumnSelector(Column.TIME_COLUMN_NAME);

            final Map<String, DimensionSelector> dimSelectors = Maps.newHashMap();
            for (String dim : dims) {
              final DimensionSelector dimSelector = cursor.makeDimensionSelector(dim);
              dimSelectors.put(dim, dimSelector);
            }

            final Map<String, ObjectColumnSelector> metSelectors = Maps.newHashMap();
            for (String metric : metrics) {
              final ObjectColumnSelector metricSelector = cursor.makeObjectColumnSelector(metric);
              metSelectors.put(metric, metricSelector);
            }

            int startOffset;
            if (query.getPagingSpec().getPagingIdentifiers() == null) {
              startOffset = 0;
            } else {
              Integer offset = query.getPagingSpec().getPagingIdentifiers().get(segment.getIdentifier());
              startOffset = (offset == null) ? 0 : offset;
            }

            cursor.advanceTo(startOffset);

            int offset = 0;
            while (!cursor.isDone() && offset < query.getPagingSpec().getThreshold()) {
              final Map<String, Object> theEvent = Maps.newLinkedHashMap();
              theEvent.put(EventHolder.timestampKey, new DateTime(timestampColumnSelector.get()));

              for (Map.Entry<String, DimensionSelector> dimSelector : dimSelectors.entrySet()) {
                final String dim = dimSelector.getKey();
                final DimensionSelector selector = dimSelector.getValue();
View Full Code Here

TOP

Related Classes of io.druid.segment.LongColumnSelector

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.