thomasrebele commented on code in PR #6825:
URL: https://github.com/apache/hive/pull/6825#discussion_r4217281891


##########
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/dbinstall/rules/PostgresTPCDS.java:
##########
@@ -57,6 +70,12 @@ public void install() {
     String hiveSchemaVer = MetaStoreSchemaInfoFactory.get(new 
Configuration()).getHiveSchemaVersion();
     try (InputStream script = PostgresTPCDS.class.getClassLoader()
         .getResourceAsStream("sql/postgres/upgrade-3.1.3000-to-" + 
hiveSchemaVer + ".postgres.sql")) {
+      // The dump was created from a metastore where some columns had the 
wrong types.
+      // Fix those that some tests verify.
+      String fixColumnTypes =
+          "UPDATE \"COLUMNS_V2\" c SET \"TYPE_NAME\" = 'char(16)' WHERE 
\"COLUMN_NAME\" in ('c_customer_id', 'ca_address_id')" + "AND EXISTS (SELECT * 
FROM \"SDS\" s WHERE s.\"CD_ID\" = c.\"CD_ID\");\n";
+      InputStream script2 =
+          new SequenceInputStream(new 
ByteArrayInputStream(fixColumnTypes.getBytes(StandardCharsets.UTF_8)), script);

Review Comment:
   I think the use case of looking at the history of the file is quite rare and 
can be done with looking at all the sql files in the dir. e.g., `gitk 
'standalone-metastore/metastore-server/src/test/resources/sql/postgres/*.postgres.sql'`.
 There are tools to show the history with renames, e.g., Intellij's git plugin 
follows the rename successfully.
   
   Changing the file name would make its intent much clearer. When removing 
some SQL commands from the file I had doubts whether it would be ok, as I 
wasn't sure that the file wasn't used somewhere else for a different purpose. 
We could use a name like 
`migrate-tpcds-metastore-30tb-1.0.zstd-to-...postgres.sql`, allowing to switch 
between different dumps more easily, assuming that we avoid conflicting dump 
filenames.



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