| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 
 | public void read1(){ParquetMetadata readFooter = ParquetFileReader.readFooter(fs.getConf(), path, ParquetMetadataConverter.NO_FILTER);
 MessageType schema = readFooter.getFileMetaData().getSchema();
 List<type> columnInfos = schema.getFields();
 ParquetReader<group> reader = ParquetReader.builder(new GroupReadSupport(), path).
 withConf(fs.getConf()).build();
 int count = 0;
 Group recordData = reader.read();
 
 while (count < 10 && recordData != null) {
 int last = columnInfos.size() - 1;
 StringBuilder builder = new StringBuilder();
 builder.append("{\"");
 for (int j = 0; j < columnInfos.size(); j++) {
 if (j < columnInfos.size() - 1) {
 String columnName = columnInfos.get(j).getName();
 String value = recordData.getValueToString(j, 0);
 builder.append(columnName + "\":\"" + value + "\",");
 }
 }
 String columnName = columnInfos.get(last).getName();
 String value = recordData.getValueToString(last, 0);
 
 System.out.println(builder.toString());
 count++;
 recordData = reader.read();
 }
 
 } catch (Exception e) {
 }
 }
 
 |