apache/druid · error · UnsupportedOperationException
CharSequence not supported
Error message
CharSequence not supported
What it means
When pulling a local segment, LocalDataSegmentPuller exposes the segment archive as a JavaCompiler FileObject for tools that inspect it. getCharContent is deliberately unimplemented for this FileObject, so any caller requesting the file's character content receives this UnsupportedOperationException.
Source
Thrown at server/src/main/java/org/apache/druid/segment/loading/LocalDataSegmentPuller.java:94
return new FileInputStream(file);
}
@Override
public OutputStream openOutputStream() throws IOException
{
return new FileOutputStream(file);
}
@Override
public Reader openReader(boolean ignoreEncodingErrors) throws IOException
{
return Files.newReader(file, Charset.defaultCharset());
}
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors)
{
throw new UOE("CharSequence not supported");
}
@Override
public Writer openWriter() throws IOException
{
return Files.newWriter(file, Charset.defaultCharset());
}
@Override
public long getLastModified()
{
return file.lastModified();
}
@Override
public boolean delete()
{
return file.delete();View on GitHub (pinned to 9b90983fd2)
Solutions
- Don't call getCharContent on this FileObject; open it as bytes instead (openInputStream) and read the zip binary.
- Copy the file to a regular File and read text from there if a CharSequence is required.
- Guard calls: check the FileObject implementation and fall back to a byte-stream reader.
Example fix
// before
CharSequence text = fileObject.getCharContent(true);
// after
try (InputStream in = fileObject.openInputStream()) {
byte[] data = ByteStreams.toByteArray(in); // read segment as bytes
} Defensive patterns
Strategy: try-catch
Try / catch
try {
CharSequence cs = fileObject.getCharContent(true);
} catch (UnsupportedOperationException e) {
try (InputStream in = fileObject.openInputStream()) {
byte[] bytes = in.readAllBytes(); // handle segment as binary
}
} Prevention
- Treat segment archives as binary; never request text content from FileObjects wrapping zips.
- Read via openInputStream when inspecting pulled segments.
When it happens
Trigger: Calling getCharContent(ignoreEncodingErrors) on the FileObject returned by LocalDataSegmentPuller.get() — typically from tooling or extension code that tries to read the zip as text.
Common situations: Compiler/annotation-processing style tooling (javax.tools.FileObject consumers) applied to segment archives; custom code assuming all FileObjects support text reads.
Related errors
- HDFS Reader not supported
- HDFS CharSequence not supported
- HDFS Writer not supported
- Casting to float type is not supported
- Casting to long type is not supported
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/344eb3f7b22dfa13.
Report an issue: GitHub.