How do you format the code part while writing comemnts?
>>Note that in your code above, you need to loop first through the children to find out the common base type of the array. For example, in this example here, the array will end up being a DECIMAL_ARRAY because the common base type of the INTEGER 1 and the DECIMAL 2.2 is a DECIMAL. You can't assume that the first child type will determine the array type.

I got this point.  I have fixed this too.  The piece of code I attached is after doing this check.  
{code}
PDataType arrayElemDataType = children.get(0).getDataType();
        for (int i = 0; i < children.size(); i++) {
            Expression child = children.get(i);
            PDataType childType = child.getDataType();
            if (childType == null) {
                isChildTypeUnknown = true;
            } else if (arrayElemDataType == null) {
                arrayElemDataType = childType;
                isChildTypeUnknown = true;
            } else if (arrayElemDataType == childType || childType.isCoercibleTo(arrayElemDataType)) {
                continue;
            } else if (arrayElemDataType.isCoercibleTo(childType)) {
                arrayElemDataType = childType;
            } else {
                throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_CONVERT_TYPE)
                        .setMessage(
                                "Case expressions must have common type: " + arrayElemDataType + " cannot be coerced to "
                                        + childType).build().buildException();
            }
        }
        // If we found an "unknown" child type and the return type is a number
        // make the return type be the most general number type of DECIMAL.
        if (isChildTypeUnknown && arrayElemDataType != null && arrayElemDataType.isCoercibleTo(PDataType.DECIMAL)) {
            arrayElemDataType = PDataType.DECIMAL;
        }
{code}
SELECT ARRAY[1, 2.2, v] FROM t;
where v could be double, integer anything.