apache/druid · error · UOE
HDFS Writer not supported
Error message
HDFS Writer not supported
What it means
The HDFS FileObject's openWriter() throws UOE("HDFS Writer not supported"): character/Writer-based output to HDFS is deliberately not implemented in this FileObject adapter. Writes must go through openOutputStream(), which returns a real OutputStream backed by FileSystem.create. The exception is thrown unconditionally whenever openWriter is invoked.
Source
Thrown at extensions-core/hdfs-storage/src/main/java/org/apache/druid/storage/hdfs/HdfsDataSegmentPuller.java:152
return fs.create(path, overwrite);
}
@Override
public Reader openReader(boolean ignoreEncodingErrors)
{
throw new UOE("HDFS Reader not supported");
}
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors)
{
throw new UOE("HDFS CharSequence not supported");
}
@Override
public Writer openWriter()
{
throw new UOE("HDFS Writer not supported");
}
@Override
public long getLastModified()
{
try {
final FileSystem fs = path.getFileSystem(config);
return fs.getFileStatus(path).getModificationTime();
}
catch (IOException ex) {
throw new HdfsIOException(ex);
}
}
@Override
public boolean delete()
{
try {View on GitHub (pinned to 9b90983fd2)
Solutions
- Use openOutputStream() and wrap it in an OutputStreamWriter/PrintWriter if character writing is needed.
- Keep byte-level writes for HDFS targets; reserve Writer-based APIs for local or HTTP pullers.
- Branch on URI scheme before writing and route hdfs:// to the OutputStream API.
Example fix
// before
try (Writer w = fileObject.openWriter()) { w.write(json); }
// after
try (Writer w = new OutputStreamWriter(fileObject.openOutputStream(), StandardCharsets.UTF_8)) { w.write(json); } Defensive patterns
Strategy: type-guard
Validate before calling
if ("hdfs".equalsIgnoreCase(uri.getScheme())) { writeViaOutputStream(uri, data); } Type guard
boolean supportsWriter(FileObject fo) { return !isHdfsFileObject(fo); } Try / catch
try (Writer w = fo.openWriter()) { w.write(s); }
catch (UOE e) { try (Writer w = new OutputStreamWriter(fo.openOutputStream(), UTF_8)) { w.write(s); } } Prevention
- Use openOutputStream (optionally wrapped in OutputStreamWriter) for all HDFS writes.
- Pass the desired overwrite flag to buildFileObject so stream creation behaves as expected.
When it happens
Trigger: Invoking openWriter() on the FileObject from HdfsDataSegmentPuller.buildFileObject(uri, config, overwrite) — e.g. code that writes text artifacts (logs, descriptors) via the generic FileObject Writer API against hdfs:// URIs.
Common situations: Porting local-disk writing code to HDFS deep storage; utility libraries that take a FileObject and prefer openWriter for character output.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- HDFS Reader not supported
- HDFS CharSequence not supported
- CharSequence 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/1cc0b463f65e2392.
Report an issue: GitHub.