Hi, I am using FileSink with Bulkformat to write p...
# troubleshooting
d
Hi, I am using FileSink with Bulkformat to write parquet files(with Snappy compression) to S3 with custom bucket assigner. I am running the job in Batch mode. I am able to write to the s3 path. But I have a use case to rerun the batch on same days(which create same S3 partitions). The file sink is not able to OVERWRITE the file if the path already present it just adds another part file to the partition. Is there any config we are missing here?
Copy code
FileSink
                .forBulkFormat(new Path(pathToWrite), new ParquetWriterFactory<>(builder))
                .withBucketAssigner(bucketAssigner).build();


AvroParquetWriter.builder(out).withWriteMode(ParquetFileWriter.Mode.OVERWRITE).withCompressionCodec(CompressionCodecName.SNAPPY).withDataModel(dataModel).withSchema(schema).build();


BucketAssigner<ConsoleDlr, String> bucketAssigner = new BucketAssigner<>() {
            @Override
            public String getBucketId(ConsoleDlr element, Context context) {
                return "/wabanumber=" + element.getWabanumber() + "/yr=" + element.getYr() + "/mth=" + element.getMth() + "/day=" + element.getDay();
            }

            @Override
            public SimpleVersionedSerializer<String> getSerializer() {
                return null;
            }
        };
j
I think it is the expected behaviour.. File Sink is kind of append only..
d
Is there any other way we can achieve this using data stream api?
j
using FileSink I dont think.. you will have to write your own sink..
but wait for a awnser of an expert on that sink..