gortiz commented on code in PR #11417:
URL: https://github.com/apache/pinot/pull/11417#discussion_r1307657032


##########
pinot-spi/src/main/java/org/apache/pinot/spi/data/Schema.java:
##########
@@ -648,7 +671,7 @@ public Schema build() {
       } catch (Exception e) {
         throw new RuntimeException("Invalid schema", e);
       }
-      return _schema;
+      return new Schema(_schema);

Review Comment:
   This is not completely related, but it was incorrect before. Specifically, 
there are several tests that do something like:
   
   ```java
       TABLE_SCHEMAS.put("a_REALTIME", 
SCHEMA_BUILDER.setSchemaName("a").build());
       TABLE_SCHEMAS.put("b_REALTIME", 
SCHEMA_BUILDER.setSchemaName("b").build());
       TABLE_SCHEMAS.put("c_OFFLINE", 
SCHEMA_BUILDER.setSchemaName("c").build());
       TABLE_SCHEMAS.put("d", SCHEMA_BUILDER.setSchemaName("d").build());
   ```
   
   The above code is from `QueryEnvironmentTestBase`, but there are others that 
do similar things.
   
   I've discovered that after debugging for a while trying to understand why 
table `A` had schema `D` :facepalm: 
   
   We can either apply the shallow copy in another PR or change the affected 
tests



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to