damccorm opened a new issue, #21174:
URL: https://github.com/apache/beam/issues/21174

   Found this bug while testing Select operator that FieldName gets ignored by 
Passert here, this code passes
   
   beam version 2.26.0.8
   
   ```
   ```
   
   
   private static final Schema APP_SCHEMA = Schema.builder()
       .addInt32Field("appId")
       .addStringField("description")
   
      .addFloatField("rating")
       .build();
   
   @Test
   public void testProjectOperator(){
   PCollection<Row>
   projectedOutput = generateTestRow(pipeline).apply(Select.fieldNames("appId", 
"description"));
   
   
   //
   Modified schema with renamed field
   Schema modifiedSchema = Schema.builder()
       .addInt32Field("appId")
   
      .addStringField("randomName")// this should ideally break
       .build();
   
   PAssert.that(projectedOutput).containsInAnyOrder(
   
      Row.withSchema(modifiedSchema).addValues(-8, "Invalid").build(),
       Row.withSchema(modifiedSchema).addValues(0,
   "Invalid").build(),
       Row.withSchema(modifiedSchema).addValues(1, "Recruiter").build(),
       Row.withSchema(modifiedSchema).addValues(2,
   "Hirein").build(),
       Row.withSchema(modifiedSchema).addValues(1, "Workplace").build()
   );
   
   pipeline.run().waitUntilFinish();
   }
   
   
   public
   static PCollection<Row> generateTestRow(Pipeline pipeline) {
     // Create a concrete row with that type.
   
    return PBegin
             .in(pipeline)
             .apply(Create.of(
                 Row.withSchema(APP_SCHEMA).addValues(-8,
   "Invalid", 0f).build(),
                 Row.withSchema(APP_SCHEMA).addValues(0, "Invalid", 
-1.1f).build(),
   
                Row.withSchema(APP_SCHEMA).addValues(1, "Recruiter", 
4.2f).build(),
                 Row.withSchema(APP_SCHEMA).addValues(2,
   "Hirein", 3.5f).build(),
                 Row.withSchema(APP_SCHEMA).addValues(1, "Workplace", 
3f).build())
   
            .withCoder(RowCoder.of(APP_SCHEMA)));
   }
   ```
   
    
   
    
   
   Imported from Jira 
[BEAM-12921](https://issues.apache.org/jira/browse/BEAM-12921). Original Jira 
may contain additional context.
   Reported by: saniljain15.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to