Created
August 26, 2022 23:50
-
-
Save a2l007/3d813cc5e44c45100dda169dc6245ae4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.apache.parquet.hadoop; | |
import org.apache.hadoop.conf.Configuration; | |
import org.apache.hadoop.fs.Path; | |
import org.apache.parquet.example.data.Group; | |
import org.apache.parquet.hadoop.example.GroupReadSupport; | |
import org.junit.Assert; | |
import org.junit.Test; | |
import java.io.IOException; | |
public class TestEncryptionWithBuilder | |
{ | |
@Test | |
public void testThis() throws IOException | |
{ | |
Configuration conf = new Configuration(); | |
conf.setClassLoader(getClass().getClassLoader()); | |
conf.set("parquet.crypto.factory.class", "org.custom.CustomCryptoFactory"); | |
conf.set("parquet.encryption.kms.client.class", "org.custom.CustomKmsBridge"); | |
conf.set("parquet.encryption.key.file", "/path/to/master_keys_v0"); | |
ParquetReader<Group> builderReader = ParquetReader.builder( | |
new GroupReadSupport(), | |
new Path( | |
"path/to/c000.snappy.parquet")) | |
.withConf(conf) | |
.build(); | |
ParquetReader<Group> deprecatedReader = new ParquetReader<>(conf, new Path( | |
"path/to/c000.snappy.parquet"), new GroupReadSupport()); | |
//throws Nullpointer exception | |
Group builderValue = builderReader.read(); | |
//works fine | |
Group deprecatedValue = deprecatedReader.read(); | |
Assert.assertTrue(builderValue != null); | |
Assert.assertTrue(deprecatedValue != null); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment