Tabnine Logo
FunctionalIterable.transform
Code IndexAdd Tabnine to your IDE (free)

How to use
transform
method
in
org.apache.druid.java.util.common.guava.FunctionalIterable

Best Java code snippets using org.apache.druid.java.util.common.guava.FunctionalIterable.transform (Showing top 11 results out of 315)

origin: apache/incubator-druid

/**
 * Convert a list of DimFilters to a list of Filters.
 *
 * @param dimFilters list of DimFilters, should all be non-null
 *
 * @return list of Filters
 */
public static List<Filter> toFilters(List<DimFilter> dimFilters)
{
 return ImmutableList.copyOf(
   FunctionalIterable
     .create(dimFilters)
     .transform(
       new Function<DimFilter, Filter>()
       {
        @Override
        public Filter apply(DimFilter input)
        {
         return input.toFilter();
        }
       }
     )
 );
}
origin: apache/incubator-druid

FunctionalIterable.create(chunkIntervals).transform(
  new Function<Interval, Sequence<T>>()
origin: apache/incubator-druid

private Iterable<BytesMessageWithOffset> filterAndDecode(Iterable<MessageAndOffset> kafkaMessages, final long offset)
{
 return FunctionalIterable
   .create(kafkaMessages)
   .filter(
     new Predicate<MessageAndOffset>()
     {
      @Override
      public boolean apply(MessageAndOffset msgAndOffset)
      {
       return msgAndOffset.offset() >= offset;
      }
     }
   )
   .transform(
     new Function<MessageAndOffset, BytesMessageWithOffset>()
     {
      @Override
      public BytesMessageWithOffset apply(MessageAndOffset msgAndOffset)
      {
       ByteBuffer bb = msgAndOffset.message().payload();
       byte[] payload = new byte[bb.remaining()];
       bb.get(payload);
       // add nextOffset here, thus next fetch will use nextOffset instead of current offset
       return new BytesMessageWithOffset(payload, msgAndOffset.nextOffset(), partitionId);
      }
     }
   );
}
origin: org.apache.druid/druid-processing

FunctionalIterable.create(chunkIntervals).transform(
  new Function<Interval, Sequence<T>>()
origin: apache/incubator-druid

 @Override
 public Iterable<Bucket> apply(Interval input)
 {
  final DateTime bucketTime = input.getStart();
  final List<HadoopyShardSpec> specs = schema.getTuningConfig().getShardSpecs().get(bucketTime.getMillis());
  if (specs == null) {
   return ImmutableList.of();
  }
  return FunctionalIterable
    .create(specs)
    .transform(
      new Function<HadoopyShardSpec, Bucket>()
      {
       int i = 0;
       @Override
       public Bucket apply(HadoopyShardSpec input)
       {
        return new Bucket(input.getShardNum(), bucketTime, i++);
       }
      }
    );
 }
}
origin: apache/incubator-druid

@Test
public void testTransform()
{
 Assert.assertEquals(
   Lists.newArrayList(
     FunctionalIterable.create(Arrays.asList("1", "2", "3"))
              .transform(
                new Function<String, Integer>()
                {
                 @Override
                 public Integer apply(String input)
                 {
                  return Integer.parseInt(input);
                 }
                }
              )
   ),
   Arrays.asList(1, 2, 3)
 );
}
origin: apache/incubator-druid

FunctionalIterable
  .create(specs)
  .transform(
    new Function<SegmentDescriptor, QueryRunner<T>>()
origin: apache/incubator-druid

public static <T, QueryType extends Query<T>> List<T> runQuery(
  final QueryType query,
  final QueryRunnerFactory<T, QueryType> factory,
  final List<QueryableIndex> indexes
)
{
 final Sequence<T> results = new FinalizeResultsQueryRunner<>(
   factory.getToolchest().mergeResults(
     factory.mergeRunners(
       Execs.directExecutor(),
       FunctionalIterable
         .create(indexes)
         .transform(
           index -> factory.createRunner(new QueryableIndexSegment(index, SegmentId.dummy("xxx")))
         )
     )
   ),
   (QueryToolChest<T, Query<T>>) factory.getToolchest()
 ).run(QueryPlus.wrap(query), new HashMap<>());
 return results.toList();
}
origin: org.apache.druid/druid-processing

/**
 * Convert a list of DimFilters to a list of Filters.
 *
 * @param dimFilters list of DimFilters, should all be non-null
 *
 * @return list of Filters
 */
public static List<Filter> toFilters(List<DimFilter> dimFilters)
{
 return ImmutableList.copyOf(
   FunctionalIterable
     .create(dimFilters)
     .transform(
       new Function<DimFilter, Filter>()
       {
        @Override
        public Filter apply(DimFilter input)
        {
         return input.toFilter();
        }
       }
     )
 );
}
origin: org.apache.druid/druid-indexing-hadoop

 @Override
 public Iterable<Bucket> apply(Interval input)
 {
  final DateTime bucketTime = input.getStart();
  final List<HadoopyShardSpec> specs = schema.getTuningConfig().getShardSpecs().get(bucketTime.getMillis());
  if (specs == null) {
   return ImmutableList.of();
  }
  return FunctionalIterable
    .create(specs)
    .transform(
      new Function<HadoopyShardSpec, Bucket>()
      {
       int i = 0;
       @Override
       public Bucket apply(HadoopyShardSpec input)
       {
        return new Bucket(input.getShardNum(), bucketTime, i++);
       }
      }
    );
 }
}
origin: org.apache.druid/druid-server

FunctionalIterable
  .create(specs)
  .transform(
    new Function<SegmentDescriptor, QueryRunner<T>>()
org.apache.druid.java.util.common.guavaFunctionalIterabletransform

Popular methods of FunctionalIterable

  • create
  • transformCat
  • <init>
  • filter
  • drop
  • keep
  • limit
  • trinaryTransform

Popular in Java

  • Parsing JSON documents to java classes using gson
  • findViewById (Activity)
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Permission (java.security)
    Legacy security code; do not use.
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now