Skip to content

Commit

Permalink
Add ColumnPath.toList
Browse files Browse the repository at this point in the history
Similar to `ColumnPath.toArray`, but avoids copying the path.
  • Loading branch information
findepi committed Jun 22, 2024
1 parent b30c4f4 commit 4e5bc8c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;

public final class ColumnPath implements Iterable<String>, Serializable {
Expand Down Expand Up @@ -86,4 +88,8 @@ public int size() {
public String[] toArray() {
return p.clone();
}

public List<String> toList() {
return Collections.unmodifiableList(Arrays.asList(p));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class InternalColumnEncryptionSetup {
if (encryptionProperties.isEncryptedWithFooterKey()) {
columnCryptoMetaData = ColumnCryptoMetaData.ENCRYPTION_WITH_FOOTER_KEY(new EncryptionWithFooterKey());
} else {
EncryptionWithColumnKey withColumnKeyStruct = new EncryptionWithColumnKey(Arrays.asList(encryptionProperties.getPath().toArray()));
EncryptionWithColumnKey withColumnKeyStruct = new EncryptionWithColumnKey(encryptionProperties.getPath().toList());
if (null != encryptionProperties.getKeyMetaData()) {
withColumnKeyStruct.setKey_metadata(encryptionProperties.getKeyMetaData());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ private void addRowGroup(ParquetMetadata parquetMetadata, List<RowGroup> rowGrou
ColumnMetaData metaData = new ColumnMetaData(
getType(columnMetaData.getType()),
toFormatEncodings(columnMetaData.getEncodings()),
Arrays.asList(columnMetaData.getPath().toArray()),
columnMetaData.getPath().toList(),
toFormatCodec(columnMetaData.getCodec()),
columnMetaData.getValueCount(),
columnMetaData.getTotalUncompressedSize(),
Expand Down

0 comments on commit 4e5bc8c

Please sign in to comment.