prestodb/presto · error · PrestoException
INVALID_FUNCTION_ARGUMENT
INVALID_FUNCTION_ARGUMENT
Error message
cannot add a double to a q-digest
What it means
Type guard in StatisticalDigest.add (INVALID_FUNCTION_ARGUMENT): a DOUBLE value was added to a q-digest, which only accepts BIGINT (integer) values. The value-type mismatch is detected when the add operation runs on the q-digest implementation.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/StatisticalDigest.java:25
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.operator.aggregation;
import com.facebook.presto.spi.PrestoException;
import io.airlift.slice.Slice;
import static com.facebook.presto.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
public interface StatisticalDigest<T>
{
default void add(double value, long weight)
{
throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "cannot add a double to a q-digest");
}
default void add(long value, long weight)
{
throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "cannot add a long to a t-digest");
}
void merge(StatisticalDigest other);
long estimatedInMemorySizeInBytes();
Slice serialize();
StatisticalDigest<T> getDigest();
double getSize();
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Use qdigest_agg with BIGINT input for q-digests
- Cast the doubles to BIGINT if integer semantics are acceptable
- Use tdigest (tdigest_agg) instead, which natively supports DOUBLE values
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/StatisticalDigest.java:25 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/9775eadedd4a35b0.
Report an issue: GitHub.