def test_xlang_parquetio_write(self): expansion_jar = os.environ.get('EXPANSION_JAR') port = os.environ.get('EXPANSION_PORT') address = 'localhost:%s' % port try: with TestPipeline() as p: p.get_pipeline_options().view_as( DebugOptions).experiments.append('jar_packages=' + expansion_jar) p.not_use_test_runner_api = True _ = p \ | beam.Create([ AvroRecord({"name": "abc"}), AvroRecord({"name": "def"}), AvroRecord({"name": "ghi"})]) \ | beam.ExternalTransform( PARQUET_WRITE_URN, ImplicitSchemaPayloadBuilder({'data': u'/tmp/test.parquet'}), address) except RuntimeError as e: if re.search(PARQUET_WRITE_URN, str(e)): print( "looks like URN not implemented in expansion service, skipping." ) else: raise e
def decode(self, encoded): with BytesIO(encoded) as buf: return AvroRecord(schemaless_reader(buf, self.parsed_schema))