Teiid uses the real/double type for the result of avg on an integral type. However you may not be expecting this as it goes against the SQL spec. My guess would be that it was done this way to avoid using a result type of decimal/bigdecimal. I'll log an issue about this descrepancy. The workaround would be to use a cast to the desired type.