prestodb/presto · error · IllegalArgumentException
escape not implemented
Error message
escape not implemented
What it means
Text StringEncoding writes values verbatim and only knows how to handle the field delimiter; if an escape byte is configured and the value contains the escape character, escaping is not implemented, so encodeColumn throws IllegalArgumentException rather than producing ambiguous output.
Source
Thrown at presto-rcfile/src/main/java/com/facebook/presto/rcfile/text/StringEncoding.java:51
public StringEncoding(Type type, Slice nullSequence, Byte escapeChar)
{
this.type = type;
this.nullSequence = nullSequence;
this.escapeByte = escapeChar;
}
@Override
public void encodeColumn(Block block, SliceOutput output, EncodeOutput encodeOutput)
{
for (int position = 0; position < block.getPositionCount(); position++) {
if (block.isNull(position)) {
output.writeBytes(nullSequence);
}
else {
Slice slice = type.getSlice(block, position);
if (escapeByte != null && slice.indexOfByte(escapeByte) < 0) {
throw new IllegalArgumentException("escape not implemented");
}
output.writeBytes(slice);
}
encodeOutput.closeEntry();
}
}
@Override
public void encodeValueInto(int depth, Block block, int position, SliceOutput output)
{
Slice slice = type.getSlice(block, position);
if (escapeByte != null && slice.indexOfByte(escapeByte) < 0) {
throw new IllegalArgumentException("escape not implemented");
}
output.writeBytes(slice);
}
@OverrideView on GitHub (pinned to 55bb57d202)
Solutions
- Remove the escape character from the table definition (use a format without escaping)
- Pre-process data to strip or replace occurrences of the escape byte before writing
- Switch the table to ORC/Parquet or a text format with proper escape support
- Catch IllegalArgumentException and reject/sanitize the offending rows
Example fix
// before CREATE TABLE t (s varchar) WITH (format='RCFILE', text_escape='\\'); // after CREATE TABLE t (s varchar) WITH (format='RCFILE'); -- escape removed, or sanitize s first
Defensive patterns
Strategy: validation
Validate before calling
// before writing a varchar column when escape is configured
Slice slice = type.getSlice(block, position);
if (escapeByte != null && slice.indexOfByte(escapeByte) >= 0) {
// sanitize: strip/replace escape byte, or choose a different format
slice = replaceByte(slice, escapeByte, (byte) ' ');
} Try / catch
try { stringEncoding.encodeColumn(block, output, encodeOutput); }
catch (IllegalArgumentException e) {
if (e.getMessage().equals("escape not implemented")) {
encodeColumn(sanitize(block, escapeByte), output, encodeOutput); // strip escape and retry
} else { throw e; }
} Prevention
- Avoid configuring escape characters on RCFile text tables containing free text
- Strip or escape-encode values in ETL before writing
- Use ORC/Parquet for arbitrary text data
- Document table escape settings so writers know the constraint
When it happens
Trigger: encodeColumn on a VARCHAR column where escapeByte != null and the slice contains that escape byte — e.g. writing data containing '\' (or the configured escape) to a text RCFile with escaping enabled.
Common situations: Tables defined with an escape character (like TSV/CSV-style escaping) receiving user data containing that character; ETL jobs migrating free-text data into escaped RCFile tables.
Related errors
- HIVE_WRITER_CLOSE_ERROR
- HIVE_WRITER_OPEN_ERROR
- Invalid double value
- Invalid float value
- GENERIC_INTERNAL_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/f4b9176de677d273.
Report an issue: GitHub.