rubenada commented on code in PR #3977:
URL: https://github.com/apache/calcite/pull/3977#discussion_r1775485605


##########
core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java:
##########
@@ -159,40 +159,18 @@ static List<RelDataType> fieldRowTypes(
 
   static Expression joinSelector(JoinRelType joinType, PhysType physType,
       List<PhysType> inputPhysTypes) {
-    // A parameter for each input.
-    final List<ParameterExpression> parameters = new ArrayList<>();
-
-    // Generate all fields.
-    final List<Expression> expressions = new ArrayList<>();
     final int outputFieldCount = physType.getRowType().getFieldCount();
-
     // If there are many output fields, create the output dynamically so that 
the code size stays
     // below the limit. See CALCITE-3094.
-    final boolean generateCompactCode = outputFieldCount >= 100;
-    final ParameterExpression compactOutputVar;
-    final BlockBuilder compactCode = new BlockBuilder();
-    if (generateCompactCode) {
-      Class<?> fieldClass = physType.fieldClass(0);
-      // If all fields have the same type, use the specific type. Otherwise 
just use Object.
-      for (int fieldIndex = 1; fieldIndex < outputFieldCount; ++fieldIndex) {
-        if (fieldClass != physType.fieldClass(fieldIndex)) {
-          fieldClass = Object.class;
-          break;
-        }
-      }
-
-      final Class<?> arrayClass = Array.newInstance(fieldClass, 0).getClass();
-      compactOutputVar = Expressions.variable(arrayClass, "outputArray");
-      final DeclarationStatement exp =
-          Expressions.declare(
-              0, compactOutputVar, new NewArrayExpression(fieldClass, 1,
-              Expressions.constant(outputFieldCount), null));
-      compactCode.add(exp);
-    } else {
-      compactOutputVar = null;
+    if (outputFieldCount >= 100) {

Review Comment:
   I'd propose something along the lines:
   ```
     /**
      * Minimum numbers of fields in a Join result that will trigger the 
"compact code generation".
      * This feature reduces the risk of running into a compilation error due 
to the code of a
      * dynamically generated method growing beyond the 64KB limit.
      *
      * <p>The default value is 100, a negative value disables completely the 
"compact code" feature.
      *
      * @see org.apache.calcite.adapter.enumerable.EnumUtils
      */
     public static final CalciteSystemProperty<Integer> 
JOIN_SELECTOR_COMPACT_CODE_THRESHOLD =
         intProperty("calcite.join.selector.compact.code.threshold", 100);
   ```
   



-- 
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]

Reply via email to