Code review comment: I'm suggesting you add one to this class.  ``` private static Expression nullOr(Expression field, Expression ifNotNull) {     return Expressions.condition(         Expressions.equal(field, Expressions.constant(null)),         Expressions.constant(null),         Expressions.box(ifNotNull)); } ```  Then this becomes ``` nullOr(field, Expressions.convert_(millisField, int.class)); ``` and the same pattern can be applied below.

Code under review:
public Expression field(BlockBuilder list, int index, Type storageType) {
      if (index >= inputSchema.getFieldCount() || index < 0) {
        throw new IllegalArgumentException("Unable to find field 
      }

      final Expression expression = list.append("current", input);
      if (storageType == Object.class) {
        return Expressions.convert_(
            Expressions.call(expression, "getValue", Expressions.constant(index)), Object.class);
      }
      FieldType fromType = inputSchema.getField(index).getType();
      String getter;
      if (fromType.getTypeName().isLogicalType()) {
        getter = logicalTypeGetterMap.get(fromType.getLogicalType().getIdentifier());
      } else {
        getter = typeGetterMap.get(fromType.getTypeName());
      }
      if (getter == null) {
        throw new IllegalArgumentException("Unable to get " + fromType.getTypeName());
      }
      Expression field = Expressions.call(expression, getter, Expressions.constant(index));
      if (fromType.getTypeName().isLogicalType()) {
        Expression millisField = Expressions.call(field, "getMillis");
        String logicalId = fromType.getLogicalType().getIdentifier();
        if (logicalId.equals(TimeType.IDENTIFIER)) {
          field =
              Expressions.condition(
                  Expressions.equal(field, Expressions.constant(null)),
                  Expressions.constant(null),
                  Expressions.call(
                      Integer.class, "valueOf", Expressions.convert_(millisField, int.class)));
        } else if (logicalId.equals(DateType.IDENTIFIER)) {
          field =
              Expressions.condition(
                  Expressions.equal(field, Expressions.constant(null)),
                  Expressions.constant(null),
                  Expressions.call(
                      Integer.class,
                      "valueOf",
                      Expressions.convert_(
                          Expressions.modulo(millisField, Expressions.constant(MILLIS_PER_DAY)),
                          int.class)));
        } else if (!logicalId.equals(CharType.IDENTIFIER)) {
          throw new IllegalArgumentException(
              "Unknown LogicalType " + fromType.getLogicalType().getIdentifier());
        }
      } else if (CalciteUtils.isDateTimeType(fromType)) {
        field =
            Expressions.condition(
                Expressions.equal(field, Expressions.constant(null)),
                Expressions.constant(null),
                Expressions.call(Long.class, "valueOf", Expressions.call(field, "getMillis")));
      } else if (fromType.getTypeName().isCompositeType()
          || (fromType.getTypeName().isCollectionType()
              && fromType.getCollectionElementType().getTypeName().isCompositeType())) {
        field =
            Expressions.condition(
                Expressions.equal(field, Expressions.constant(null)),
                Expressions.constant(null),
                Expressions.call(WrappedList.class, "of", field));
      }
      return field;
    }

Line commented on: Expressions.condition(

Revised code:
public Expression field(BlockBuilder list, int index, Type storageType) {
      if (index >= inputSchema.getFieldCount() || index < 0) {
        throw new IllegalArgumentException("Unable to find field 
      }

      final Expression expression = list.append("current", input);
      if (storageType == Object.class) {
        return Expressions.convert_(
            Expressions.call(expression, "getValue", Expressions.constant(index)), Object.class);
      }
      FieldType fromType = inputSchema.getField(index).getType();
      String getter;
      if (fromType.getTypeName().isLogicalType()) {
        getter = logicalTypeGetterMap.get(fromType.getLogicalType().getIdentifier());
      } else {
        getter = typeGetterMap.get(fromType.getTypeName());
      }
      if (getter == null) {
        throw new IllegalArgumentException("Unable to get " + fromType.getTypeName());
      }
      Expression field = Expressions.call(expression, getter, Expressions.constant(index));
      if (fromType.getTypeName().isLogicalType()) {
        Expression millisField = Expressions.call(field, "getMillis");
        String logicalId = fromType.getLogicalType().getIdentifier();
        if (logicalId.equals(TimeType.IDENTIFIER)) {
          field =
              Expressions.condition(
                  Expressions.equal(field, Expressions.constant(null)),
                  Expressions.constant(null),
                  Expressions.box(Expressions.convert_(millisField, int.class)));
        } else if (logicalId.equals(DateType.IDENTIFIER)) {
          field =
              Expressions.condition(
                  Expressions.equal(field, Expressions.constant(null)),
                  Expressions.constant(null),
                  Expressions.box(
                      Expressions.convert_(
                          Expressions.divide(millisField, Expressions.constant(MILLIS_PER_DAY)),
                          int.class)));
        } else if (!logicalId.equals(CharType.IDENTIFIER)) {
          throw new IllegalArgumentException(
              "Unknown LogicalType " + fromType.getLogicalType().getIdentifier());
        }
      } else if (CalciteUtils.isDateTimeType(fromType)) {
        field =
            Expressions.condition(
                Expressions.equal(field, Expressions.constant(null)),
                Expressions.constant(null),
                Expressions.box(Expressions.call(field, "getMillis")));
      } else if (fromType.getTypeName().isCompositeType()
          || (fromType.getTypeName().isCollectionType()
              && fromType.getCollectionElementType().getTypeName().isCompositeType())) {
        field =
            Expressions.condition(
                Expressions.equal(field, Expressions.constant(null)),
                Expressions.constant(null),
                Expressions.call(WrappedList.class, "of", field));
      }
      return field;
    }