0

I am using avro-tools tojson file.avro to inspect a large Avro file. I am only interested in seeing a few examples, just to get a feeling for the data.

Is there an option for avro-tools tojson that limits the number of rows read?

TTT
  • 6,505
  • 10
  • 56
  • 82

2 Answers2

1

No. That's not possible. See source code here. But it should be easy enough to just add a limit to the code. Or just use head to fake it

moon
  • 1,702
  • 3
  • 19
  • 35
  • Thanks! I'll see if I can add it to avro-tools. – TTT Jul 20 '20 at 07:18
  • This is actually possible @LuckyGuess, the actual class used is `DataFileReadTool` and one can specify `head` :) https://github.com/apache/avro/blob/master/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileReadTool.java#L58. – TTT Jul 22 '20 at 18:09
  • 1
    TIL. Thanks for replying back. – moon Jul 24 '20 at 01:51
1

Yes, there is an option for avro-tools tojson that limits the number of rows read:

avro-tools tojson --head=<n> <filename>
TTT
  • 6,505
  • 10
  • 56
  • 82