Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
Davies Liu committed Jan 14, 2016
1 parent 43139a8 commit 73fe074
Showing 1 changed file with 2 additions and 81 deletions.
Expand Up @@ -17,9 +17,9 @@

package org.apache.spark.sql.execution

import org.apache.spark.{SparkConf, SparkContext, SparkFunSuite}
import org.apache.spark.sql.SQLContext
import org.apache.spark.util.Benchmark
import org.apache.spark.{SparkFunSuite, SparkConf, SparkContext}

/**
* Benchmark to measure whole stage codegen performance.
Expand All @@ -44,85 +44,6 @@ class BenchmarkWholeStageCodegen extends SparkFunSuite {
sqlContext.range(values).filter("(id & 1) = 1").count()
}

/**
* The code generated for this query (some comments and empty lines are removed):
*
/* 001 */
/* 002 */ public Object generate(org.apache.spark.sql.catalyst.expressions.Expression[] exprs) {
/* 003 */ return new GeneratedIterator(exprs);
/* 004 */ }
/* 005 */
/* 006 */ class GeneratedIterator extends org.apache.spark.sql.execution.BufferedRowIterator {
/* 007 */
/* 008 */ private org.apache.spark.sql.catalyst.expressions.Expression[] expressions;
/* 009 */ private boolean initRange0;
/* 010 */ private long partitionEnd1;
/* 011 */ private long number2;
/* 012 */ private boolean overflow3;
/* 013 */ private UnsafeRow unsafeRow = new UnsafeRow(0);
/* 014 */
/* 015 */ public GeneratedIterator(org.apache.spark.sql.catalyst.expressions.Expression[] exprs) {
/* 016 */ expressions = exprs;
/* 017 */ initRange0 = false;
/* 018 */ partitionEnd1 = 0L;
/* 019 */ number2 = 0L;
/* 020 */ overflow3 = false;
/* 021 */ }
/* 022 */
/* 023 */ protected void processNext() {
/* 024 */
/* 025 */ if (!initRange0) {
/* 026 */ if (input.hasNext()) {
/* 027 */ java.math.BigInteger index = java.math.BigInteger.valueOf(((InternalRow) input.next()).getInt(0));
/* 028 */ java.math.BigInteger numSlice = java.math.BigInteger.valueOf(1L);
/* 029 */ java.math.BigInteger numElement = java.math.BigInteger.valueOf(209715200L);
/* 030 */ java.math.BigInteger step = java.math.BigInteger.valueOf(1L);
/* 031 */ java.math.BigInteger start = java.math.BigInteger.valueOf(0L);
/* 032 */
/* 033 */ java.math.BigInteger st = index.multiply(numElement).divide(numSlice).multiply(step).add(start);
/* 034 */ if (st.compareTo(java.math.BigInteger.valueOf(Long.MAX_VALUE)) > 0) {
/* 035 */ number2 = Long.MAX_VALUE;
/* 036 */ } else if (st.compareTo(java.math.BigInteger.valueOf(Long.MIN_VALUE)) < 0) {
/* 037 */ number2 = Long.MIN_VALUE;
/* 038 */ } else {
/* 039 */ number2 = st.longValue();
/* 040 */ }
/* 041 */
/* 042 */ java.math.BigInteger end = index.add(java.math.BigInteger.ONE).multiply(numElement).divide(numSlice)
/* 043 */ .multiply(step).add(start);
/* 044 */ if (end.compareTo(java.math.BigInteger.valueOf(Long.MAX_VALUE)) > 0) {
/* 045 */ partitionEnd1 = Long.MAX_VALUE;
/* 046 */ } else if (end.compareTo(java.math.BigInteger.valueOf(Long.MIN_VALUE)) < 0) {
/* 047 */ partitionEnd1 = Long.MIN_VALUE;
/* 048 */ } else {
/* 049 */ partitionEnd1 = end.longValue();
/* 050 */ }
/* 051 */ } else {
/* 052 */ return;
/* 053 */ }
/* 054 */ initRange0 = true;
/* 055 */ }
/* 056 */
/* 057 */ while (!overflow3 && number2 < partitionEnd1) {
/* 058 */ long value4 = number2;
/* 059 */ number2 += 1L;
/* 060 */ if (number2 < value4 ^ 1L < 0) {
/* 061 */ overflow3 = true;
/* 062 */ }
/* 063 */
/* 070 */ long primitive8 = -1L;
/* 071 */ primitive8 = value4 & 1L;
/* 074 */ boolean primitive6 = false;
/* 075 */ primitive6 = primitive8 == 1L;
/* 076 */ if (!false && primitive6) {
/* 081 */ currentRow = unsafeRow;
/* 082 */ return;
/* 085 */ }
/* 087 */ }
/* 089 */ }
/* 090 */ }
/* 091 */
*/
/*
Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz
Single Int Column Scan: Avg Time(ms) Avg Rate(M/s) Relative Rate
Expand All @@ -133,7 +54,7 @@ class BenchmarkWholeStageCodegen extends SparkFunSuite {
benchmark.run()
}

test("benchmark") {
ignore("benchmark") {
testWholeStage(1024 * 1024 * 200)
}
}

0 comments on commit 73fe074

Please sign in to comment.