Package eu.stratosphere.api.common.operators

Examples of eu.stratosphere.api.common.operators.CompilerHints


       
        // initialize with 2 bytes length for the header (its actually 3, but one is skipped on the first field
        this.hints.addWidthRecordFormat(2);
      }
      else {
        this.hints = new RecordFormatCompilerHints(new CompilerHints());
      }
    }
View Full Code Here


      writer.print("\n\t\t]");
    }

    // output the node compiler hints
    if (n.getPactContract().getCompilerHints() != null) {
      CompilerHints hints = n.getPactContract().getCompilerHints();
      CompilerHints defaults = new CompilerHints();

      String size = hints.getOutputSize() == defaults.getOutputSize() ? "(none)" : String.valueOf(hints.getOutputSize());
      String card = hints.getOutputCardinality() == defaults.getOutputCardinality() ? "(none)" : String.valueOf(hints.getOutputCardinality());
      String width = hints.getAvgOutputRecordSize() == defaults.getAvgOutputRecordSize() ? "(none)" : String.valueOf(hints.getAvgOutputRecordSize());
      String filter = hints.getFilterFactor() == defaults.getFilterFactor() ? "(none)" : String.valueOf(hints.getFilterFactor());
     
      writer.print(",\n\t\t\"compiler_hints\": [\n");

      addProperty(writer, "Output Size (bytes)", size, true);
      addProperty(writer, "Output Cardinality", card, false);
View Full Code Here

    // overwrite default estimates with hints, if given
    if (getPactContract() == null || getPactContract().getCompilerHints() == null) {
      return ;
    }
   
    CompilerHints hints = getPactContract().getCompilerHints();
    if (hints.getOutputSize() >= 0) {
      this.estimatedOutputSize = hints.getOutputSize();
    }
   
    if (hints.getOutputCardinality() >= 0) {
      this.estimatedNumRecords = hints.getOutputCardinality();
    }
   
    if (hints.getFilterFactor() >= 0.0f) {
      if (this.estimatedNumRecords >= 0) {
        this.estimatedNumRecords = (long) (this.estimatedNumRecords * hints.getFilterFactor());
       
        if (this.estimatedOutputSize >= 0) {
          this.estimatedOutputSize = (long) (this.estimatedOutputSize * hints.getFilterFactor());
        }
      }
      else if (this instanceof SingleInputNode) {
        OptimizerNode pred = ((SingleInputNode) this).getPredecessorNode();
        if (pred != null && pred.getEstimatedNumRecords() >= 0) {
          this.estimatedNumRecords = (long) (pred.getEstimatedNumRecords() * hints.getFilterFactor());
        }
      }
    }
   
    // use the width to infer the cardinality (given size) and vice versa
    if (hints.getAvgOutputRecordSize() >= 1) {
      // the estimated number of rows based on size
      if (this.estimatedNumRecords == -1 && this.estimatedOutputSize >= 0) {
        this.estimatedNumRecords = (long) (this.estimatedOutputSize / hints.getAvgOutputRecordSize());
      }
      else if (this.estimatedOutputSize == -1 && this.estimatedNumRecords >= 0) {
        this.estimatedOutputSize = (long) (this.estimatedNumRecords * hints.getAvgOutputRecordSize());
      }
    }
  }
 
View Full Code Here

TOP

Related Classes of eu.stratosphere.api.common.operators.CompilerHints

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.