10

I have some files on the HDFS, and I try to use command

hadoop fs -text filename | head -10

after exec the command, it always returns the first 10 lines to the terminal, and it's what I want, but it always returns a line "text: Unable to write to output stream." attached to it, I feel very confused about what the attached line means.

kemiya
  • 460
  • 2
  • 5
  • 16

1 Answers1

12

I am assuming you are trying to read a compressed file. Anyhow head closed the stream after it read its limit hence, hadoop throw'ed a warning saying "text: Unable to write to output stream." because head has already closed the stream to which hadoop's text is trying to write to.

Take a look at this related answer as well.

Community
  • 1
  • 1
Ashrith
  • 6,745
  • 2
  • 29
  • 36
  • 1
    so it means that the "text" command is trying to open the whole file and write all lines to the output stream, but the "head" command will just close the output stream when the limit lines are written to the output stream, so the "text" command just have no output stream to write the reset of the data, which causes this warnings, am I right? – kemiya Jan 11 '15 at 11:57