private @Nullable RelDataType deriveDecimalRelDataType(
      RelDataTypeFactory typeFactory,
      RelDataType type1,
      RelDataType type2,
      QuadFunction<Integer, Integer, Integer, Integer, RelDataType> deriveImpl) {
    if (canDeriveDecimal(type1, type2)) {
      RelDataType decType1 = adjustType(typeFactory, type1);
      RelDataType decType2 = adjustType(typeFactory, type2);
      return deriveImpl.apply(
          decType1.getPrecision(),
          decType1.getScale(),
          decType2.getPrecision(),
          decType2.getScale());
    } else {
      return null;
    }
  }
Use derivation from {@link LogicalTypeMerging} to derive decimal type.
amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/planner/calcite/FlinkTypeSystem.java