コード例 #1
0
ファイル: TopNNode.java プロジェクト: Ravion/Presto-1
  @JsonCreator
  public TopNNode(
      @JsonProperty("id") PlanNodeId id,
      @JsonProperty("source") PlanNode source,
      @JsonProperty("count") long count,
      @JsonProperty("orderBy") List<Symbol> orderBy,
      @JsonProperty("orderings") Map<Symbol, SortOrder> orderings,
      @JsonProperty("partial") boolean partial,
      @JsonProperty("sampleWeight") Optional<Symbol> sampleWeight) {
    super(id);

    Preconditions.checkNotNull(source, "source is null");
    Preconditions.checkArgument(count > 0, "count must be positive");
    Preconditions.checkNotNull(orderBy, "orderBy is null");
    Preconditions.checkArgument(!orderBy.isEmpty(), "orderBy is empty");
    Preconditions.checkArgument(
        orderings.size() == orderBy.size(), "orderBy and orderings sizes don't match");
    Preconditions.checkNotNull(sampleWeight, "sampleWeight is null");
    if (sampleWeight.isPresent()) {
      Preconditions.checkArgument(
          source.getOutputSymbols().contains(sampleWeight.get()),
          "source does not output sample weight");
    }

    this.source = source;
    this.count = count;
    this.orderBy = ImmutableList.copyOf(orderBy);
    this.orderings = ImmutableMap.copyOf(orderings);
    this.partial = partial;
    this.sampleWeight = sampleWeight;
  }
コード例 #2
0
ファイル: UnnestNode.java プロジェクト: nezihyigitbasi/presto
 @JsonCreator
 public UnnestNode(
     @JsonProperty("id") PlanNodeId id,
     @JsonProperty("source") PlanNode source,
     @JsonProperty("replicateSymbols") List<Symbol> replicateSymbols,
     @JsonProperty("unnestSymbols") Map<Symbol, List<Symbol>> unnestSymbols,
     @JsonProperty("ordinalitySymbol") Optional<Symbol> ordinalitySymbol) {
   super(id);
   this.source = requireNonNull(source, "source is null");
   this.replicateSymbols =
       ImmutableList.copyOf(requireNonNull(replicateSymbols, "replicateSymbols is null"));
   checkArgument(
       source.getOutputSymbols().containsAll(replicateSymbols),
       "Source does not contain all replicateSymbols");
   requireNonNull(unnestSymbols, "unnestSymbols is null");
   checkArgument(!unnestSymbols.isEmpty(), "unnestSymbols is empty");
   ImmutableMap.Builder<Symbol, List<Symbol>> builder = ImmutableMap.builder();
   for (Map.Entry<Symbol, List<Symbol>> entry : unnestSymbols.entrySet()) {
     builder.put(entry.getKey(), ImmutableList.copyOf(entry.getValue()));
   }
   this.unnestSymbols = builder.build();
   this.ordinalitySymbol = requireNonNull(ordinalitySymbol, "ordinalitySymbol is null");
 }
コード例 #3
0
ファイル: TopNNode.java プロジェクト: Ravion/Presto-1
 @Override
 public List<Symbol> getOutputSymbols() {
   return source.getOutputSymbols();
 }