apache/druid · error · ParseException

Error reading column

Error message

Error reading column[%s] as type[%s]

What it means

The expression-based object accessor in RowBasedColumnSelectorFactory converts row values to a target expression type. If conversion throws and throwParseExceptions is enabled, it wraps the failure in a ParseException including the offending value, column name, and target type.

Solutions

  1. Fix or clean the source data so values match the declared column type
  2. Use Cast-to-nullable/TRY_CAST-style handling or disable strict parse behavior where supported (throwParseExceptions=false)
  3. Add input-format parsers/filters during ingestion to reject or transform malformed values
  4. Validate the column's declared expressionType matches the actual row data types

Example fix

// before: strict accessor throwing on bad data
rowBasedFactory.makeColumnValueSelector(columnName)
// after: tolerant conversion with default
Object v = row.getRaw(columnName);
Long parsed = v instanceof Number ? ((Number) v).longValue()
    : NumberUtils.tryParseLong(String.valueOf(v), null);
Defensive patterns

Strategy: try-catch

Validate before calling

Object v = row.getRaw(col);
boolean parseable = v instanceof Number || NumberUtils.isParsable(String.valueOf(v));

Try / catch

try {
  Object o = selector.getObject();
} catch (ParseException e) {
  log.warn(e, "Row value [%s] not parseable as column [%s]", e.getErrorMessage(), columnName);
}

Prevention

When it happens

Trigger: Calling getObject(columnName) where the row value cannot be coerced to the declared expression type (e.g. string 'abc' read as LONG/DOUBLE) and throwParseExceptions is true.

Common situations: Ingesting dirty data (non-numeric strings into numeric columns); schema drift between rows; SQL queries casting columns to mismatched types over row-based data.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/1ea060c53711634f. Report an issue: GitHub.

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/segment/RowBasedColumnSelectorFactory.java:538

        @Nullable
        @Override
        public Object getObject()
        {
          updateCurrentValue();

          if (expressionType != null && !expressionType.is(ExprType.COMPLEX)) {
            try {
              final Object val = ExprEval.bestEffortOf(currentValue).castTo(expressionType).value();
              if (val != null && expressionType.is(ExprType.DOUBLE) && numberType == ValueType.FLOAT) {
                // Adjustment for FLOAT. Expressions don't speak float, so we need to cast it ourselves.
                return ((Number) val).floatValue();
              } else {
                return val;
              }
            }
            catch (Exception e) {
              if (throwParseExceptions) {
                throw new ParseException(
                    String.valueOf(currentValue),
                    "Error reading column[%s] as type[%s]",
                    columnName,
                    expressionType
                );
              } else {
                // if !throwParseExceptions, return the original uncasted value and hope for the best.
                return currentValue;
              }
            }
          } else {
            return currentValue;
          }
        }

        @Override
        public Class<Object> classOfObject()
        {

View on GitHub (pinned to 9b90983fd2)