diff --git a/flink-python/dev/dev-requirements.txt b/flink-python/dev/dev-requirements.txt index 63649ab7e98d4..8c1eb18ffa5ca 100755 --- a/flink-python/dev/dev-requirements.txt +++ b/flink-python/dev/dev-requirements.txt @@ -20,7 +20,7 @@ cython>=0.29.24 py4j==0.10.9.7 python-dateutil>=2.8.0,<3 cloudpickle~=2.2.0 -avro-python3>=1.8.1,!=1.9.2 +avro>=1.12.0 pandas>=1.3.0 pyarrow>=5.0.0 pytz>=2018.3 diff --git a/flink-python/pyflink/fn_execution/formats/avro.py b/flink-python/pyflink/fn_execution/formats/avro.py index db8a9da3e7bd8..5c291304797f6 100644 --- a/flink-python/pyflink/fn_execution/formats/avro.py +++ b/flink-python/pyflink/fn_execution/formats/avro.py @@ -17,14 +17,13 @@ ################################################################################ import struct +from avro.errors import AvroTypeException, SchemaResolutionException from avro.io import ( - AvroTypeException, BinaryDecoder, BinaryEncoder, DatumReader, DatumWriter, - SchemaResolutionException, - Validate, + validate, ) STRUCT_FLOAT = struct.Struct('>f') # big-endian float @@ -203,7 +202,7 @@ def write_bytes(self, datum): class FlinkAvroDatumWriter(DatumWriter): def __init__(self, writer_schema=None): - super().__init__(writer_schema=writer_schema) + super().__init__(writers_schema=writer_schema) def write_array(self, writer_schema, datum, encoder): if len(datum) > 0: @@ -224,7 +223,7 @@ def write_union(self, writer_schema, datum, encoder): # resolve union index_of_schema = -1 for i, candidate_schema in enumerate(writer_schema.schemas): - if Validate(candidate_schema, datum): + if validate(candidate_schema, datum): index_of_schema = i if index_of_schema < 0: raise AvroTypeException(writer_schema, datum) diff --git a/flink-python/setup.py b/flink-python/setup.py index 119f6ba4585df..2703f8d931cd4 100644 --- a/flink-python/setup.py +++ b/flink-python/setup.py @@ -318,7 +318,7 @@ def extracted_output_files(base_dir, file_path, output_directory): install_requires = ['py4j==0.10.9.7', 'python-dateutil>=2.8.0,<3', 'apache-beam>=2.54.0,<=2.61.0', - 'cloudpickle>=2.2.0', 'avro-python3>=1.8.1,!=1.9.2', + 'cloudpickle>=2.2.0', 'avro>=1.12.0', 'pytz>=2018.3', 'fastavro>=1.1.0,!=1.8.0', 'requests>=2.26.0', 'protobuf>=3.19.0', 'numpy>=1.22.4',