...
- Don't make any changes to
hive_metastore.thrift
until instructed below. - Use the approved version of Thrift. This is currently
thrift-0.14.1
, which you can obtain from http://thrift.apache.org/.For Mac via Homebrew (since the version we need is not available by default):
Code Block language bash brew tap-new $USER/local-tap brew extract --version='0.14.1' thrift $USER/local-tap brew install thrift@0.14.1 mkdir -p /usr/local/share/fb303/if cp /usr/local/Cellar/thrift@0.14.1/0.14.1/share/fb303/if/fb303.thrift /usr/local/share/fb303/if
For Mac, building from sources:
Code Block language bash wget http://archive.apache.org/dist/thrift/0.14.1/thrift-0.14.1.tar.gz tar xzf thrift-0.14.1.tar.gz #If configure fails with "syntax error near unexpected token `QT5", then run "brew install pkg-config" ./bootstrap.sh sudo ./configure --with-openssl=/usr/local/Cellar/openssl@1.1/1.1.1j --without-erlang --without-nodejs --without-python --without-py3 --without-perl --without-php --without-php_extension --without-ruby --without-haskell --without-go --without-swift --without-dotnetcore --without-qt5 brew install openssl sudo ln -s /usr/local/opt/openssl/include/openssl/ /usr/local/include/ sudo make sudo make install mkdir -p /usr/local/share/fb303/if cp path/to/thrift-0.14.1/contrib/fb303/if/fb303.thrift /usr/local/share/fb303/if/fb303.thrift # or alternatively the following command curl -o /usr/local/share/fb303/if/fb303.thrift https://raw.githubusercontent.com/apache/thrift/master/contrib/fb303/if/fb303.thrift
For Linux:
Code Block language bash cd /path/to/thrift-0.14.1 /configure -without-erlang --without-nodejs --without-python --without-py3 --without-perl --without-php --without-php_extension --without-ruby --without-haskell --without-go --without-swift --without-dotnetcore --without-qt5 sudo make sudo make install mkdir -p /usr/local/share/fb303/if cp /path/to/thrift-0.14.1/contrib/fb303/if/fb303.thrift /usr/local/share/fb303/if/fb303.thrift
Before proceeding, verify that
which thrift
returns the build of Thrift you just installed (typically/usr/local/bin
on Linux); if not, edit your PATH and repeat the verification. Also verify that the command 'thrift -version' returns the expected version number of Thrift.- Now you can run the Maven 'thriftif' profile to generate the Thrift code:
cd /path/to/hive/
mvn clean install -Pthriftif -DskipTests -Dthrift.home=/usr/local
- Verify that the code generation was a no-op, which should be the case if you have the correct Thrift version and everyone has been following these instructions. You may use
git status
for the same. If you can't figure out what is going wrong, ask for help from a committer. - Now make your changes to
hive_metastore.thrift
, and then run the compiler again, from /path/to/hive/<hive_metastore.thrift's module>:mvn clean install -Pthriftif -DskipTests -Dthrift.home=/usr/local
- Now use
git status and git diff
to verify that the regenerated code corresponds only to the changes you made tohive_metastore.thrift
. You may also needgit add
if new files were generated (and orgit rm
if some files are now obsoleted). cd /path/to/hive
mvn clean package -DskiptTests (at the time of writing also "-Dmaven.javadoc.skip" is needed)
- Verify that Hive is still working correctly with both embedded and remote metastore configurations.
...