You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/11/05 13:11:30 UTC
[GitHub] [pinot] richardstartin opened a new pull request #7709: inline binary comparison ops to prevent function call overhead
richardstartin opened a new pull request #7709:
URL: https://github.com/apache/pinot/pull/7709
## Description
In a CPU bound load test where there are at least 3 binary operations in play, nearly 10% of the time on the server is spent evaluating `BinaryOperatorTransformFunction.getBinaryFuncResult`, because the call is virtual.
<img width="1148" alt="Screenshot 2021-11-05 at 13 08 48" src="https://user-images.githubusercontent.com/16439049/140515238-e487b5c5-45d2-41bc-b01c-66a1ad46c2c7.png">
This moves the very simple overrides into the base class, and leaves the individual classes in place for the sake of the registration mechanism alone.
## Upgrade Notes
Does this PR prevent a zero down-time upgrade? (Assume upgrade order: Controller, Broker, Server, Minion)
* [ ] Yes (Please label as **<code>backward-incompat</code>**, and complete the section below on Release Notes)
Does this PR fix a zero-downtime upgrade introduced earlier?
* [ ] Yes (Please label this as **<code>backward-incompat</code>**, and complete the section below on Release Notes)
Does this PR otherwise need attention when creating release notes? Things to consider:
- New configuration options
- Deprecation of configurations
- Signature changes to public methods/interfaces
- New plugins added or old plugins removed
* [ ] Yes (Please label this PR as **<code>release-notes</code>** and complete the section on Release Notes)
## Release Notes
<!-- If you have tagged this as either backward-incompat or release-notes,
you MUST add text here that you would like to see appear in release notes of the
next release. -->
<!-- If you have a series of commits adding or enabling a feature, then
add this section only in final commit that marks the feature completed.
Refer to earlier release notes to see examples of text.
-->
## Documentation
<!-- If you have introduced a new feature or configuration, please add it to the documentation as well.
See https://docs.pinot.apache.org/developers/developers-and-contributors/update-document
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] Jackie-Jiang commented on a change in pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on a change in pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#discussion_r744013132
##########
File path: pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/BinaryOperatorTransformFunction.java
##########
@@ -71,218 +113,331 @@ public TransformResultMetadata getResultMetadata() {
}
private void fillResultArray(ProjectionBlock projectionBlock) {
- if (_results == null) {
- _results = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL];
- }
int length = projectionBlock.getNumDocs();
+ if (_results == null || _results.length < length) {
+ _results = new int[length];
+ }
switch (_leftStoredType) {
case INT:
- int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftIntValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftIntValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultInt(projectionBlock, length);
break;
case LONG:
- long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightFloatValues[i])));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightDoubleValues[i])));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftLongValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultLong(projectionBlock, length);
break;
case FLOAT:
- float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Float.compare(leftFloatValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultFloat(projectionBlock, length);
break;
case DOUBLE:
- double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultDouble(projectionBlock, length);
break;
case STRING:
- String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
- }
+ fillResultString(projectionBlock, length);
break;
case BYTES:
- byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
- byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
- }
+ fillResultBytes(projectionBlock, length);
break;
// NOTE: Multi-value columns are not comparable, so we should not reach here
default:
- throw new IllegalStateException();
+ throw illegalState();
+ }
+ }
+
+ private void fillResultInt(ProjectionBlock projectionBlock, int length) {
+ int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftIntValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultLong(ProjectionBlock projectionBlock, int length) {
+ long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftLongValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultFloat(ProjectionBlock projectionBlock, int length) {
+ float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultDouble(ProjectionBlock projectionBlock, int length) {
+ double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private IllegalStateException illegalState() {
+ throw new IllegalStateException(String.format(
+ "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
+ + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
+ _rightTransformFunction.getName(), _rightStoredType));
+ }
+
+ private void fillResultString(ProjectionBlock projectionBlock, int length) {
+ String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
+ }
+ }
+
+ private void fillResultBytes(ProjectionBlock projectionBlock, int length) {
+ byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
+ byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, int[] leftIntValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftValues[i], rightValues[i]));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
+ }
+ }
+
+ private void fillStringResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ try {
+ _results[i] =
+ getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
+ } catch (NumberFormatException e) {
+ _results[i] = 0;
+ }
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, long[] leftIntValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftIntValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftValues[i], rightValues[i]));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
+ }
+ }
+
+ private void fillStringResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ try {
+ _results[i] =
+ getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
+ } catch (NumberFormatException e) {
+ _results[i] = 0;
+ }
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, float[] leftValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, float[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(BigDecimal.valueOf(rightValues[i])));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, float[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Float.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, float[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
+ }
+ }
+
+ private void fillStringResultArray(ProjectionBlock projectionBlock, float[] leftValues, int length) {
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ try {
+ _results[i] =
+ getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
+ } catch (NumberFormatException e) {
+ _results[i] = 0;
+ }
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, double[] leftValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, double[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(BigDecimal.valueOf(rightValues[i])));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, double[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, double[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
+ }
+ }
+
+ private void fillStringResultArray(ProjectionBlock projectionBlock, double[] leftValues, int length) {
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ try {
+ _results[i] =
+ getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
+ } catch (NumberFormatException e) {
+ _results[i] = 0;
+ }
}
}
private int getIntResult(int comparisonResult) {
return getBinaryFuncResult(comparisonResult) ? 1 : 0;
}
- protected abstract boolean getBinaryFuncResult(int comparisonResult);
+ private boolean getBinaryFuncResult(int comparisonResult) {
+ switch (_op) {
+ case EQUALS:
+ return comparisonResult == 0;
+ case GREATER_THAN_OR_EQUAL:
+ return comparisonResult >= 0;
+ case GREATER_THAN:
+ return comparisonResult > 0;
+ case LESS_THAN:
+ return comparisonResult < 0;
+ case LESS_THAN_OR_EQUAL:
+ return comparisonResult <= 0;
+ case NOT_EQUAL:
+ return comparisonResult != 0;
+ default:
+ assert false;
Review comment:
Throw exception?
##########
File path: pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/BinaryOperatorTransformFunction.java
##########
@@ -71,218 +113,331 @@ public TransformResultMetadata getResultMetadata() {
}
private void fillResultArray(ProjectionBlock projectionBlock) {
- if (_results == null) {
- _results = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL];
- }
int length = projectionBlock.getNumDocs();
+ if (_results == null || _results.length < length) {
+ _results = new int[length];
+ }
switch (_leftStoredType) {
case INT:
- int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftIntValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftIntValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultInt(projectionBlock, length);
break;
case LONG:
- long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightFloatValues[i])));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightDoubleValues[i])));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftLongValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultLong(projectionBlock, length);
break;
case FLOAT:
- float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Float.compare(leftFloatValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultFloat(projectionBlock, length);
break;
case DOUBLE:
- double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultDouble(projectionBlock, length);
break;
case STRING:
- String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
- }
+ fillResultString(projectionBlock, length);
break;
case BYTES:
- byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
- byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
- }
+ fillResultBytes(projectionBlock, length);
break;
// NOTE: Multi-value columns are not comparable, so we should not reach here
default:
- throw new IllegalStateException();
+ throw illegalState();
+ }
+ }
+
+ private void fillResultInt(ProjectionBlock projectionBlock, int length) {
+ int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftIntValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultLong(ProjectionBlock projectionBlock, int length) {
+ long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftLongValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultFloat(ProjectionBlock projectionBlock, int length) {
+ float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultDouble(ProjectionBlock projectionBlock, int length) {
+ double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private IllegalStateException illegalState() {
+ throw new IllegalStateException(String.format(
+ "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
+ + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
+ _rightTransformFunction.getName(), _rightStoredType));
+ }
+
+ private void fillResultString(ProjectionBlock projectionBlock, int length) {
+ String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
+ }
+ }
+
+ private void fillResultBytes(ProjectionBlock projectionBlock, int length) {
+ byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
+ byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
Review comment:
Avoid creating the object
```suggestion
_results[i] = getIntResult(ByteArray.compare(leftBytesValues[i], rightBytesValues[i]));
```
##########
File path: pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/BinaryOperatorTransformFunction.java
##########
@@ -71,218 +113,331 @@ public TransformResultMetadata getResultMetadata() {
}
private void fillResultArray(ProjectionBlock projectionBlock) {
- if (_results == null) {
- _results = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL];
- }
int length = projectionBlock.getNumDocs();
+ if (_results == null || _results.length < length) {
+ _results = new int[length];
+ }
switch (_leftStoredType) {
case INT:
- int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftIntValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftIntValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultInt(projectionBlock, length);
break;
case LONG:
- long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightFloatValues[i])));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightDoubleValues[i])));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftLongValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultLong(projectionBlock, length);
break;
case FLOAT:
- float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Float.compare(leftFloatValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultFloat(projectionBlock, length);
break;
case DOUBLE:
- double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultDouble(projectionBlock, length);
break;
case STRING:
- String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
- }
+ fillResultString(projectionBlock, length);
break;
case BYTES:
- byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
- byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
- }
+ fillResultBytes(projectionBlock, length);
break;
// NOTE: Multi-value columns are not comparable, so we should not reach here
default:
- throw new IllegalStateException();
+ throw illegalState();
+ }
+ }
+
+ private void fillResultInt(ProjectionBlock projectionBlock, int length) {
+ int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftIntValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultLong(ProjectionBlock projectionBlock, int length) {
+ long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftLongValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultFloat(ProjectionBlock projectionBlock, int length) {
+ float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultDouble(ProjectionBlock projectionBlock, int length) {
+ double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private IllegalStateException illegalState() {
+ throw new IllegalStateException(String.format(
+ "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
+ + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
+ _rightTransformFunction.getName(), _rightStoredType));
+ }
+
+ private void fillResultString(ProjectionBlock projectionBlock, int length) {
+ String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
+ }
+ }
+
+ private void fillResultBytes(ProjectionBlock projectionBlock, int length) {
+ byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
+ byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, int[] leftIntValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftValues[i], rightValues[i]));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
+ }
+ }
+
+ private void fillStringResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ try {
+ _results[i] =
+ getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
+ } catch (NumberFormatException e) {
+ _results[i] = 0;
+ }
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, long[] leftIntValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftIntValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftValues[i], rightValues[i]));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
Review comment:
Same here
##########
File path: pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/BinaryOperatorTransformFunction.java
##########
@@ -71,218 +113,331 @@ public TransformResultMetadata getResultMetadata() {
}
private void fillResultArray(ProjectionBlock projectionBlock) {
- if (_results == null) {
- _results = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL];
- }
int length = projectionBlock.getNumDocs();
+ if (_results == null || _results.length < length) {
+ _results = new int[length];
+ }
switch (_leftStoredType) {
case INT:
- int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftIntValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftIntValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultInt(projectionBlock, length);
break;
case LONG:
- long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightFloatValues[i])));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightDoubleValues[i])));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftLongValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultLong(projectionBlock, length);
break;
case FLOAT:
- float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Float.compare(leftFloatValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultFloat(projectionBlock, length);
break;
case DOUBLE:
- double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultDouble(projectionBlock, length);
break;
case STRING:
- String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
- }
+ fillResultString(projectionBlock, length);
break;
case BYTES:
- byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
- byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
- }
+ fillResultBytes(projectionBlock, length);
break;
// NOTE: Multi-value columns are not comparable, so we should not reach here
default:
- throw new IllegalStateException();
+ throw illegalState();
+ }
+ }
+
+ private void fillResultInt(ProjectionBlock projectionBlock, int length) {
+ int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftIntValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultLong(ProjectionBlock projectionBlock, int length) {
+ long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftLongValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultFloat(ProjectionBlock projectionBlock, int length) {
+ float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultDouble(ProjectionBlock projectionBlock, int length) {
+ double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private IllegalStateException illegalState() {
+ throw new IllegalStateException(String.format(
+ "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
+ + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
+ _rightTransformFunction.getName(), _rightStoredType));
+ }
+
+ private void fillResultString(ProjectionBlock projectionBlock, int length) {
+ String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
+ }
+ }
+
+ private void fillResultBytes(ProjectionBlock projectionBlock, int length) {
+ byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
+ byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, int[] leftIntValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftValues[i], rightValues[i]));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
+ }
+ }
+
+ private void fillStringResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ try {
+ _results[i] =
+ getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
+ } catch (NumberFormatException e) {
+ _results[i] = 0;
+ }
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, long[] leftIntValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftIntValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftValues[i], rightValues[i]));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
Review comment:
We should use `BigDecimal` for this comparison
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] Jackie-Jiang merged pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
Jackie-Jiang merged pull request #7709:
URL: https://github.com/apache/pinot/pull/7709
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] codecov-commenter commented on pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#issuecomment-961925076
# [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#7709](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c5a35d5) into [master](https://codecov.io/gh/apache/pinot/commit/e80198db7f71f6c043e4ffc728d6cfce6eb9b729?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e80198d) will **decrease** coverage by `42.21%`.
> The diff coverage is `62.19%`.
> :exclamation: Current head c5a35d5 differs from pull request most recent head b8fc135. Consider uploading reports for the commit b8fc135 to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/pinot/pull/7709/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #7709 +/- ##
=============================================
- Coverage 71.50% 29.28% -42.22%
=============================================
Files 1581 1572 -9
Lines 80400 80092 -308
Branches 11943 11920 -23
=============================================
- Hits 57486 23451 -34035
- Misses 19026 54577 +35551
+ Partials 3888 2064 -1824
```
| Flag | Coverage Δ | |
|---|---|---|
| integration1 | `29.28% <62.19%> (+0.21%)` | :arrow_up: |
| integration2 | `?` | |
| unittests1 | `?` | |
| unittests2 | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../pinot/common/utils/ClientSSLContextGenerator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvQ2xpZW50U1NMQ29udGV4dEdlbmVyYXRvci5qYXZh) | `0.00% <0.00%> (-31.04%)` | :arrow_down: |
| [...reaming/StreamingSelectionOnlyCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9zdHJlYW1pbmcvU3RyZWFtaW5nU2VsZWN0aW9uT25seUNvbWJpbmVPcGVyYXRvci5qYXZh) | `0.00% <0.00%> (-71.12%)` | :arrow_down: |
| [...rg/apache/pinot/common/utils/helix/TableCache.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvaGVsaXgvVGFibGVDYWNoZS5qYXZh) | `80.58% <62.50%> (-2.13%)` | :arrow_down: |
| [...e/pinot/common/utils/FileUploadDownloadClient.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvRmlsZVVwbG9hZERvd25sb2FkQ2xpZW50LmphdmE=) | `53.16% <66.66%> (-13.79%)` | :arrow_down: |
| [.../core/operator/combine/GroupByCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9jb21iaW5lL0dyb3VwQnlDb21iaW5lT3BlcmF0b3IuamF2YQ==) | `75.00% <68.00%> (-4.37%)` | :arrow_down: |
| [...form/function/BinaryOperatorTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vQmluYXJ5T3BlcmF0b3JUcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `27.93% <77.77%> (-4.31%)` | :arrow_down: |
| [...or/transform/function/EqualsTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vRXF1YWxzVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [.../function/GreaterThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [...ansform/function/GreaterThanTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5UcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | |
| [...orm/function/LessThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vTGVzc1RoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| ... and [1123 more](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [e80198d...b8fc135](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] codecov-commenter edited a comment on pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#issuecomment-961925076
# [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#7709](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a3c64aa) into [master](https://codecov.io/gh/apache/pinot/commit/e80198db7f71f6c043e4ffc728d6cfce6eb9b729?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e80198d) will **decrease** coverage by `35.17%`.
> The diff coverage is `32.42%`.
> :exclamation: Current head a3c64aa differs from pull request most recent head 0009a1a. Consider uploading reports for the commit 0009a1a to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/pinot/pull/7709/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #7709 +/- ##
=============================================
- Coverage 71.50% 36.32% -35.18%
+ Complexity 4030 80 -3950
=============================================
Files 1581 1581
Lines 80400 80487 +87
Branches 11943 11959 +16
=============================================
- Hits 57486 29236 -28250
- Misses 19026 48921 +29895
+ Partials 3888 2330 -1558
```
| Flag | Coverage Δ | |
|---|---|---|
| integration1 | `?` | |
| integration2 | `27.65% <32.42%> (+0.05%)` | :arrow_up: |
| unittests1 | `?` | |
| unittests2 | `14.54% <0.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../pinot/common/utils/ClientSSLContextGenerator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvQ2xpZW50U1NMQ29udGV4dEdlbmVyYXRvci5qYXZh) | `0.00% <0.00%> (-31.04%)` | :arrow_down: |
| [...form/function/BinaryOperatorTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vQmluYXJ5T3BlcmF0b3JUcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `26.99% <23.38%> (-5.25%)` | :arrow_down: |
| [...reaming/StreamingSelectionOnlyCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9zdHJlYW1pbmcvU3RyZWFtaW5nU2VsZWN0aW9uT25seUNvbWJpbmVPcGVyYXRvci5qYXZh) | `65.30% <41.66%> (-5.81%)` | :arrow_down: |
| [...rg/apache/pinot/common/utils/helix/TableCache.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvaGVsaXgvVGFibGVDYWNoZS5qYXZh) | `81.76% <62.50%> (-0.96%)` | :arrow_down: |
| [.../core/operator/combine/GroupByCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9jb21iaW5lL0dyb3VwQnlDb21iaW5lT3BlcmF0b3IuamF2YQ==) | `75.00% <68.00%> (-4.37%)` | :arrow_down: |
| [...e/pinot/common/utils/FileUploadDownloadClient.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvRmlsZVVwbG9hZERvd25sb2FkQ2xpZW50LmphdmE=) | `54.00% <100.00%> (-12.95%)` | :arrow_down: |
| [...or/transform/function/EqualsTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vRXF1YWxzVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [.../function/GreaterThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [...ansform/function/GreaterThanTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5UcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | |
| [...orm/function/LessThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vTGVzc1RoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| ... and [950 more](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [e80198d...0009a1a](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] richardstartin commented on a change in pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
richardstartin commented on a change in pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#discussion_r744128459
##########
File path: pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/BinaryOperatorTransformFunction.java
##########
@@ -71,218 +113,331 @@ public TransformResultMetadata getResultMetadata() {
}
private void fillResultArray(ProjectionBlock projectionBlock) {
- if (_results == null) {
- _results = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL];
- }
int length = projectionBlock.getNumDocs();
+ if (_results == null || _results.length < length) {
+ _results = new int[length];
+ }
switch (_leftStoredType) {
case INT:
- int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftIntValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftIntValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultInt(projectionBlock, length);
break;
case LONG:
- long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightFloatValues[i])));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightDoubleValues[i])));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftLongValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultLong(projectionBlock, length);
break;
case FLOAT:
- float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Float.compare(leftFloatValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultFloat(projectionBlock, length);
break;
case DOUBLE:
- double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultDouble(projectionBlock, length);
break;
case STRING:
- String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
- }
+ fillResultString(projectionBlock, length);
break;
case BYTES:
- byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
- byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
- }
+ fillResultBytes(projectionBlock, length);
break;
// NOTE: Multi-value columns are not comparable, so we should not reach here
default:
- throw new IllegalStateException();
+ throw illegalState();
+ }
+ }
+
+ private void fillResultInt(ProjectionBlock projectionBlock, int length) {
+ int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftIntValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultLong(ProjectionBlock projectionBlock, int length) {
+ long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftLongValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultFloat(ProjectionBlock projectionBlock, int length) {
+ float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultDouble(ProjectionBlock projectionBlock, int length) {
+ double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private IllegalStateException illegalState() {
+ throw new IllegalStateException(String.format(
+ "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
+ + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
+ _rightTransformFunction.getName(), _rightStoredType));
+ }
+
+ private void fillResultString(ProjectionBlock projectionBlock, int length) {
+ String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
+ }
+ }
+
+ private void fillResultBytes(ProjectionBlock projectionBlock, int length) {
+ byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
+ byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, int[] leftIntValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftValues[i], rightValues[i]));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
+ }
+ }
+
+ private void fillStringResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ try {
+ _results[i] =
+ getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
+ } catch (NumberFormatException e) {
+ _results[i] = 0;
+ }
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, long[] leftIntValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftIntValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftValues[i], rightValues[i]));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
Review comment:
I don't think this is necessary. `BigDecimal` is ridiculously expensive. Do you have a particular case in mind?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] codecov-commenter commented on pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#issuecomment-961925076
# [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#7709](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c5a35d5) into [master](https://codecov.io/gh/apache/pinot/commit/e80198db7f71f6c043e4ffc728d6cfce6eb9b729?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e80198d) will **decrease** coverage by `42.21%`.
> The diff coverage is `62.19%`.
> :exclamation: Current head c5a35d5 differs from pull request most recent head b8fc135. Consider uploading reports for the commit b8fc135 to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/pinot/pull/7709/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #7709 +/- ##
=============================================
- Coverage 71.50% 29.28% -42.22%
=============================================
Files 1581 1572 -9
Lines 80400 80092 -308
Branches 11943 11920 -23
=============================================
- Hits 57486 23451 -34035
- Misses 19026 54577 +35551
+ Partials 3888 2064 -1824
```
| Flag | Coverage Δ | |
|---|---|---|
| integration1 | `29.28% <62.19%> (+0.21%)` | :arrow_up: |
| integration2 | `?` | |
| unittests1 | `?` | |
| unittests2 | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../pinot/common/utils/ClientSSLContextGenerator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvQ2xpZW50U1NMQ29udGV4dEdlbmVyYXRvci5qYXZh) | `0.00% <0.00%> (-31.04%)` | :arrow_down: |
| [...reaming/StreamingSelectionOnlyCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9zdHJlYW1pbmcvU3RyZWFtaW5nU2VsZWN0aW9uT25seUNvbWJpbmVPcGVyYXRvci5qYXZh) | `0.00% <0.00%> (-71.12%)` | :arrow_down: |
| [...rg/apache/pinot/common/utils/helix/TableCache.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvaGVsaXgvVGFibGVDYWNoZS5qYXZh) | `80.58% <62.50%> (-2.13%)` | :arrow_down: |
| [...e/pinot/common/utils/FileUploadDownloadClient.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvRmlsZVVwbG9hZERvd25sb2FkQ2xpZW50LmphdmE=) | `53.16% <66.66%> (-13.79%)` | :arrow_down: |
| [.../core/operator/combine/GroupByCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9jb21iaW5lL0dyb3VwQnlDb21iaW5lT3BlcmF0b3IuamF2YQ==) | `75.00% <68.00%> (-4.37%)` | :arrow_down: |
| [...form/function/BinaryOperatorTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vQmluYXJ5T3BlcmF0b3JUcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `27.93% <77.77%> (-4.31%)` | :arrow_down: |
| [...or/transform/function/EqualsTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vRXF1YWxzVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [.../function/GreaterThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [...ansform/function/GreaterThanTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5UcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | |
| [...orm/function/LessThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vTGVzc1RoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| ... and [1123 more](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [e80198d...b8fc135](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] richardstartin commented on a change in pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
richardstartin commented on a change in pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#discussion_r744721278
##########
File path: pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/BinaryOperatorTransformFunction.java
##########
@@ -71,218 +113,331 @@ public TransformResultMetadata getResultMetadata() {
}
private void fillResultArray(ProjectionBlock projectionBlock) {
- if (_results == null) {
- _results = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL];
- }
int length = projectionBlock.getNumDocs();
+ if (_results == null || _results.length < length) {
+ _results = new int[length];
+ }
switch (_leftStoredType) {
case INT:
- int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftIntValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftIntValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultInt(projectionBlock, length);
break;
case LONG:
- long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightFloatValues[i])));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightDoubleValues[i])));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftLongValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultLong(projectionBlock, length);
break;
case FLOAT:
- float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Float.compare(leftFloatValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultFloat(projectionBlock, length);
break;
case DOUBLE:
- double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultDouble(projectionBlock, length);
break;
case STRING:
- String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
- }
+ fillResultString(projectionBlock, length);
break;
case BYTES:
- byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
- byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
- }
+ fillResultBytes(projectionBlock, length);
break;
// NOTE: Multi-value columns are not comparable, so we should not reach here
default:
- throw new IllegalStateException();
+ throw illegalState();
+ }
+ }
+
+ private void fillResultInt(ProjectionBlock projectionBlock, int length) {
+ int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftIntValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultLong(ProjectionBlock projectionBlock, int length) {
+ long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftLongValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultFloat(ProjectionBlock projectionBlock, int length) {
+ float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultDouble(ProjectionBlock projectionBlock, int length) {
+ double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private IllegalStateException illegalState() {
+ throw new IllegalStateException(String.format(
+ "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
+ + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
+ _rightTransformFunction.getName(), _rightStoredType));
+ }
+
+ private void fillResultString(ProjectionBlock projectionBlock, int length) {
+ String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
+ }
+ }
+
+ private void fillResultBytes(ProjectionBlock projectionBlock, int length) {
+ byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
+ byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, int[] leftIntValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftValues[i], rightValues[i]));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
+ }
+ }
+
+ private void fillStringResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ try {
+ _results[i] =
+ getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
+ } catch (NumberFormatException e) {
+ _results[i] = 0;
+ }
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, long[] leftIntValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftIntValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftValues[i], rightValues[i]));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
Review comment:
I assume you are concerned about inexact translation to `double` - we now avoid converting to `BigDecimal` if the absolute value of the `long` is smaller than 2^53.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] codecov-commenter edited a comment on pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#issuecomment-961925076
# [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#7709](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (8d1fc98) into [master](https://codecov.io/gh/apache/pinot/commit/e80198db7f71f6c043e4ffc728d6cfce6eb9b729?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e80198d) will **decrease** coverage by `42.25%`.
> The diff coverage is `30.56%`.
> :exclamation: Current head 8d1fc98 differs from pull request most recent head 036ec26. Consider uploading reports for the commit 036ec26 to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/pinot/pull/7709/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #7709 +/- ##
=============================================
- Coverage 71.50% 29.24% -42.26%
=============================================
Files 1581 1572 -9
Lines 80400 80190 -210
Branches 11943 11924 -19
=============================================
- Hits 57486 23448 -34038
- Misses 19026 54670 +35644
+ Partials 3888 2072 -1816
```
| Flag | Coverage Δ | |
|---|---|---|
| integration1 | `29.24% <30.56%> (+0.17%)` | :arrow_up: |
| integration2 | `?` | |
| unittests1 | `?` | |
| unittests2 | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../pinot/common/utils/ClientSSLContextGenerator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvQ2xpZW50U1NMQ29udGV4dEdlbmVyYXRvci5qYXZh) | `0.00% <0.00%> (-31.04%)` | :arrow_down: |
| [...e/pinot/controller/helix/SegmentStatusChecker.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29udHJvbGxlci9oZWxpeC9TZWdtZW50U3RhdHVzQ2hlY2tlci5qYXZh) | `71.12% <0.00%> (-18.19%)` | :arrow_down: |
| [...ller/validation/OfflineSegmentIntervalChecker.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29udHJvbGxlci92YWxpZGF0aW9uL09mZmxpbmVTZWdtZW50SW50ZXJ2YWxDaGVja2VyLmphdmE=) | `76.40% <0.00%> (-9.68%)` | :arrow_down: |
| [...r/validation/RealtimeSegmentValidationManager.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29udHJvbGxlci92YWxpZGF0aW9uL1JlYWx0aW1lU2VnbWVudFZhbGlkYXRpb25NYW5hZ2VyLmphdmE=) | `72.85% <0.00%> (-8.40%)` | :arrow_down: |
| [...reaming/StreamingSelectionOnlyCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9zdHJlYW1pbmcvU3RyZWFtaW5nU2VsZWN0aW9uT25seUNvbWJpbmVPcGVyYXRvci5qYXZh) | `0.00% <0.00%> (-71.12%)` | :arrow_down: |
| [...ment/creator/impl/SegmentColumnarIndexCreator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3Qtc2VnbWVudC1sb2NhbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3Qvc2VnbWVudC9sb2NhbC9zZWdtZW50L2NyZWF0b3IvaW1wbC9TZWdtZW50Q29sdW1uYXJJbmRleENyZWF0b3IuamF2YQ==) | `0.00% <0.00%> (-84.55%)` | :arrow_down: |
| [...ot/segment/spi/creator/SegmentGeneratorConfig.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3Qtc2VnbWVudC1zcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3Bpbm90L3NlZ21lbnQvc3BpL2NyZWF0b3IvU2VnbWVudEdlbmVyYXRvckNvbmZpZy5qYXZh) | `0.00% <0.00%> (-82.68%)` | :arrow_down: |
| [...elix/core/periodictask/ControllerPeriodicTask.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29udHJvbGxlci9oZWxpeC9jb3JlL3BlcmlvZGljdGFzay9Db250cm9sbGVyUGVyaW9kaWNUYXNrLmphdmE=) | `67.27% <20.00%> (-8.73%)` | :arrow_down: |
| [...form/function/BinaryOperatorTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vQmluYXJ5T3BlcmF0b3JUcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `27.23% <23.50%> (-5.01%)` | :arrow_down: |
| [...rg/apache/pinot/common/utils/helix/TableCache.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvaGVsaXgvVGFibGVDYWNoZS5qYXZh) | `80.58% <62.50%> (-2.13%)` | :arrow_down: |
| ... and [1129 more](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [e80198d...036ec26](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] codecov-commenter edited a comment on pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#issuecomment-961925076
# [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#7709](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a3c64aa) into [master](https://codecov.io/gh/apache/pinot/commit/e80198db7f71f6c043e4ffc728d6cfce6eb9b729?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e80198d) will **decrease** coverage by `35.17%`.
> The diff coverage is `32.42%`.
> :exclamation: Current head a3c64aa differs from pull request most recent head 0009a1a. Consider uploading reports for the commit 0009a1a to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/pinot/pull/7709/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #7709 +/- ##
=============================================
- Coverage 71.50% 36.32% -35.18%
+ Complexity 4030 80 -3950
=============================================
Files 1581 1581
Lines 80400 80487 +87
Branches 11943 11959 +16
=============================================
- Hits 57486 29236 -28250
- Misses 19026 48921 +29895
+ Partials 3888 2330 -1558
```
| Flag | Coverage Δ | |
|---|---|---|
| integration1 | `?` | |
| integration2 | `27.65% <32.42%> (+0.05%)` | :arrow_up: |
| unittests1 | `?` | |
| unittests2 | `14.54% <0.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../pinot/common/utils/ClientSSLContextGenerator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvQ2xpZW50U1NMQ29udGV4dEdlbmVyYXRvci5qYXZh) | `0.00% <0.00%> (-31.04%)` | :arrow_down: |
| [...form/function/BinaryOperatorTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vQmluYXJ5T3BlcmF0b3JUcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `26.99% <23.38%> (-5.25%)` | :arrow_down: |
| [...reaming/StreamingSelectionOnlyCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9zdHJlYW1pbmcvU3RyZWFtaW5nU2VsZWN0aW9uT25seUNvbWJpbmVPcGVyYXRvci5qYXZh) | `65.30% <41.66%> (-5.81%)` | :arrow_down: |
| [...rg/apache/pinot/common/utils/helix/TableCache.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvaGVsaXgvVGFibGVDYWNoZS5qYXZh) | `81.76% <62.50%> (-0.96%)` | :arrow_down: |
| [.../core/operator/combine/GroupByCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9jb21iaW5lL0dyb3VwQnlDb21iaW5lT3BlcmF0b3IuamF2YQ==) | `75.00% <68.00%> (-4.37%)` | :arrow_down: |
| [...e/pinot/common/utils/FileUploadDownloadClient.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvRmlsZVVwbG9hZERvd25sb2FkQ2xpZW50LmphdmE=) | `54.00% <100.00%> (-12.95%)` | :arrow_down: |
| [...or/transform/function/EqualsTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vRXF1YWxzVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [.../function/GreaterThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [...ansform/function/GreaterThanTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5UcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | |
| [...orm/function/LessThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vTGVzc1RoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| ... and [950 more](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [e80198d...0009a1a](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] codecov-commenter edited a comment on pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#issuecomment-961925076
# [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#7709](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (036ec26) into [master](https://codecov.io/gh/apache/pinot/commit/e80198db7f71f6c043e4ffc728d6cfce6eb9b729?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e80198d) will **decrease** coverage by `43.74%`.
> The diff coverage is `25.72%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/pinot/pull/7709/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #7709 +/- ##
=============================================
- Coverage 71.50% 27.75% -43.75%
=============================================
Files 1581 1572 -9
Lines 80400 80190 -210
Branches 11943 11924 -19
=============================================
- Hits 57486 22260 -35226
- Misses 19026 55912 +36886
+ Partials 3888 2018 -1870
```
| Flag | Coverage Δ | |
|---|---|---|
| integration1 | `?` | |
| integration2 | `27.75% <25.72%> (+0.16%)` | :arrow_up: |
| unittests1 | `?` | |
| unittests2 | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...form/function/BinaryOperatorTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vQmluYXJ5T3BlcmF0b3JUcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `27.23% <23.50%> (-5.01%)` | :arrow_down: |
| [...or/transform/function/EqualsTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vRXF1YWxzVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [.../function/GreaterThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [...ansform/function/GreaterThanTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5UcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | |
| [...orm/function/LessThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vTGVzc1RoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [.../transform/function/LessThanTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vTGVzc1RoYW5UcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | |
| [...transform/function/NotEqualsTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vTm90RXF1YWxzVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [...c/main/java/org/apache/pinot/common/tier/Tier.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdGllci9UaWVyLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [.../java/org/apache/pinot/spi/utils/BooleanUtils.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvdXRpbHMvQm9vbGVhblV0aWxzLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...ava/org/apache/pinot/spi/data/MetricFieldSpec.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvZGF0YS9NZXRyaWNGaWVsZFNwZWMuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| ... and [1128 more](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [e80198d...036ec26](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] codecov-commenter edited a comment on pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#issuecomment-961925076
# [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#7709](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a3c64aa) into [master](https://codecov.io/gh/apache/pinot/commit/e80198db7f71f6c043e4ffc728d6cfce6eb9b729?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e80198d) will **decrease** coverage by `35.17%`.
> The diff coverage is `32.42%`.
> :exclamation: Current head a3c64aa differs from pull request most recent head 0009a1a. Consider uploading reports for the commit 0009a1a to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/pinot/pull/7709/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #7709 +/- ##
=============================================
- Coverage 71.50% 36.32% -35.18%
+ Complexity 4030 80 -3950
=============================================
Files 1581 1581
Lines 80400 80487 +87
Branches 11943 11959 +16
=============================================
- Hits 57486 29236 -28250
- Misses 19026 48921 +29895
+ Partials 3888 2330 -1558
```
| Flag | Coverage Δ | |
|---|---|---|
| integration1 | `?` | |
| integration2 | `27.65% <32.42%> (+0.05%)` | :arrow_up: |
| unittests1 | `?` | |
| unittests2 | `14.54% <0.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../pinot/common/utils/ClientSSLContextGenerator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvQ2xpZW50U1NMQ29udGV4dEdlbmVyYXRvci5qYXZh) | `0.00% <0.00%> (-31.04%)` | :arrow_down: |
| [...form/function/BinaryOperatorTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vQmluYXJ5T3BlcmF0b3JUcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `26.99% <23.38%> (-5.25%)` | :arrow_down: |
| [...reaming/StreamingSelectionOnlyCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9zdHJlYW1pbmcvU3RyZWFtaW5nU2VsZWN0aW9uT25seUNvbWJpbmVPcGVyYXRvci5qYXZh) | `65.30% <41.66%> (-5.81%)` | :arrow_down: |
| [...rg/apache/pinot/common/utils/helix/TableCache.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvaGVsaXgvVGFibGVDYWNoZS5qYXZh) | `81.76% <62.50%> (-0.96%)` | :arrow_down: |
| [.../core/operator/combine/GroupByCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9jb21iaW5lL0dyb3VwQnlDb21iaW5lT3BlcmF0b3IuamF2YQ==) | `75.00% <68.00%> (-4.37%)` | :arrow_down: |
| [...e/pinot/common/utils/FileUploadDownloadClient.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvRmlsZVVwbG9hZERvd25sb2FkQ2xpZW50LmphdmE=) | `54.00% <100.00%> (-12.95%)` | :arrow_down: |
| [...or/transform/function/EqualsTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vRXF1YWxzVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [.../function/GreaterThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [...ansform/function/GreaterThanTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5UcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | |
| [...orm/function/LessThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vTGVzc1RoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| ... and [950 more](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [e80198d...0009a1a](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] richardstartin commented on a change in pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
richardstartin commented on a change in pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#discussion_r744128333
##########
File path: pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/BinaryOperatorTransformFunction.java
##########
@@ -71,218 +113,331 @@ public TransformResultMetadata getResultMetadata() {
}
private void fillResultArray(ProjectionBlock projectionBlock) {
- if (_results == null) {
- _results = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL];
- }
int length = projectionBlock.getNumDocs();
+ if (_results == null || _results.length < length) {
+ _results = new int[length];
+ }
switch (_leftStoredType) {
case INT:
- int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftIntValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftIntValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultInt(projectionBlock, length);
break;
case LONG:
- long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightFloatValues[i])));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightDoubleValues[i])));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftLongValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultLong(projectionBlock, length);
break;
case FLOAT:
- float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Float.compare(leftFloatValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultFloat(projectionBlock, length);
break;
case DOUBLE:
- double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultDouble(projectionBlock, length);
break;
case STRING:
- String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
- }
+ fillResultString(projectionBlock, length);
break;
case BYTES:
- byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
- byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
- }
+ fillResultBytes(projectionBlock, length);
break;
// NOTE: Multi-value columns are not comparable, so we should not reach here
default:
- throw new IllegalStateException();
+ throw illegalState();
+ }
+ }
+
+ private void fillResultInt(ProjectionBlock projectionBlock, int length) {
+ int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftIntValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultLong(ProjectionBlock projectionBlock, int length) {
+ long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftLongValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultFloat(ProjectionBlock projectionBlock, int length) {
+ float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultDouble(ProjectionBlock projectionBlock, int length) {
+ double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private IllegalStateException illegalState() {
+ throw new IllegalStateException(String.format(
+ "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
+ + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
+ _rightTransformFunction.getName(), _rightStoredType));
+ }
+
+ private void fillResultString(ProjectionBlock projectionBlock, int length) {
+ String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
+ }
+ }
+
+ private void fillResultBytes(ProjectionBlock projectionBlock, int length) {
+ byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
+ byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
Review comment:
This was lifted and shifted, but it makes sense to change it anyway.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] richardstartin commented on a change in pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
richardstartin commented on a change in pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#discussion_r744128279
##########
File path: pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/BinaryOperatorTransformFunction.java
##########
@@ -71,218 +113,331 @@ public TransformResultMetadata getResultMetadata() {
}
private void fillResultArray(ProjectionBlock projectionBlock) {
- if (_results == null) {
- _results = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL];
- }
int length = projectionBlock.getNumDocs();
+ if (_results == null || _results.length < length) {
+ _results = new int[length];
+ }
switch (_leftStoredType) {
case INT:
- int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftIntValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftIntValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftIntValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultInt(projectionBlock, length);
break;
case LONG:
- long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Long.compare(leftLongValues[i], rightLongValues[i]));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightFloatValues[i])));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftLongValues[i]).compareTo(BigDecimal.valueOf(rightDoubleValues[i])));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] =
- getIntResult(BigDecimal.valueOf(leftLongValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultLong(projectionBlock, length);
break;
case FLOAT:
- float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Float.compare(leftFloatValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftFloatValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftFloatValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultFloat(projectionBlock, length);
break;
case DOUBLE:
- double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
- switch (_rightStoredType) {
- case INT:
- int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightIntValues[i]));
- }
- break;
- case LONG:
- long[] rightLongValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(BigDecimal.valueOf(rightLongValues[i])));
- }
- break;
- case FLOAT:
- float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightFloatValues[i]));
- }
- break;
- case DOUBLE:
- double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(Double.compare(leftDoubleValues[i], rightDoubleValues[i]));
- }
- break;
- case STRING:
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- try {
- _results[i] = getIntResult(
- BigDecimal.valueOf(leftDoubleValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
- } catch (NumberFormatException e) {
- _results[i] = 0;
- }
- }
- break;
- default:
- throw new IllegalStateException(String.format(
- "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
- + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
- _rightTransformFunction.getName(), _rightStoredType));
- }
+ fillResultDouble(projectionBlock, length);
break;
case STRING:
- String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
- String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
- }
+ fillResultString(projectionBlock, length);
break;
case BYTES:
- byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
- byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
- for (int i = 0; i < length; i++) {
- _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
- }
+ fillResultBytes(projectionBlock, length);
break;
// NOTE: Multi-value columns are not comparable, so we should not reach here
default:
- throw new IllegalStateException();
+ throw illegalState();
+ }
+ }
+
+ private void fillResultInt(ProjectionBlock projectionBlock, int length) {
+ int[] leftIntValues = _leftTransformFunction.transformToIntValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftIntValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftIntValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultLong(ProjectionBlock projectionBlock, int length) {
+ long[] leftLongValues = _leftTransformFunction.transformToLongValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftLongValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftLongValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultFloat(ProjectionBlock projectionBlock, int length) {
+ float[] leftFloatValues = _leftTransformFunction.transformToFloatValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftFloatValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private void fillResultDouble(ProjectionBlock projectionBlock, int length) {
+ double[] leftDoubleValues = _leftTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ switch (_rightStoredType) {
+ case INT:
+ fillIntResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case LONG:
+ fillLongResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case FLOAT:
+ fillFloatResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case DOUBLE:
+ fillDoubleResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ case STRING:
+ fillStringResultArray(projectionBlock, leftDoubleValues, length);
+ break;
+ default:
+ throw illegalState();
+ }
+ }
+
+ private IllegalStateException illegalState() {
+ throw new IllegalStateException(String.format(
+ "Unsupported data type for comparison: [Left Transform Function [%s] result type is [%s], Right "
+ + "Transform Function [%s] result type is [%s]]", _leftTransformFunction.getName(), _leftStoredType,
+ _rightTransformFunction.getName(), _rightStoredType));
+ }
+
+ private void fillResultString(ProjectionBlock projectionBlock, int length) {
+ String[] leftStringValues = _leftTransformFunction.transformToStringValuesSV(projectionBlock);
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(leftStringValues[i].compareTo(rightStringValues[i]));
+ }
+ }
+
+ private void fillResultBytes(ProjectionBlock projectionBlock, int length) {
+ byte[][] leftBytesValues = _leftTransformFunction.transformToBytesValuesSV(projectionBlock);
+ byte[][] rightBytesValues = _rightTransformFunction.transformToBytesValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult((new ByteArray(leftBytesValues[i])).compareTo(new ByteArray(rightBytesValues[i])));
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, int[] leftIntValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Integer.compare(leftIntValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftValues[i], rightValues[i]));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
+ }
+ }
+
+ private void fillStringResultArray(ProjectionBlock projectionBlock, int[] leftValues, int length) {
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ try {
+ _results[i] =
+ getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
+ } catch (NumberFormatException e) {
+ _results[i] = 0;
+ }
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, long[] leftIntValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftIntValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Long.compare(leftValues[i], rightValues[i]));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
+ }
+ }
+
+ private void fillStringResultArray(ProjectionBlock projectionBlock, long[] leftValues, int length) {
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ try {
+ _results[i] =
+ getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
+ } catch (NumberFormatException e) {
+ _results[i] = 0;
+ }
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, float[] leftValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, float[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(BigDecimal.valueOf(rightValues[i])));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, float[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Float.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, float[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
+ }
+ }
+
+ private void fillStringResultArray(ProjectionBlock projectionBlock, float[] leftValues, int length) {
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ try {
+ _results[i] =
+ getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
+ } catch (NumberFormatException e) {
+ _results[i] = 0;
+ }
+ }
+ }
+
+ private void fillIntResultArray(ProjectionBlock projectionBlock, double[] leftValues, int length) {
+ int[] rightIntValues = _rightTransformFunction.transformToIntValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightIntValues[i]));
+ }
+ }
+
+ private void fillLongResultArray(ProjectionBlock projectionBlock, double[] leftValues, int length) {
+ long[] rightValues = _rightTransformFunction.transformToLongValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(BigDecimal.valueOf(rightValues[i])));
+ }
+ }
+
+ private void fillFloatResultArray(ProjectionBlock projectionBlock, double[] leftValues, int length) {
+ float[] rightFloatValues = _rightTransformFunction.transformToFloatValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightFloatValues[i]));
+ }
+ }
+
+ private void fillDoubleResultArray(ProjectionBlock projectionBlock, double[] leftValues, int length) {
+ double[] rightDoubleValues = _rightTransformFunction.transformToDoubleValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ _results[i] = getIntResult(Double.compare(leftValues[i], rightDoubleValues[i]));
+ }
+ }
+
+ private void fillStringResultArray(ProjectionBlock projectionBlock, double[] leftValues, int length) {
+ String[] rightStringValues = _rightTransformFunction.transformToStringValuesSV(projectionBlock);
+ for (int i = 0; i < length; i++) {
+ try {
+ _results[i] =
+ getIntResult(BigDecimal.valueOf(leftValues[i]).compareTo(new BigDecimal(rightStringValues[i])));
+ } catch (NumberFormatException e) {
+ _results[i] = 0;
+ }
}
}
private int getIntResult(int comparisonResult) {
return getBinaryFuncResult(comparisonResult) ? 1 : 0;
}
- protected abstract boolean getBinaryFuncResult(int comparisonResult);
+ private boolean getBinaryFuncResult(int comparisonResult) {
+ switch (_op) {
+ case EQUALS:
+ return comparisonResult == 0;
+ case GREATER_THAN_OR_EQUAL:
+ return comparisonResult >= 0;
+ case GREATER_THAN:
+ return comparisonResult > 0;
+ case LESS_THAN:
+ return comparisonResult < 0;
+ case LESS_THAN_OR_EQUAL:
+ return comparisonResult <= 0;
+ case NOT_EQUAL:
+ return comparisonResult != 0;
+ default:
+ assert false;
Review comment:
This is impossible unless this class is edited, I don't see the point in handling it any other way. The tests will fail with an assertion error anyway.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] codecov-commenter commented on pull request #7709: inline binary comparison ops to prevent function call overhead
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #7709:
URL: https://github.com/apache/pinot/pull/7709#issuecomment-961925076
# [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#7709](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c5a35d5) into [master](https://codecov.io/gh/apache/pinot/commit/e80198db7f71f6c043e4ffc728d6cfce6eb9b729?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e80198d) will **decrease** coverage by `42.21%`.
> The diff coverage is `62.19%`.
> :exclamation: Current head c5a35d5 differs from pull request most recent head b8fc135. Consider uploading reports for the commit b8fc135 to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/pinot/pull/7709/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #7709 +/- ##
=============================================
- Coverage 71.50% 29.28% -42.22%
=============================================
Files 1581 1572 -9
Lines 80400 80092 -308
Branches 11943 11920 -23
=============================================
- Hits 57486 23451 -34035
- Misses 19026 54577 +35551
+ Partials 3888 2064 -1824
```
| Flag | Coverage Δ | |
|---|---|---|
| integration1 | `29.28% <62.19%> (+0.21%)` | :arrow_up: |
| integration2 | `?` | |
| unittests1 | `?` | |
| unittests2 | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../pinot/common/utils/ClientSSLContextGenerator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvQ2xpZW50U1NMQ29udGV4dEdlbmVyYXRvci5qYXZh) | `0.00% <0.00%> (-31.04%)` | :arrow_down: |
| [...reaming/StreamingSelectionOnlyCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9zdHJlYW1pbmcvU3RyZWFtaW5nU2VsZWN0aW9uT25seUNvbWJpbmVPcGVyYXRvci5qYXZh) | `0.00% <0.00%> (-71.12%)` | :arrow_down: |
| [...rg/apache/pinot/common/utils/helix/TableCache.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvaGVsaXgvVGFibGVDYWNoZS5qYXZh) | `80.58% <62.50%> (-2.13%)` | :arrow_down: |
| [...e/pinot/common/utils/FileUploadDownloadClient.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvRmlsZVVwbG9hZERvd25sb2FkQ2xpZW50LmphdmE=) | `53.16% <66.66%> (-13.79%)` | :arrow_down: |
| [.../core/operator/combine/GroupByCombineOperator.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci9jb21iaW5lL0dyb3VwQnlDb21iaW5lT3BlcmF0b3IuamF2YQ==) | `75.00% <68.00%> (-4.37%)` | :arrow_down: |
| [...form/function/BinaryOperatorTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vQmluYXJ5T3BlcmF0b3JUcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `27.93% <77.77%> (-4.31%)` | :arrow_down: |
| [...or/transform/function/EqualsTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vRXF1YWxzVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [.../function/GreaterThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [...ansform/function/GreaterThanTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vR3JlYXRlclRoYW5UcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | |
| [...orm/function/LessThanOrEqualTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vTGVzc1RoYW5PckVxdWFsVHJhbnNmb3JtRnVuY3Rpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
| ... and [1123 more](https://codecov.io/gh/apache/pinot/pull/7709/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [e80198d...b8fc135](https://codecov.io/gh/apache/pinot/pull/7709?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org