Tabnine Logo
ValuesProcessor
Code IndexAdd Tabnine to your IDE (free)

How to use
ValuesProcessor
in
com.facebook.presto.spi.predicate

Best Java code snippets using com.facebook.presto.spi.predicate.ValuesProcessor (Showing top 17 results out of 315)

origin: prestodb/presto

@VisibleForTesting
public static Optional<Collection<Object>> extractDiscreteValues(ValueSet valueSet)
{
  return valueSet.getValuesProcessor().transform(
      ranges -> {
        ImmutableList.Builder<Object> discreteValues = ImmutableList.builder();
        for (Range range : ranges.getOrderedRanges()) {
          if (!range.isSingleValue()) {
            return Optional.empty();
          }
          discreteValues.add(range.getSingleValue());
        }
        return Optional.of(discreteValues.build());
      },
      discreteValues -> Optional.of(discreteValues.getValues()),
      allOrNone -> allOrNone.isAll() ? Optional.empty() : Optional.of(ImmutableList.of()));
}
origin: prestodb/presto

private FormattedDomain parseDomain(Domain domain)
{
  ImmutableSet.Builder<FormattedRange> formattedRanges = ImmutableSet.builder();
  Type type = domain.getType();
  domain.getValues().getValuesProcessor().consume(
      ranges -> formattedRanges.addAll(
          ranges.getOrderedRanges().stream()
              .map(range -> new FormattedRange(formatMarker(range.getLow()), formatMarker(range.getHigh())))
              .collect(toImmutableSet())),
      discreteValues -> formattedRanges.addAll(
          discreteValues.getValues().stream()
              .map(value -> getVarcharValue(type, value))
              .map(value -> new FormattedMarker(Optional.of(value), EXACTLY))
              .map(marker -> new FormattedRange(marker, marker))
              .collect(toImmutableSet())),
      allOrNone -> {
        throw new IllegalStateException("Unreachable AllOrNone consumer");
      });
  return new FormattedDomain(domain.isNullAllowed(), formattedRanges.build());
}
origin: prestodb/presto

private static TupleDomain<HiveColumnHandle> toCompactTupleDomain(TupleDomain<ColumnHandle> effectivePredicate, int threshold)
{
  ImmutableMap.Builder<HiveColumnHandle, Domain> builder = ImmutableMap.builder();
  effectivePredicate.getDomains().ifPresent(domains -> {
    for (Map.Entry<ColumnHandle, Domain> entry : domains.entrySet()) {
      HiveColumnHandle hiveColumnHandle = (HiveColumnHandle) entry.getKey();
      ValueSet values = entry.getValue().getValues();
      ValueSet compactValueSet = values.getValuesProcessor().<Optional<ValueSet>>transform(
          ranges -> ranges.getRangeCount() > threshold ? Optional.of(ValueSet.ofRanges(ranges.getSpan())) : Optional.empty(),
          discreteValues -> discreteValues.getValues().size() > threshold ? Optional.of(ValueSet.all(values.getType())) : Optional.empty(),
          allOrNone -> Optional.empty())
          .orElse(values);
      builder.put(hiveColumnHandle, Domain.create(compactValueSet, entry.getValue().isNullAllowed()));
    }
  });
  return TupleDomain.withColumnDomains(builder.build());
}
origin: prestodb/presto

domain.getValues().getValuesProcessor().consume(
    ranges -> {
      for (Range range : ranges.getOrderedRanges()) {
origin: prestodb/presto

/**
 * Reduces the number of discrete components in the Domain if there are too many.
 */
public Domain simplify()
{
  ValueSet simplifiedValueSet = values.getValuesProcessor().<Optional<ValueSet>>transform(
      ranges -> {
        if (ranges.getOrderedRanges().size() <= 32) {
          return Optional.empty();
        }
        return Optional.of(ValueSet.ofRanges(ranges.getSpan()));
      },
      discreteValues -> {
        if (discreteValues.getValues().size() <= 32) {
          return Optional.empty();
        }
        return Optional.of(ValueSet.all(values.getType()));
      },
      allOrNone -> Optional.empty())
      .orElse(values);
  return Domain.create(simplifiedValueSet, nullAllowed);
}
origin: uk.co.nichesolutions.presto/presto-main

domain.getValues().getValuesProcessor().consume(
    ranges -> {
      for (Range range : ranges.getOrderedRanges()) {
origin: prestodb/presto

Set<Object> values = domain.getValues().getValuesProcessor().transform(
    ranges -> {
      ImmutableSet.Builder<Object> columnValues = ImmutableSet.builder();
origin: prestodb/presto

private Expression toPredicate(Domain domain, SymbolReference reference)
{
  if (domain.getValues().isNone()) {
    return domain.isNullAllowed() ? new IsNullPredicate(reference) : FALSE_LITERAL;
  }
  if (domain.getValues().isAll()) {
    return domain.isNullAllowed() ? TRUE_LITERAL : new NotExpression(new IsNullPredicate(reference));
  }
  List<Expression> disjuncts = new ArrayList<>();
  disjuncts.addAll(domain.getValues().getValuesProcessor().transform(
      ranges -> extractDisjuncts(domain.getType(), ranges, reference),
      discreteValues -> extractDisjuncts(domain.getType(), discreteValues, reference),
      allOrNone -> {
        throw new IllegalStateException("Case should not be reachable");
      }));
  // Add nullability disjuncts
  if (domain.isNullAllowed()) {
    disjuncts.add(new IsNullPredicate(reference));
  }
  return combineDisjunctsWithDefault(disjuncts, TRUE_LITERAL);
}
origin: prestodb/presto

predicateString = domain.getValues().getValuesProcessor().transform(
    ranges -> {
      List<Object> singleValues = new ArrayList<>();
origin: com.facebook.presto/presto-orc

@VisibleForTesting
public static Optional<Collection<Object>> extractDiscreteValues(ValueSet valueSet)
{
  return valueSet.getValuesProcessor().transform(
      ranges -> {
        ImmutableList.Builder<Object> discreteValues = ImmutableList.builder();
        for (Range range : ranges.getOrderedRanges()) {
          if (!range.isSingleValue()) {
            return Optional.empty();
          }
          discreteValues.add(range.getSingleValue());
        }
        return Optional.of(discreteValues.build());
      },
      discreteValues -> Optional.of(discreteValues.getValues()),
      allOrNone -> allOrNone.isAll() ? Optional.empty() : Optional.of(ImmutableList.of()));
}
origin: uk.co.nichesolutions.presto/presto-hive

private static TupleDomain<HiveColumnHandle> toCompactTupleDomain(TupleDomain<ColumnHandle> effectivePredicate, int threshold)
{
  checkArgument(effectivePredicate.getDomains().isPresent());
  ImmutableMap.Builder<HiveColumnHandle, Domain> builder = ImmutableMap.builder();
  for (Map.Entry<ColumnHandle, Domain> entry : effectivePredicate.getDomains().get().entrySet()) {
    HiveColumnHandle hiveColumnHandle = checkType(entry.getKey(), HiveColumnHandle.class, "ConnectorColumnHandle");
    ValueSet values = entry.getValue().getValues();
    ValueSet compactValueSet = values.getValuesProcessor().<Optional<ValueSet>>transform(
        ranges -> ranges.getRangeCount() > threshold ? Optional.of(ValueSet.ofRanges(ranges.getSpan())) : Optional.empty(),
        discreteValues -> discreteValues.getValues().size() > threshold ? Optional.of(ValueSet.all(values.getType())) : Optional.empty(),
        allOrNone -> Optional.empty())
        .orElse(values);
    builder.put(hiveColumnHandle, Domain.create(compactValueSet, entry.getValue().isNullAllowed()));
  }
  return TupleDomain.withColumnDomains(builder.build());
}
origin: com.facebook.presto/presto-spi

/**
 * Reduces the number of discrete components in the Domain if there are too many.
 */
public Domain simplify()
{
  ValueSet simplifiedValueSet = values.getValuesProcessor().<Optional<ValueSet>>transform(
      ranges -> {
        if (ranges.getOrderedRanges().size() <= 32) {
          return Optional.empty();
        }
        return Optional.of(ValueSet.ofRanges(ranges.getSpan()));
      },
      discreteValues -> {
        if (discreteValues.getValues().size() <= 32) {
          return Optional.empty();
        }
        return Optional.of(ValueSet.all(values.getType()));
      },
      allOrNone -> Optional.empty())
      .orElse(values);
  return Domain.create(simplifiedValueSet, nullAllowed);
}
origin: uk.co.nichesolutions.presto/presto-main

  /**
   * Reduces the number of discrete components in the Domain if there are too many.
   */
  public static Domain simplifyDomain(Domain domain)
  {
    ValueSet values = domain.getValues();
    ValueSet simplifiedValueSet = values.getValuesProcessor().<Optional<ValueSet>>transform(
        ranges -> {
          if (ranges.getOrderedRanges().size() <= 32) {
            return Optional.empty();
          }
          return Optional.of(ValueSet.ofRanges(ranges.getSpan()));
        },
        discreteValues -> {
          if (discreteValues.getValues().size() <= 32) {
            return Optional.empty();
          }
          return Optional.of(ValueSet.all(domain.getType()));
        },
        allOrNone -> Optional.empty())
        .orElse(values);
    return Domain.create(simplifiedValueSet, domain.isNullAllowed());
  }
}
origin: com.facebook.presto/presto-cassandra

Set<Object> values = domain.getValues().getValuesProcessor().transform(
    ranges -> {
      ImmutableSet.Builder<Object> columnValues = ImmutableSet.builder();
origin: com.facebook.presto/presto-raptor

return domain.getValues().getValuesProcessor().transform(
    ranges -> {
origin: uk.co.nichesolutions.presto/presto-main

private static Expression toPredicate(Domain domain, QualifiedNameReference reference)
{
  if (domain.getValues().isNone()) {
    return domain.isNullAllowed() ? new IsNullPredicate(reference) : FALSE_LITERAL;
  }
  if (domain.getValues().isAll()) {
    return domain.isNullAllowed() ? TRUE_LITERAL : new NotExpression(new IsNullPredicate(reference));
  }
  List<Expression> disjuncts = new ArrayList<>();
  disjuncts.addAll(domain.getValues().getValuesProcessor().transform(
      ranges -> extractDisjuncts(domain.getType(), ranges, reference),
      discreteValues -> extractDisjuncts(domain.getType(), discreteValues, reference),
      allOrNone -> {
        throw new IllegalStateException("Case should not be reachable");
      }));
  // Add nullability disjuncts
  if (domain.isNullAllowed()) {
    disjuncts.add(new IsNullPredicate(reference));
  }
  return combineDisjunctsWithDefault(disjuncts, TRUE_LITERAL);
}
origin: com.facebook.presto/presto-cassandra

predicateString = domain.getValues().getValuesProcessor().transform(
    ranges -> {
      List<Object> singleValues = new ArrayList<>();
com.facebook.presto.spi.predicateValuesProcessor

Most used methods

  • transform
  • consume

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • onRequestPermissionsResult (Fragment)
  • startActivity (Activity)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • ImageIO (javax.imageio)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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