Trying to create a AvroParquetReader for a parquet file reading in blockBlob in azure storageaccount, but getting an error – Caused by: java.lang.RuntimeException: InputBuffer@7a70b9e9 is not a Parquet file. Expected magic number at tail, but found [0, 0, 0, 0]
public void parquetReader(){
BlobServiceClient blobServiceClient =
new BlobServiceClientBuilder()
.endpoint("https://" + storageAccountName + ".blob.core.windows.net/")
.credential(new StorageSharedKeyCredential(storageAccountName, blobKey))
.connectionString(storageAccountConnectionString)
.buildClient();
BlobContainerClient blobContainerClient =
blobServiceClient.getBlobContainerClient(containerName);
String path = "data/first/test.parquet"
BlockBlobClient blockBlobClient = blobContainerClient.getBlobClient(path).getBlockBlobClient();
InputBuffer inputBuffer =
InputBuffer.create(
blockBlobClient.openInputStream(), Math.toIntExact(blockBlobClient.getProperties().getBlobSize()));
ParquetReader<GenericRecord> reader = AvroParquetReader.<GenericRecord>builder(inputBuffer).build(); // getting error here
}
How to resolve the error?