Author: khorgath Date: Thu May 1 00:57:57 2014 New Revision: 1591522 URL: http://svn.apache.org/r1591522 Log: HIVE-6982 : Export all .sh equivalent for windows (.cmd files) in bin, bin/ext (Hari Sankar Sivarama Subramaniyan via Sushanth Sowmyan)
Added: hive/trunk/bin/beeline.cmd hive/trunk/bin/derbyserver.cmd hive/trunk/bin/ext/cli.cmd hive/trunk/bin/ext/debug.cmd hive/trunk/bin/ext/help.cmd hive/trunk/bin/ext/hiveserver.cmd hive/trunk/bin/ext/hiveserver2.cmd hive/trunk/bin/ext/hwi.cmd hive/trunk/bin/ext/jar.cmd hive/trunk/bin/ext/lineage.cmd hive/trunk/bin/ext/metastore.cmd hive/trunk/bin/ext/rcfilecat.cmd hive/trunk/bin/ext/schemaTool.cmd hive/trunk/bin/ext/util/execHiveCmd.cmd hive/trunk/bin/hive-config.cmd hive/trunk/bin/hive.cmd Added: hive/trunk/bin/beeline.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/beeline.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/beeline.cmd (added) +++ hive/trunk/bin/beeline.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,50 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +SetLocal EnableDelayedExpansion + +pushd %CD%\.. +if not defined HIVE_HOME ( + set HIVE_HOME=%CD% +) +popd + +if "%HADOOP_BIN_PATH:~-1%" == "\" ( + set HADOOP_BIN_PATH=%HADOOP_BIN_PATH:~0,-1% +) + +if not defined JAVA_HOME ( + echo Error: JAVA_HOME is not set. + goto :eof +) + +@rem get the hadoop envrionment +if not exist %HADOOP_HOME%\libexec\hadoop-config.cmd ( + @echo +================================================================+ + @echo ^| Error: HADOOP_HOME is not set correctly ^| + @echo +----------------------------------------------------------------+ + @echo ^| Please set your HADOOP_HOME variable to the absolute path of ^| + @echo ^| the directory that contains \libexec\hadoop-config.cmd ^| + @echo +================================================================+ + exit /b 1 +) +@rem supress the HADOOP_HOME warnings in 1.x.x +set HADOOP_HOME_WARN_SUPPRESS=true +call %HADOOP_HOME%\libexec\hadoop-config.cmd +set CLASSPATH=%CLASSPATH%;%HIVE_HOME%\lib\*; + +call %JAVA_HOME%\bin\java %JAVA_HEAP_MAX% %HADOOP_OPTS% -classpath %CLASSPATH% org.apache.hive.beeline.BeeLine %* + +endlocal Added: hive/trunk/bin/derbyserver.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/derbyserver.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/derbyserver.cmd (added) +++ hive/trunk/bin/derbyserver.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,60 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +setlocal enabledelayedexpansion + +set hadoop-config-script=%HADOOP_HOME%\libexec\yarn-config.cmd +call %hadoop-config-script% + +pushd %HIVE_HOME%\lib +for /f %%a IN ('dir /b derby*.jar') do ( + call :SetClasspath %HIVE_HOME%\lib\%%a +) +popd + +set CLASS=org.apache.derby.drda.NetworkServerControl + +if [%1]==[catservicexml] goto :derbyservice_catservice + +:derbyserver + + if "%1" == "--config" ( + shift + set HADOOP_CONF_DIR=%2 + shift + + if exist %HADOOP_CONF_DIR%\hadoop-env.cmd ( + call %HADOOP_CONF_DIR%\hadoop-env.cmd + ) + ) + + call %JAVA% %JAVA_HEAP_MAX% %HADOOP_OPTS% -classpath %CLASSPATH% %CLASS% start -h 0.0.0.0 -noSecurityManager +goto :EOF + +:SetClasspath + set CLASSPATH=%CLASSPATH%;%1 +goto :EOF + +:derbyservice_catservice +@echo ^<service^> +@echo ^<id^>derbyserver^</id^> +@echo ^<name^>derbyserver^</name^> +@echo ^<description^>Derby Service^</description^> +@echo ^<executable^>%JAVA_HOME%\bin\java^</executable^> +@echo ^<arguments^>%JAVA_HEAP_MAX% %HADOOP_OPTS% -classpath %CLASSPATH% %CLASS% start -h 0.0.0.0 -noSecurityManager^</arguments^> +@echo ^</service^> +goto :EOF +endlocal Added: hive/trunk/bin/ext/cli.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/ext/cli.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/ext/cli.cmd (added) +++ hive/trunk/bin/ext/cli.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,33 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +set CLASS=org.apache.hadoop.hive.cli.CliDriver +pushd %HIVE_LIB% +for /f %%a IN ('dir /b hive-cli-*.jar') do ( + set JAR=%HIVE_LIB%\%%a +) +popd + +if [%1]==[cli_help] goto :cli_help + +:cli + call %HIVE_BIN_PATH%\ext\util\execHiveCmd.cmd %CLASS% +goto :EOF + +:cli_help + set HIVEARGS=--help + call :cli +goto :EOF Added: hive/trunk/bin/ext/debug.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/ext/debug.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/ext/debug.cmd (added) +++ hive/trunk/bin/ext/debug.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,110 @@ +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@echo off + +set RECURSIVE= +set PORT= +set MAINSUSPEND= +set CHILDSUSPEND= +set SWAPSUSPEND= +set HIVE_MAIN_CLIENT_DEBUG_OPTS= +set HIVE_CHILD_CLIENT_DEBUG_OPTS= +if %1==HELP ( + goto :debug_help +) else ( + call :get_debug_params %* +) + +@rem must use java 1.5 or later prereq +:ParseDebugArgs + :ProcessDebugArgsLoop + if [%1]==[] goto :EndProcessDebug + + set params=%1 + set temp=%params:~0, 8% + + @rem trim off the --debug[ if it is the 1st param + if %temp%==--debug[ ( + set params=%params:--debug[=% + ) + + @rem trim off the ] if necessary on the value of the param + set value=%2 + set value=%value:]=% + + if %params%==recursive ( + set RECURSIVE=%value% + shift + shift + goto :ProcessDebugArgsLoop + ) + + if %params%==port ( + set PORT=%value% + shift + shift + goto :ProcessDebugArgsLoop + ) + + if %params%==mainSuspend ( + set MAINSUSPEND=%value% + shift + shift + goto :ProcessDebugArgsLoop + ) + if %params%==childSuspend ( + set CHILDSUSPEND=%value% + shift + shift + goto :ProcessDebugArgsLoop + ) + if %params%==swapSuspend ( + set childTemp=%CHILDSUSPEND% + set CHILDSUSPEND=%MAINSUSPEND% + set MAINSUSPEND=%childTemp% + shift + goto :ProcessDebugArgsLoop + ) + + shift + goto :ProcessDebugArgsLoop + + :EndProcessDebug +goto :EOF + +:set_debug_defaults + set RECURSIVE="y" + set PORT=address=8000 + set MAINSUSPEND=suspend=y + set CHILDSUSPEND=suspend=n +goto :EOF + +:get_debug_params + call :set_debug_defaults + call :ParseDebugArgs %* + set HIVE_MAIN_CLIENT_DEBUG_OPTS= -XX:+UseParallelGC -Xdebug -Xrunjdwp:transport=dt_socket,server=y,%PORT%,%MAINSUSPEND% + set HIVE_CHILD_CLIENT_DEBUG_OPTS= -XX:+UseParallelGC -Xdebug -Xrunjdwp:transport=dt_socket,server=y,%CHILDSUSPEND% +goto :EOF + +:debug_help + echo "Allows to debug Hive by connecting to it via JDI API" + echo "Usage: hive --debug[:comma-separated parameters list]" + echo "Parameters:" + echo "recursive=<y|n> Should child JVMs also be started in debug mode. Default: y" + echo "port=<port_number> Port on which main JVM listens for debug connection. Default: 8000" + echo "mainSuspend=<y|n> Should main JVM wait with execution for the debugger to connect. Default: y" + echo "childSuspend=<y|n> Should child JVMs wait with execution for the debugger to connect. Default: n" + echo "swapSuspend Swaps suspend options between main and child JVMs" +goto :EOF Added: hive/trunk/bin/ext/help.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/ext/help.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/ext/help.cmd (added) +++ hive/trunk/bin/ext/help.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,30 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +:help + echo "Usage ./hive <parameters> --service serviceName <service parameters>" + echo "Service List: $SERVICE_LIST" + echo "Parameters parsed:" + echo " --auxpath : Auxillary jars " + echo " --config : Hive configuration directory" + echo " --service : Starts specific service/component. cli is default" + echo "Parameters used:" + echo " HADOOP_HOME or HADOOP_PREFIX : Hadoop install directory" + echo " HIVE_OPT : Hive options" + echo "For help on a particular service:" + echo " ./hive --service serviceName --help" + echo "Debug help: ./hive --debug --help" +goto :EOF \ No newline at end of file Added: hive/trunk/bin/ext/hiveserver.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/ext/hiveserver.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/ext/hiveserver.cmd (added) +++ hive/trunk/bin/ext/hiveserver.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,48 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +set CLASS=org.apache.hadoop.hive.service.HiveServer +pushd %HIVE_LIB% +for /f %%a IN ('dir /b hive-service-*.jar') do ( + set JAR=%HIVE_LIB%\%%a +) +popd + +if [%1]==[hiveserver_help] goto :hiveserver_help + +if [%1]==[hiveserver_catservice] goto :hiveserver_catservice + +:hiveserver + echo "Starting Hive Thrift Server" + + @rem hadoop 20 or newer - skip the aux_jars option and hiveconf + call %HIVE_BIN_PATH%\ext\util\execHiveCmd.cmd %CLASS% +goto :EOF + +:hiveserver_help + set HIVEARGS=-h + goto :hiveserver +goto :EOF + +:hiveserver_catservice +@echo ^<service^> +@echo ^<id^>HiveServer^</id^> +@echo ^<name^>HiveServer^</name^> +@echo ^<description^>Hadoop HiveServer Service^</description^> +@echo ^<executable^>%JAVA_HOME%\bin\java^</executable^> +@echo ^<arguments^>%JAVA_HEAP_MAX% %HADOOP_OPTS% %AUX_PARAM% -classpath %CLASSPATH% %CLASS% -hiveconf hive.hadoop.classpath=%HIVE_LIB%\* %HIVE_OPTS%^</arguments^> +@echo ^</service^> +goto :EOF Added: hive/trunk/bin/ext/hiveserver2.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/ext/hiveserver2.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/ext/hiveserver2.cmd (added) +++ hive/trunk/bin/ext/hiveserver2.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,91 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +set CLASS=org.apache.hive.service.server.HiveServer2 +pushd %HIVE_LIB% +for /f %%a IN ('dir /b hive-service-*.jar') do ( + set JAR=%HIVE_LIB%\%%a +) +popd + +if defined HBASE_HOME ( + dir %HBASE_HOME%\lib > nul + if %errorlevel%==0 ( + pushd %HBASE_HOME%\lib + set HIVE_HBASE_PATH= + for /f %%a IN ('dir /b hbase-server-**-hadoop2.jar') do ( + call :AddToHiveHbasePath %HBASE_HOME%\lib\%%a + ) + for /f %%a IN ('dir /b hbase-client-**-hadoop2.jar') do ( + call :AddToHiveHbasePath %HBASE_HOME%\lib\%%a + ) + for /f %%a IN ('dir /b hbase-protocol-**-hadoop2.jar') do ( + call :AddToHiveHbasePath %HBASE_HOME%\lib\%%a + ) + for /f %%a IN ('dir /b htrace-core-**.jar') do ( + call :AddToHiveHbasePath %HBASE_HOME%\lib\%%a + ) + for /f %%a IN ('dir /b hbase-common-**-hadoop2.jar') do ( + call :AddToHiveHbasePath %HBASE_HOME%\lib\%%a + ) + for /f %%a IN ('dir /b hbase-hadoop-compat-**-hadoop2.jar') do ( + call :AddToHiveHbasePath %HBASE_HOME%\lib\%%a + ) + ) + popd + if defined HBASE_CONF_DIR ( + dir %HBASE_CONF_DIR% > nul + if %errorlevel%==0 ( + call :AddToHiveHbasePath %HBASE_CONF_DIR% + ) + ) + ) +) + +if [%1]==[hiveserver2_help] goto :hiveserver2_help + +if [%1]==[hiveserver2_catservice] goto :hiveserver2_catservice + +:hiveserver2 + echo "Starting Hive Thrift Server" + + @rem hadoop 20 or newer - skip the aux_jars option and hiveconf + call %HIVE_BIN_PATH%\ext\util\execHiveCmd.cmd %CLASS% +goto :EOF + +:hiveserver2_help + set HIVEARGS=-h + goto :hiveserver2 +goto :EOF + +:hiveserver2_catservice +@echo ^<service^> +@echo ^<id^>HiveServer2^</id^> +@echo ^<name^>HiveServer2^</name^> +@echo ^<description^>Hadoop HiveServer2 Service^</description^> +@echo ^<executable^>%JAVA_HOME%\bin\java^</executable^> +@echo ^<arguments^>%JAVA_HEAP_MAX% %HADOOP_OPTS% -classpath %CLASSPATH%;%HIVE_HBASE_PATH% %CLASS% -hiveconf hive.hadoop.classpath=%HIVE_LIB%\* -hiveconf hive.metastore.uris=" " -hiveconf hive.security.authorization.manager=org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory -hiveconf hive.security.authenticator.manager=org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator %HIVE_OPTS%^</arguments^> +@echo ^</service^> +goto :EOF + +:AddToHiveHbasePath +if not defined HIVE_HBASE_PATH ( + set HIVE_HBASE_PATH=%1 + ) else ( + set HIVE_HBASE_PATH=%HIVE_HBASE_PATH%;%1 + ) +) +goto :EOF Added: hive/trunk/bin/ext/hwi.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/ext/hwi.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/ext/hwi.cmd (added) +++ hive/trunk/bin/ext/hwi.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,62 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +set CLASS=org.apache.hadoop.hive.hwi.HWIServer +pushd %HIVE_LIB% +for /f %%a IN ('dir /b hive-hwi-*.jar') do ( + set JAR=%HIVE_LIB%\%%a +) +popd + +if [%1]==[hwi_help] goto :hwi_help + +if [%1]==[hwi_catservice] goto :hwi_catservice + +:hwi + @rem set the hwi jar and war files + pushd %HIVE_LIB% + for /f %%a IN ('dir /b hive-hwi-*') do ( + call :ProcessFileName %%a + ) + popd + + @rem hadoop 20 or newer - skip the aux_jars option and hiveconf + call %HIVE_BIN_PATH%\ext\util\execHiveCmd.cmd %CLASS% +goto :EOF + +@rem process the hwi files +:ProcessFileName + set temp=%1 + set temp=%temp:~-3% + + if %temp%==jar set HWI_JAR_FILE=lib\%1 + + if %temp%==war set HWI_WAR_FILE=lib\%1 +goto :EOF + +:hwi_help + echo "Usage ANT_LIB=XXXX hive --service hwi" +goto :EOF + +:hwi_catservice +@echo ^<service^> +@echo ^<id^>HWI^</id^> +@echo ^<name^>HWI^</name^> +@echo ^<description^>Hadoop HWI Service^</description^> +@echo ^<executable^>%JAVA_HOME%\bin\java^</executable^> +@echo ^<arguments^>%JAVA_HEAP_MAX% %HADOOP_OPTS% %AUX_PARAM% -classpath %CLASSPATH% %CLASS% %HIVE_OPTS%^</arguments^> +@echo ^</service^> +goto :EOF Added: hive/trunk/bin/ext/jar.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/ext/jar.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/ext/jar.cmd (added) +++ hive/trunk/bin/ext/jar.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,43 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +if [%1]==[jar_help] goto :jar_help + +:jar + + set RUNJAR=%1 + shift + + set RUNCLASS=%1 + shift + + if "%RUNJAR%"== ""( + echo "RUNJAR not specified" + exit 3 + ) + + if "%RUNCLASS%" == "" ( + echo "RUNCLASS not specified" + exit 3 + ) + @rem hadoop 20 or newer - skip the aux_jars option and hiveconf + %HADOOP% jar %$RUNJAR% %RUNCLASS% %HIVE_OPTS% %* +goto :EOF + +:jar_help + echo "Used for applications that require Hadoop and Hive classpath and environment." + echo "./hive --service jar <yourjar> <yourclass> HIVE_OPTS <your_args>" +goto :EOF \ No newline at end of file Added: hive/trunk/bin/ext/lineage.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/ext/lineage.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/ext/lineage.cmd (added) +++ hive/trunk/bin/ext/lineage.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,30 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +set CLASS=org.apache.hadoop.hive.ql.tools.LineageInfo + +if [%1]==[lineage_help] goto :lineage_help + +:lineage + if not exist %HIVE_LIB%/hive-exec-*.jar ( + echo "Missing Hive exec Jar" + ) + call %HIVE_BIN_PATH%\ext\util\execHiveCmd.cmd %CLASS% +goto :EOF + +:lineage_help + echo "usage hive.cmd 'hql' " +goto :EOF \ No newline at end of file Added: hive/trunk/bin/ext/metastore.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/ext/metastore.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/ext/metastore.cmd (added) +++ hive/trunk/bin/ext/metastore.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,47 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +set CLASS=org.apache.hadoop.hive.metastore.HiveMetaStore +pushd %HIVE_LIB% +for /f %%a IN ('dir /b hive-metastore-*.jar') do ( + set JAR=%HIVE_LIB%\%%a +) +popd +if [%1]==[metastore_help] goto :metastore_help + +if [%1]==[metastore_catservice] goto :metastore_catservice + +:metastore + echo "Starting Hive Metastore Server" + @rem hadoop 20 or newer - skip the aux_jars option and hiveconf + set HADOOP_OPTS=%HIVE_METASTORE_HADOOP_OPTS% %HADOOP_OPTS% + call %HIVE_BIN_PATH%\ext\util\execHiveCmd.cmd %CLASS% +goto :EOF + +:metastore_help + set HIVEARGS=-h + call :metastore +goto :EOF + +:metastore_catservice +@echo ^<service^> +@echo ^<id^>Metastore^</id^> +@echo ^<name^>Metastore^</name^> +@echo ^<description^>Hadoop Metastore Service^</description^> +@echo ^<executable^>%JAVA_HOME%\bin\java^</executable^> +@echo ^<arguments^>%JAVA_HEAP_MAX% %HADOOP_OPTS% %AUX_PARAM% -classpath %CLASSPATH% %CLASS% %HIVE_OPTS%^</arguments^> +@echo ^</service^> +goto :EOF Added: hive/trunk/bin/ext/rcfilecat.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/ext/rcfilecat.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/ext/rcfilecat.cmd (added) +++ hive/trunk/bin/ext/rcfilecat.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,28 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +set CLASS=org.apache.hadoop.hive.cli.RCFileCat +set HIVE_OPTS= + +if [%1]==[rcfilecat_help] goto :rcfilecat_help + +:rcfilecat + call %HIVE_BIN_PATH%\ext\util\execHiveCmd.cmd %CLASS% +goto :EOF + +:rcfilecat_help + echo "usage ./hive rcfilecat [--start='startoffset'] [--length='len'] " +goto :EOF \ No newline at end of file Added: hive/trunk/bin/ext/schemaTool.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/ext/schemaTool.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/ext/schemaTool.cmd (added) +++ hive/trunk/bin/ext/schemaTool.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,33 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +set CLASS=org.apache.hive.beeline.HiveSchemaTool +set HIVE_OPTS= +pushd %HIVE_LIB% +for /f %%a IN ('dir /b hive-beeline-*.jar') do ( + set JAR=%HIVE_LIB%\%%a +) +popd + +if [%1]==[schematool_help] goto :schematool_help + +:schematool + call %HIVE_BIN_PATH%\ext\util\execHiveCmd.cmd %CLASS% +goto :EOF + +:schematool_help + call %HIVE_BIN_PATH%\ext\util\execHiveCmd.cmd %CLASS% --help +goto :EOF Added: hive/trunk/bin/ext/util/execHiveCmd.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/ext/util/execHiveCmd.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/ext/util/execHiveCmd.cmd (added) +++ hive/trunk/bin/ext/util/execHiveCmd.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,24 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +if [%1]==[] ( + echo "No class set to run. Please specify the class to run." + exit /b 1 +) +set CLASS=%1 +@rem hadoop 20 or newer - skip the aux_jars option. picked up from hiveconf +call %HADOOP% jar %JAR% %CLASS% %HIVE_OPTS% %HIVEARGS% +goto :EOF Added: hive/trunk/bin/hive-config.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/hive-config.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/hive-config.cmd (added) +++ hive/trunk/bin/hive-config.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,61 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + + +@rem processes --config and --auxpath option from command line + +if defined HIVE_HOME goto :DoneSetHiveHome +set HIVE_HOME=%~dp0 +for %%i in (%HIVE_HOME%.) do ( + set HIVE_HOME=%%~dpi +) + +if "%HIVE_HOME:~-1%" == "\" ( + set HIVE_HOME=%HIVE_HOME:~0,-1% +) + +:DoneSetHiveHome +set HIVE_CONF_DIR= +rem set HIVE_AUX_JARS_PATH= +:Loop + if [%1]==[] GOTO :FinishLoop + + if [%1]==[--config] ( + goto :SetConfig + ) + + if [%1]==[--auxpath] ( + goto :SetAux + ) + + @rem current argument does not match any aux params, finish loop here + goto :FinishLoop + SHIFT + GOTO Loop + + :SetConfig + set HIVE_CONF_DIR=%2 + shift + shift + goto :Loop + + :SetAux + set HIVE_AUX_JARS_PATH=%2 + shift + shift + goto :Loop + +:FinishLoop Added: hive/trunk/bin/hive.cmd URL: http://svn.apache.org/viewvc/hive/trunk/bin/hive.cmd?rev=1591522&view=auto ============================================================================== --- hive/trunk/bin/hive.cmd (added) +++ hive/trunk/bin/hive.cmd Thu May 1 00:57:57 2014 @@ -0,0 +1,349 @@ +@echo off +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +SetLocal EnableDelayedExpansion + +@rem Set the path + +if not defined HIVE_BIN_PATH ( + set HIVE_BIN_PATH=%~dp0 +) + +if "%HIVE_BIN_PATH:~-1%" == "\" ( + set HIVE_BIN_PATH=%HIVE_BIN_PATH:~0,-1% +) + +set HIVE_CONFIG_SCRIPT=%HIVE_BIN_PATH%\hive-config.cmd + +if exist %HIVE_CONFIG_SCRIPT% ( + CALL %HIVE_CONFIG_SCRIPT% %* +) + +set SERVICE= +set HELP= +set CATSERVICE= +set DEBUG= +set CURRENTARG= +set HIVEARGS= +rem set AUX_CLASSPATH= +set AUX_PARAM= + +@rem parse the command line arguments +:ProcessCmdLine + if [%1]==[] goto :FinishArgs + + set temp=%1 + set temp=%temp:~0, 7% + + if %temp%==--debug ( + set DEBUG=%* + shift + goto :ProcessCmdLine + ) + + if %1==--config ( + shift + shift + goto :ProcessCmdLine + ) + + if %1==--auxpath ( + shift + shift + goto :ProcessCmdLine + ) + + if %1==--service ( + set SERVICE=%2 + + if [%3]==[catservicexml] ( + set CATSERVICE=_catservice + shift + ) + shift + shift + goto :ProcessCmdLine + ) + + if %1==--rcfilecat ( + set SERVICE=rcfilecat + shift + goto :ProcessCmdLine + ) + + if %1==--help ( + set HELP=_help + shift + goto :ProcessCmdLine + ) + + @rem parameter at %1 does not match any option, these are optional params + goto :FinishArgs +:FinishArgs + +if defined DEBUG ( + if defined HELP ( + call %HIVE_BIN_PATH%\ext\debug.cmd HELP + goto :EOF + ) + + call %HIVE_BIN_PATH%\ext\debug.cmd %DEBUG% +) + +if defined HIVE_MAIN_CLIENT_DEBUG_OPTS ( + set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS% %HIVE_MAIN_CLIENT_DEBUG_OPTS% +) + +if not [%1]==[] ( + set CURRENTARG=%1 + call :MakeHiveArgs %* +) + +if not defined SERVICE ( + if defined HELP ( + set SERVICE=help + ) else ( + set SERVICE=cli + ) +) + +if not defined HIVE_HOME ( + echo "HIVE_HOME needs to be defined to point at the root of the hive install" + exit /b 1 +) + +if not defined HIVE_CONF_DIR ( + set HIVE_CONF_DIR=%HIVE_HOME%\conf +) + +if exist %HIVE_CONF_DIR%/hive-env.cmd CALL %HIVE_CONF_DIR%/hive-env.cmd + +@rem sort out classpath and make sure dependencies exist +set CLASSPATH=%HIVE_CONF_DIR% + +set HIVE_LIB=%HIVE_HOME%\lib + +@rem needed for execution +if not exist %HIVE_LIB%\hive-exec-*.jar ( + echo "Missing Hive Execution Jar: %HIVE_LIB%/hive-exec-*.jar" + exit /b 1 +) + +if not exist %HIVE_LIB%\hive-metastore-*.jar ( + echo "Missing Hive MetaStore Jar" + exit /b 1 +) + +@rem cli specific code +if not exist %HIVE_LIB%\hive-cli-*.jar ( + echo "Missing Hive CLI Jar" + exit /b 1 +) + +set CLASSPATH=%CLASSPATH%;%HIVE_LIB%\* + +@rem maybe we should just make users set HADOOP_HOME env variable as a prereq +@rem in the next iteration, use "where" command to find directory of hadoop install from path +if not defined HADOOP_HOME ( + echo "HADOOP_HOME needs to be defined to point at the hadoop installation" + exit /b 1 +) + +@rem supress the HADOOP_HOME warnings in 1.x.x +set HADOOP_HOME_WARN_SUPPRESS=true + +set HADOOP=%HADOOP_HOME%\bin\hadoop.cmd +if not exist %HADOOP% ( + echo "Missing hadoop installation: %HADOOP_HOME% must be set" + exit /b 1 +) + +@rem can only run against hadoop 1.0.0 as prereq for this iteration - can't figure out the regex/awk script to determine compatibility + +@rem add auxilary jars such as serdes +if not defined HIVE_AUX_JARS_PATH goto :AddAuxLibDir + +setLocal EnableDelayedExpansion +:auxJarLoop + for /f "delims=," %%a in ("!HIVE_AUX_JARS_PATH!") do ( + set auxjar=%%a + if exist %%a ( + if exist "%%a\nul" ( + @rem %%a is a dir + pushd %%a + for /f %%b IN ('dir /b *.jar') do ( + set AUX_CLASSPATH=!AUX_CLASSPATH!;%%a\%%b + call :AddToAuxParam %%a\%%b + ) + popd + ) else ( + @rem %%a is a file + set AUX_CLASSPATH=!AUX_CLASSPATH!;%%a + call :AddToAuxParam %%a + ) + ) + ) + :striploop + set stripchar=!HIVE_AUX_JARS_PATH:~0,1! + set HIVE_AUX_JARS_PATH=!HIVE_AUX_JARS_PATH:~1! + if "!HIVE_AUX_JARS_PATH!" EQU "" goto auxJarLoopEnd + if "!stripchar!" NEQ "," goto striploop + goto auxJarLoop + +:auxJarLoopEnd + +if defined HIVE_AUX_JARS_PATH ( + echo "setting aux param %HIVE_AUX_JARS_PATH%" + set AUX_CLASSPATH=%HIVE_AUX_JARS_PATH% + set AUX_PARAM=file://%HIVE_AUX_JARS_PATH% +) + + +:AddAuxLibDir +@rem adding jars from auxlib directory +if exist %HIVE_HOME%\auxlib ( + pushd %HIVE_HOME%\auxlib + for /f %%a IN ('dir /b *.jar') do ( + set AUX_CLASSPATH=%AUX_CLASSPATH%;%%a + call :AddToAuxParam %%a + ) + popd +) + +@rem pass classpath to hadoop +set HADOOP_CLASSPATH=%HADOOP_CLASSPATH%;%CLASSPATH%;%AUX_CLASSPATH% + +@rem also pass hive classpath to hadoop +if defined HIVE_CLASSPATH ( + set HADOOP_CLASSPATH=%HADOOP_CLASSPATH%;%HIVE_CLASSPATH% +) + +if defined AUX_PARAM ( + set HIVE_OPTS=%HIVE_OPTS% -hiveconf hive.aux.jars.path="%AUX_PARAM%" + set AUX_JARS_CMD_LINE="-libjars %AUX_PARAM%" +) + +@rem Get ready to run the services +set SERVICE_COUNT=0 +set TORUN="" +call :AddServices +For /L %%i in (1,1,%SERVICE_COUNT%) do ( + if "%SERVICE%" == "!VAR%%i!" ( + set TORUN=!VAR%%i! + ) +) + +if %TORUN% == "" ( + echo "Service %SERVICE% not available" + exit /b 1 +) + + +if defined HELP ( + call %HIVE_BIN_PATH%\ext\%TORUN%.cmd %TORUN%%HELP% %* + goto :EOF +) + +@rem generate xml for the service, also append hadoop dependencies to the classpath +if defined CATSERVICE ( + if exist %HADOOP_HOME%\libexec\hadoop-config.cmd ( + call %HADOOP_HOME%\libexec\hadoop-config.cmd + ) else ( + call %HADOOP_HOME%\libexec\hadoop-config.cmd + ) + call %HIVE_BIN_PATH%\ext\%TORUN%.cmd %TORUN%%CATSERVICE% %* + goto :EOF +) + +call %HIVE_BIN_PATH%\ext\%TORUN%.cmd %TORUN% %* + + + +goto :EOF +@rem done body of script + + +@rem start utility functions here + +@rem strip off preceding arguments like --service so that subsequent args can be passed on +:MakeHiveArgs + set _count=0 + set _shift=1 + set HIVEARGS= + + if not defined CURRENTARG ( + goto :EndLoop + ) + :HiveArgsLoop + if [%1]==[] ( + goto :EndLoop + ) + if not %1==%CURRENTARG% ( + shift + goto :HiveArgsLoop + ) + + if not defined HIVEARGS ( + set HIVEARGS=%1 + ) else ( + set HIVEARGS=%HIVEARGS% %1 + ) + shift + set CURRENTARG=%1 + goto :HiveArgsLoop + :EndLoop +goto :EOF + +@rem makes list of available services +:AddServices + set /a SERVICE_COUNT = %SERVICE_COUNT% + 1 + set VAR%SERVICE_COUNT%=cli + + set /a SERVICE_COUNT = %SERVICE_COUNT% + 1 + set VAR%SERVICE_COUNT%=help + + set /a SERVICE_COUNT = %SERVICE_COUNT% + 1 + set VAR%SERVICE_COUNT%=hiveserver + + set /a SERVICE_COUNT = %SERVICE_COUNT% + 1 + set VAR%SERVICE_COUNT%=hiveserver2 + + set /a SERVICE_COUNT = %SERVICE_COUNT% + 1 + set VAR%SERVICE_COUNT%=hwi + + set /a SERVICE_COUNT = %SERVICE_COUNT% + 1 + set VAR%SERVICE_COUNT%=jar + + set /a SERVICE_COUNT = %SERVICE_COUNT% + 1 + set VAR%SERVICE_COUNT%=lineage + + set /a SERVICE_COUNT = %SERVICE_COUNT% + 1 + set VAR%SERVICE_COUNT%=metastore + + set /a SERVICE_COUNT = %SERVICE_COUNT% + 1 + set VAR%SERVICE_COUNT%=rcfilecat + + set /a SERVICE_COUNT = %SERVICE_COUNT% + 1 + set VAR%SERVICE_COUNT%=schematool +goto :EOF + +:AddToAuxParam +if not defined AUX_PARAM ( + set AUX_PARAM=file:///%1 + ) else ( + set AUX_PARAM=%AUX_PARAM%,file:///%1 + ) +) +goto :EOF