prestodb/presto · error · PrestoException

DECODER_CONVERSION_NOT_SUPPORTED

DECODER_CONVERSION_NOT_SUPPORTED

Error message

conversion to boolean not supported

What it means

FieldValueProvider is the abstract base class for record-decoder column value providers. Its primitive accessors are deliberately non-abstract and throw DECODER_CONVERSION_NOT_SUPPORTED by default; subclasses override only the types their row format can actually produce. getBoolean() throws this when the concrete provider does not support boolean conversion, i.e. the decoded value is being read as a boolean by a provider that never implemented getBoolean().

Source

Thrown at presto-record-decoder/src/main/java/com/facebook/presto/decoder/FieldValueProvider.java:27

 * 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.decoder;

import com.facebook.presto.common.block.Block;
import com.facebook.presto.spi.PrestoException;
import io.airlift.slice.Slice;

/**
 * Base class for all providers that return values for a selected column.
 */
public abstract class FieldValueProvider
{
    public boolean getBoolean()
    {
        throw new PrestoException(DecoderErrorCode.DECODER_CONVERSION_NOT_SUPPORTED, "conversion to boolean not supported");
    }

    public long getLong()
    {
        throw new PrestoException(DecoderErrorCode.DECODER_CONVERSION_NOT_SUPPORTED, "conversion to long not supported");
    }

    public double getDouble()
    {
        throw new PrestoException(DecoderErrorCode.DECODER_CONVERSION_NOT_SUPPORTED, "conversion to double not supported");
    }

    public Slice getSlice()
    {
        throw new PrestoException(DecoderErrorCode.DECODER_CONVERSION_NOT_SUPPORTED, "conversion to Slice not supported");
    }

    public Block getBlock()

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Change the table/column type to match what the decoder actually produces (e.g. VARCHAR instead of BOOLEAN), or
  2. Write/choose a FieldValueProvider subclass that overrides getBoolean() (or a ColumnDecoder that maps the raw value to boolean), or
  3. Fix the row-format mapping so the field is decoded with a boolean-capable decoder before being accessed.
  4. Wrap access in isNull()/type checks so getBoolean() is only called on providers known to support booleans.

Example fix

// before: schema maps a JSON string field to BOOLEAN -> getBoolean() throws
// after: decode with a boolean-capable provider
public class BooleanJsonFieldValueProvider extends JsonFieldValueProvider {
    @Override
    public boolean getBoolean()
    {
        return Boolean.parseBoolean(value.toStringUtf8());
    }
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (provider.isNull()) { handleNull(); } else { // only call getBoolean() if the provider/decoder for this column is boolean-capable
    boolean v = provider.getBoolean(); }

Type guard

static boolean supportsBoolean(FieldValueProvider p) {
    try { p.getBoolean(); return true; }
    catch (PrestoException e) {
        return e.getErrorCode().getCode() != DecoderErrorCode.DECODER_CONVERSION_NOT_SUPPORTED.toErrorCode().getCode();
    }
}

Try / catch

try {
    boolean value = provider.getBoolean();
}
catch (PrestoException e) {
    if (e.getErrorCode().getCode() == DecoderErrorCode.DECODER_CONVERSION_NOT_SUPPORTED.toErrorCode().getCode()) {
        // fall back: treat as unsupported column type, skip or log schema mismatch
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling getBoolean() on a FieldValueProvider subclass that did not override getBoolean() — typically when a column decoder (e.g. for JSON/CSV/Avro fields) produced a non-boolean value and downstream code (a RowDecoder path, combine, compareAndUpdateState, write, or serialize) requests it as a boolean.

Common situations: Mapping a Kafka/JSON/CSV column to a BOOLEAN Presto column while the decoder emits strings or numbers; a decoder subclass only overrides getLong()/getSlice() but the table schema declares the column as BOOLEAN; schema changes where a column type was switched to boolean without updating the decoder.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/347b9c542013e978. Report an issue: GitHub.