What you are doing here is passing a Piecewise to DifferentialExtension and hoping that it will work, but it doesn't work. To solve this correctly, you'll need to add some flag to DifferentialExtension that is handled by risch_integrate to split the integral into piecewise expressions (note that I say expressions plural because in general an integral can contain multiple exponentials).