This is a regression caused by the refactoring in 1.20.0.
When terms has only 1 element, it will throw an exception. We discovered the issue when trying to upgrade Calcite.
We can't assume the terms always has more than 1 element. Although this method is deprecated, I think we need to correct the regression. Maybe we don't need a test case, given it is a deprecated method.