richardstartin commented on a change in pull request #7542:
URL: https://github.com/apache/pinot/pull/7542#discussion_r725190126



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/InTransformFunction.java
##########
@@ -81,77 +95,112 @@ public TransformResultMetadata getResultMetadata() {
     switch (storedType) {
       case INT:
         int[] intValues = 
_transformFunction.transformToIntValuesSV(projectionBlock);
-        int[][] inIntValues = new int[_valueTransformFunctions.length][];
-        for (int i = 0; i < _valueTransformFunctions.length; i++) {
-          inIntValues[i] = 
_valueTransformFunctions[i].transformToIntValuesSV(projectionBlock);
-        }
-        for (int i = 0; i < length; i++) {
-          for (int j = 0; j < inIntValues.length; j++) {
-            _results[i] = inIntValues[j][i] == intValues[i] ? 1 : _results[i];
+        if (!_stringValueSet.isEmpty()) {
+          Set<Integer> inIntValues = new HashSet<>();
+          for (String inValue : _stringValueSet) {
+            inIntValues.add(Integer.parseInt(inValue));
+          }
+          for (int i = 0; i < length; i++) {
+            _results[i] = inIntValues.contains(intValues[i]) ? 1 : 0;
+          }
+        } else {
+          int[][] inIntValues = new int[_valueTransformFunctions.length][];
+          for (int i = 0; i < _valueTransformFunctions.length; i++) {
+            inIntValues[i] = 
_valueTransformFunctions[i].transformToIntValuesSV(projectionBlock);
+          }
+          for (int i = 0; i < length; i++) {
+            for (int j = 0; j < inIntValues.length; j++) {
+              _results[i] = inIntValues[j][i] == intValues[i] ? 1 : 
_results[i];
+            }
           }
         }
         break;
       case LONG:
         long[] longValues = 
_transformFunction.transformToLongValuesSV(projectionBlock);
-        long[][] inLongValues = new long[_valueTransformFunctions.length][];
-        for (int i = 0; i < _valueTransformFunctions.length; i++) {
-          inLongValues[i] = 
_valueTransformFunctions[i].transformToLongValuesSV(projectionBlock);
-        }
-        for (int i = 0; i < length; i++) {
-          for (int j = 0; j < inLongValues.length; j++) {
-            _results[i] = inLongValues[j][i] == longValues[i] ? 1 : 
_results[i];
+        if (!_stringValueSet.isEmpty()) {
+          Set<Long> inLongValues = new HashSet<>();
+          for (String inValue : _stringValueSet) {
+            inLongValues.add(Long.parseLong(inValue));
+          }
+          for (int i = 0; i < length; i++) {
+            _results[i] = inLongValues.contains(longValues[i]) ? 1 : 0;
+          }
+        } else {
+          long[][] inLongValues = new long[_valueTransformFunctions.length][];
+          for (int i = 0; i < _valueTransformFunctions.length; i++) {
+            inLongValues[i] = 
_valueTransformFunctions[i].transformToLongValuesSV(projectionBlock);
+          }
+          for (int i = 0; i < length; i++) {
+            for (int j = 0; j < inLongValues.length; j++) {
+              _results[i] = inLongValues[j][i] == longValues[i] ? 1 : 
_results[i];
+            }
           }
         }
         break;
       case FLOAT:
         float[] floatValues = 
_transformFunction.transformToFloatValuesSV(projectionBlock);
-        float[][] inFloatValues = new float[_valueTransformFunctions.length][];
-        for (int i = 0; i < _valueTransformFunctions.length; i++) {
-          inFloatValues[i] = 
_valueTransformFunctions[i].transformToFloatValuesSV(projectionBlock);
-        }
-        for (int i = 0; i < length; i++) {
-          for (int j = 0; j < inFloatValues.length; j++) {
-            _results[i] = Float.compare(inFloatValues[j][i], floatValues[i]) 
== 0 ? 1 : _results[i];
+        if (!_stringValueSet.isEmpty()) {

Review comment:
       I suppose I'm asking why would someone want to do that? 
   
   If it's a valid use case, it could be implemented by sorting the values in 
the in clause and doing a check within an epsilon of say 1e-7.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to