----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/26403/#review56054 -----------------------------------------------------------
Awesome! I have a few changes which I think we should make to make this more supportable. I think we should refactor the code a little. 1) Pass dbops into the constructor of AbstractCommandParser so it's available to the db-specific parsers. 2) Move HiveSchemaTool.buildCommand into AbstractCommandParser. So the AbstractCommandParser is passed the script file and then it returns a String which is the script. 3) AbstractCommandParser should also be passed a connection to the MS HiveSchemaTool.getConnectionToMetastore it can detect which version of the database it's connected to. We should should leave the ending newline on 015-HIVE-5700.postgres.sql. - Brock Noland On Oct. 9, 2014, 12:51 a.m., Mohit Sabharwal wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/26403/ > ----------------------------------------------------------- > > (Updated Oct. 9, 2014, 12:51 a.m.) > > > Review request for hive. > > > Bugs: HIVE-8374 > https://issues.apache.org/jira/browse/HIVE-8374 > > > Repository: hive-git > > > Description > ------- > > HIVE-8374: schematool fails on Postgres versions < 9.2 > > The upgrade script for HIVE-5700 creates an UDF with language 'plpgsql', > which is available by default only for Postgres 9.2+. > > For older Postgres versions, the language must be explicitly created, > otherwise schematool fails. > > This patch allows for running "pre-upgrade" scripts before running a > upgrade script. The errors from pre-upgrade scripts are ignored. > This enables us to run statements like "create language" as a > pre-upgrade step and ignore failures. > > This patch also adds a command line option to schematool to specify > db options. This will be useful for adding future options that > can conditionally execute certain statements. > > > Diffs > ----- > > beeline/src/java/org/apache/hive/beeline/HiveSchemaHelper.java > a21fa652e9c1aa3fd763afa4136f6fcb7c7b7459 > beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java > c376687cb47332323912e4c6dbe713b7b37ae834 > itests/hive-unit/src/test/java/org/apache/hive/beeline/TestSchemaTool.java > 749fb9e86b4f74f768da356cf82f621fdef399cd > metastore/scripts/upgrade/postgres/015-HIVE-5700.postgres.sql > aedb2b5dbf9b513cb7c124f59e05ea9831455a72 > > metastore/scripts/upgrade/postgres/pre-0-upgrade-0.12.0-to-0.13.0.postgres.sql > PRE-CREATION > > metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreSchemaInfo.java > af56ef6a7c6e27ead312a68d30d94802095f2c60 > > Diff: https://reviews.apache.org/r/26403/diff/ > > > Testing > ------- > > Added unit test > > > Thanks, > > Mohit Sabharwal > >