Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
fix skip
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Jun 25, 2021
1 parent 46d7465 commit de280be
Showing 1 changed file with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,12 @@ class ColumnarConditionProjector(
var elapseTime_make: Long = 0
val start_make: Long = System.nanoTime()
var selectionBuffer: ArrowBuf = _
val skip_project: Boolean =
if (projectFieldList.size == 0 && (projPrepareList == null || projPrepareList.isEmpty)) {
true
} else false

val skip_filter: Boolean = if (conditionFieldList.size == 0 && condPrepareList == null) {
true
} else false
skip = skip_project && skip_filter
if (projectFieldList.size == 0 && (projPrepareList == null || projPrepareList.isEmpty) &&
conditionFieldList.size == 0) {
skip = true
} else {
skip = false
}

val conditionOrdinalList: List[Int] = conditionFieldList.asScala.toList.map(field => {
field.getName.replace("c_", "").toInt
Expand Down Expand Up @@ -116,7 +113,7 @@ class ColumnarConditionProjector(
s"\nresult schema is ${resultArrowSchema}")
}

val conditioner: Filter = if (!skip_filter) {
val conditioner: Filter = if (!skip && condPrepareList != null) {
createFilter(conditionArrowSchema, condPrepareList)
} else {
null
Expand All @@ -126,7 +123,7 @@ class ColumnarConditionProjector(
} else {
false
}
val projector: ProjectorWrapper = if (!skip_project) {
val projector: ProjectorWrapper = if (!skip) {
createProjector(projectionArrowSchema, resultArrowSchema, projPrepareList, withCond)
} else {
null
Expand Down Expand Up @@ -209,7 +206,6 @@ class ColumnarConditionProjector(
var input: ArrowRecordBatch = null
var selectionVector: SelectionVectorInt16 = null
while (numRows == 0) {

if (cbIterator.hasNext) {
columnarBatch = cbIterator.next()
numInputBatches += 1
Expand Down Expand Up @@ -258,7 +254,9 @@ class ColumnarConditionProjector(
conditioner.evaluate(input, selectionVector)
ConverterUtils.releaseArrowRecordBatch(input)
numRows = selectionVector.getRecordCount
if (skip_project) {
// If project should be skipped
if (projectFieldList.size == 0 &&
(projPrepareList == null || projPrepareList.isEmpty)) {
if (numRows == columnarBatch.numRows()) {
// This means filter can also be skipped because row number is not changed.
logInfo(
Expand Down Expand Up @@ -313,7 +311,7 @@ class ColumnarConditionProjector(
val outputBatch = if (conditioner != null) {
projector.evaluate(input, numRows, selectionVector)
} else {
projector.evaluate(input);
projector.evaluate(input)
}

ConverterUtils.releaseArrowRecordBatch(input)
Expand Down

0 comments on commit de280be

Please sign in to comment.