@@ -608,7 +608,6 @@ private void addRowGroup(
608608 ColumnMetaData metaData = new ColumnMetaData (
609609 getType (columnMetaData .getType ()),
610610 toFormatEncodings (columnMetaData .getEncodings ()),
611- columnMetaData .getPath ().toList (),
612611 toFormatCodec (columnMetaData .getCodec ()),
613612 columnMetaData .getValueCount (),
614613 columnMetaData .getTotalUncompressedSize (),
@@ -619,6 +618,9 @@ private void addRowGroup(
619618 || columnMetaData .hasDictionaryPage ()) {
620619 metaData .setDictionary_page_offset (columnMetaData .getDictionaryPageOffset ());
621620 }
621+ if (path != null ) {
622+ metaData .setPath_in_schema (path .toList ());
623+ }
622624 long bloomFilterOffset = columnMetaData .getBloomFilterOffset ();
623625 if (bloomFilterOffset >= 0 ) {
624626 metaData .setBloom_filter_offset (bloomFilterOffset );
@@ -1830,6 +1832,9 @@ public ParquetMetadata fromParquetMetadata(
18301832 List <BlockMetaData > blocks = new ArrayList <BlockMetaData >();
18311833 List <RowGroup > row_groups = parquetMetadata .getRow_groups ();
18321834
1835+ // needed to create path_in_schema for leaf columns
1836+ List <String []> col_paths = messageType .getPaths ();
1837+
18331838 if (row_groups != null ) {
18341839 for (RowGroup rowGroup : row_groups ) {
18351840 BlockMetaData blockMetaData = new BlockMetaData ();
@@ -1859,7 +1864,7 @@ public ParquetMetadata fromParquetMetadata(
18591864 boolean lazyMetadataDecryption = false ;
18601865
18611866 if (null == cryptoMetaData ) { // Plaintext column
1862- columnPath = getPath ( metaData );
1867+ columnPath = ColumnPath . get ( col_paths . get ( columnOrdinal ) );
18631868 if (null != fileDecryptor && !fileDecryptor .plaintextFile ()) {
18641869 // mark this column as plaintext in encrypted file decryptor
18651870 fileDecryptor .setColumnCryptoMetadata (
@@ -1876,7 +1881,7 @@ public ParquetMetadata fromParquetMetadata(
18761881 throw new ParquetCryptoRuntimeException (
18771882 "ColumnMetaData not set in Encryption with Footer key" );
18781883 }
1879- columnPath = getPath ( metaData );
1884+ columnPath = ColumnPath . get ( col_paths . get ( columnOrdinal ) );
18801885 if (!encryptedFooter ) { // Unencrypted footer. Decrypt full column metadata, using footer
18811886 // key
18821887 ByteArrayInputStream tempInputStream =
@@ -1983,11 +1988,6 @@ private static IndexReference toOffsetIndexReference(ColumnChunk columnChunk) {
19831988 return null ;
19841989 }
19851990
1986- private static ColumnPath getPath (ColumnMetaData metaData ) {
1987- String [] path = metaData .path_in_schema .toArray (new String [0 ]);
1988- return ColumnPath .get (path );
1989- }
1990-
19911991 // Visible for testing
19921992 MessageType fromParquetSchema (List <SchemaElement > schema , List <ColumnOrder > columnOrders ) {
19931993 Iterator <SchemaElement > iterator = schema .iterator ();
0 commit comments