class_docstr: Convenient builder to create Parquet BulkWriterFactory instances for Avro types.
  Only GenericRecord is supported at present.
  
  .. versionadded:: 1.16.0
class_docstr_tok: ["Convenient","builder","to","create","Parquet","BulkWriterFactory","instances","for","Avro","types",".","Only","GenericRecord","is","supported","at","present",".","..","versionadded",":",":","1.16.0"]
docstr: Creates a ParquetWriterFactory that accepts and writes Avro generic types. The Parquet
  writers will use the given schema to build and write the columnar data.
  
  Note that to make this works in PyFlink, you need to declare the output type of the
  predecessor before FileSink to be :class:`GenericRecordAvroTypeInfo`, and the predecessor
  cannot be :meth:`StreamExecutionEnvironment.from_collection`, you can add a pass-through map
  function before the sink, as the example shown below.
  
  The Python data records should match the Avro schema, and have the same behavior with
  vanilla Python data structure, e.g. an object for Avro array should behave like Python list,
  an object for Avro map should behave like Python dict.
  
  Example:
  ::
  
      >>> env = StreamExecutionEnvironment.get_execution_environment()
      >>> schema = AvroSchema(JSON_SCHEMA)
      >>> avro_type_info = GenericRecordAvroTypeInfo(schema)
      >>> ds = env.from_collection([{'array': [1, 2]}], type_info=Types.PICKLED_BYTE_ARRAY())
      >>> sink = FileSink.for_bulk_format(
      ...     OUTPUT_DIR, AvroParquetWriters.for_generic_record(schema)).build()
      >>> # A map to indicate its Avro type info is necessary for serialization
      >>> ds.map(lambda e: e, output_type=GenericRecordAvroTypeInfo(schema)) \
      ...     .sink_to(sink)
  
  :param schema: The avro schema.
  :return: The BulkWriterFactory to write generic records into parquet files.
docstr_tok: ["Creates","a","ParquetWriterFactory","that","accepts","and","writes","Avro","generic","types",".","The","Parquet","writers","will","use","the","given","schema","to","build","and","write","the","columnar","data",".","Note","that","to","make","this","works","in","PyFlink",",","you","need","to","declare","the","output","type","of","the","predecessor","before","FileSink","to","be",":","class",":","`","GenericRecordAvroTypeInfo","`",",","and","the","predecessor","can","not","be",":","meth",":","`","StreamExecutionEnvironment.from_collection","`",",","you","can","add","a","pass-through","map","function","before","the","sink",",","as","the","example","shown","below",".","The","Python","data","records","should","match","the","Avro","schema",",","and","have","the","same","behavior","with","vanilla","Python","data","structure",",","e.g",".","an","object","for","Avro","array","should","behave","like","Python","list",",","an","object","for","Avro","map","should","behave","like","Python","dict",".","Example",":",":",":",">",">",">","env","=","StreamExecutionEnvironment.get_execution_environment","(",")",">",">",">","schema","=","AvroSchema","(","JSON_SCHEMA",")",">",">",">","avro_type_info","=","GenericRecordAvroTypeInfo","(","schema",")",">",">",">","ds","=","env.from_collection","(","[","{","'array","'",":","[","1",",","2","]","}","]",",","type_info=Types.PICKLED_BYTE_ARRAY","(",")",")",">",">",">","sink","=","FileSink.for_bulk_format","(","...","OUTPUT_DIR",",","AvroParquetWriters.for_generic_record","(","schema",")",")",".build","(",")",">",">",">","#","A","map","to","indicate","its","Avro","type","info","is","necessary","for","serialization",">",">",">","ds.map","(","lambda","e",":","e",",","output_type=GenericRecordAvroTypeInfo","(","schema",")",")","\\","...",".sink_to","(","sink",")",":","param","schema",":","The","avro","schema",".",":","return",":","The","BulkWriterFactory","to","write","generic","records","into","parquet","files","."]
code: def for_generic_record(schema: "AvroSchema") -> "BulkWriterFactory":
      """
          Creates a ParquetWriterFactory that accepts and writes Avro generic types. The Parquet
          writers will use the given schema to build and write the columnar data.
  
          Note that to make this works in PyFlink, you need to declare the output type of the
          predecessor before FileSink to be :class:`GenericRecordAvroTypeInfo`, and the predecessor
          cannot be :meth:`StreamExecutionEnvironment.from_collection`, you can add a pass-through map
          function before the sink, as the example shown below.
  
          The Python data records should match the Avro schema, and have the same behavior with
          vanilla Python data structure, e.g. an object for Avro array should behave like Python list,
          an object for Avro map should behave like Python dict.
  
          Example:
          ::
  
              >>> env = StreamExecutionEnvironment.get_execution_environment()
              >>> schema = AvroSchema(JSON_SCHEMA)
              >>> avro_type_info = GenericRecordAvroTypeInfo(schema)
              >>> ds = env.from_collection([{'array': [1, 2]}], type_info=Types.PICKLED_BYTE_ARRAY())
              >>> sink = FileSink.for_bulk_format(
              ...     OUTPUT_DIR, AvroParquetWriters.for_generic_record(schema)).build()
              >>> # A map to indicate its Avro type info is necessary for serialization
              >>> ds.map(lambda e: e, output_type=GenericRecordAvroTypeInfo(schema)) \\
              ...     .sink_to(sink)
  
          :param schema: The avro schema.
          :return: The BulkWriterFactory to write generic records into parquet files.
          """
      jvm = get_gateway().jvm
      JAvroParquetWriters = (
          jvm.org.apache.flink.formats.parquet.avro.AvroParquetWriters
      )
      return BulkWriterFactory(
          JAvroParquetWriters.forGenericRecord(schema._j_schema)
      )
  
file_path: flink/flink-python/pyflink/datastream/formats/parquet.py
imports: from typing import Optional, TYPE_CHECKING
  from pyflink.common import Configuration
  from pyflink.common.serialization import BulkWriterFactory, RowDataBulkWriterFactory
  from pyflink.datastream.connectors.file_system import StreamFormat, BulkFormat
  from pyflink.datastream.formats.avro import AvroSchema
  from pyflink.datastream.utils import create_hadoop_configuration
  from pyflink.java_gateway import get_gateway
label_desc: Use image node_id 1 for calling the AvroParquetWriters obj's underlying member method code with example usage: obj.for_generic_record(schema) and returns: BulkWriterFactory