Created
October 26, 2018 23:17
-
-
Save nezihyigitbasi/2015d78e7c24d51e896428f139926b64 to your computer and use it in GitHub Desktop.
gen-projection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Source code recreated from a .class file by IntelliJ IDEA | |
// (powered by Fernflower decompiler) | |
// | |
package com.facebook.presto.$gen; | |
import com.facebook.presto.operator.DriverYieldSignal; | |
import com.facebook.presto.operator.Work; | |
import com.facebook.presto.operator.project.SelectedPositions; | |
import com.facebook.presto.spi.ConnectorSession; | |
import com.facebook.presto.spi.Page; | |
import com.facebook.presto.spi.block.Block; | |
import com.facebook.presto.spi.block.BlockBuilder; | |
import com.facebook.presto.sql.gen.ExpressionProfiler; | |
public final class PageProjectionWork_20181026_231333_2 implements Work { | |
private ExpressionProfiler expressionProfiler; | |
private BlockBuilder blockBuilder; | |
private ConnectorSession session; | |
private DriverYieldSignal yieldSignal; | |
private Page page; | |
private SelectedPositions selectedPositions; | |
private int nextIndexOrPosition; | |
private Block result; | |
public boolean process() { | |
if (this.selectedPositions.isList()) { | |
if (!this.processPositions()) { | |
return false; | |
} | |
} else if (!this.processRange()) { | |
return false; | |
} | |
this.result = this.blockBuilder.build(); | |
return true; | |
} | |
public boolean processPositions() { | |
int from = this.nextIndexOrPosition; | |
int to = this.selectedPositions.getOffset() + this.selectedPositions.size(); | |
int[] positions = this.selectedPositions.getPositions(); | |
int index; | |
if (this.expressionProfiler.isDoneProfiling()) { | |
if (this.expressionProfiler.isExpressionExpensive()) { | |
for(index = from; index < to; ++index) { | |
this.evaluate(this.session, this.page, positions[index]); | |
if (this.yieldSignal.isSet()) { | |
this.nextIndexOrPosition = index + 1; | |
return false; | |
} | |
} | |
} else { | |
for(index = from; index < to; ++index) { | |
this.evaluate(this.session, this.page, positions[index]); | |
} | |
} | |
} else { | |
for(index = from; index < to; ++index) { | |
this.evaluate(this.session, this.page, positions[index]); | |
this.expressionProfiler.profile(); | |
if (this.yieldSignal.isSet()) { | |
this.nextIndexOrPosition = index + 1; | |
return false; | |
} | |
} | |
} | |
return true; | |
} | |
public boolean processRange() { | |
int from = this.nextIndexOrPosition; | |
int to = this.selectedPositions.getOffset() + this.selectedPositions.size(); | |
int index; | |
if (this.expressionProfiler.isDoneProfiling()) { | |
if (this.expressionProfiler.isExpressionExpensive()) { | |
for(index = from; index < to; ++index) { | |
this.evaluate(this.session, this.page, index); | |
if (this.yieldSignal.isSet()) { | |
this.nextIndexOrPosition = index + 1; | |
return false; | |
} | |
} | |
} else { | |
for(index = from; index < to; ++index) { | |
this.evaluate(this.session, this.page, index); | |
} | |
} | |
} else { | |
for(index = from; index < to; ++index) { | |
this.evaluate(this.session, this.page, index); | |
this.expressionProfiler.profile(); | |
if (this.yieldSignal.isSet()) { | |
this.nextIndexOrPosition = index + 1; | |
return false; | |
} | |
} | |
} | |
return true; | |
} | |
public Object getResult() { | |
return this.result; | |
} | |
public void evaluate(ConnectorSession session, Page page, int position) { | |
Block block_0 = page.getBlock(0); | |
boolean wasNull = false; | |
BlockBuilder var10000 = this.blockBuilder; | |
long var10001; | |
if (block_0.isNull(position)) { | |
wasNull = true; | |
var10001 = 0L; | |
} else { | |
var10001 = bigint<invokedynamic>().getLong(block_0, position); | |
} | |
var10001 = wasNull ? 0L : (wasNull ? 0L : var10001.$operator$ADD<invokedynamic>(var10001, 10L)); | |
if (wasNull) { | |
var10000.appendNull(); | |
} else { | |
long temp_0 = var10001; | |
BlockBuilder temp_2 = var10000; | |
constant_2<invokedynamic>().writeLong(temp_2, temp_0); | |
} | |
} | |
public PageProjectionWork_20181026_231333_2(BlockBuilder blockBuilder, ConnectorSession session, DriverYieldSignal yieldSignal, Page page, SelectedPositions selectedPositions, ExpressionProfiler expressionProfiler) { | |
this.blockBuilder = blockBuilder; | |
this.session = session; | |
this.yieldSignal = yieldSignal; | |
this.page = page; | |
this.selectedPositions = selectedPositions; | |
this.nextIndexOrPosition = selectedPositions.getOffset(); | |
this.result = null; | |
this.expressionProfiler = expressionProfiler; | |
this.expressionProfiler.reset(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment