You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jv...@apache.org on 2011/02/16 19:14:19 UTC
svn commit: r1071351 - in /hive/branches/branch-0.7: ./ bin/ bin/ext/
bin/ext/util/ cli/ cli/src/java/org/apache/hadoop/hive/cli/
eclipse-templates/ ivy/ lib/ shims/
Author: jvs
Date: Wed Feb 16 18:14:18 2011
New Revision: 1071351
URL: http://svn.apache.org/viewvc?rev=1071351&view=rev
Log:
HIVE-1817. Remove Hive dependency on unreleased commons-cli 2.0 Snapshot
(Carl Steinbach via jvs)
Removed:
hive/branches/branch-0.7/lib/commons-cli-2.0-SNAPSHOT.jar
Modified:
hive/branches/branch-0.7/bin/ext/cli.sh
hive/branches/branch-0.7/bin/ext/help.sh
hive/branches/branch-0.7/bin/ext/hiveserver.sh
hive/branches/branch-0.7/bin/ext/hwi.sh
hive/branches/branch-0.7/bin/ext/jar.sh
hive/branches/branch-0.7/bin/ext/metastore.sh
hive/branches/branch-0.7/bin/ext/rcfilecat.sh
hive/branches/branch-0.7/bin/ext/util/execHiveCmd.sh
hive/branches/branch-0.7/bin/hive
hive/branches/branch-0.7/bin/hive-config.sh
hive/branches/branch-0.7/build.properties
hive/branches/branch-0.7/build.xml
hive/branches/branch-0.7/cli/build.xml
hive/branches/branch-0.7/cli/ivy.xml
hive/branches/branch-0.7/cli/src/java/org/apache/hadoop/hive/cli/OptionsProcessor.java
hive/branches/branch-0.7/eclipse-templates/.classpath
hive/branches/branch-0.7/ivy/libraries.properties
hive/branches/branch-0.7/shims/build.xml
hive/branches/branch-0.7/shims/ivy.xml
Modified: hive/branches/branch-0.7/bin/ext/cli.sh
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/bin/ext/cli.sh?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/bin/ext/cli.sh (original)
+++ hive/branches/branch-0.7/bin/ext/cli.sh Wed Feb 16 18:14:18 2011
@@ -1,3 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
THISSERVICE=cli
export SERVICE_LIST="${SERVICE_LIST}${THISSERVICE} "
@@ -7,8 +22,7 @@ cli () {
}
cli_help () {
- echo "usage ./hive [-e 'hql'| -f file ] "
- echo " -e 'hwl' : execute specified query"
- echo " -f file : exeute query in file"
+ CLASS=org.apache.hadoop.hive.cli.CliDriver
+ execHiveCmd $CLASS "--help"
}
Modified: hive/branches/branch-0.7/bin/ext/help.sh
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/bin/ext/help.sh?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/bin/ext/help.sh (original)
+++ hive/branches/branch-0.7/bin/ext/help.sh Wed Feb 16 18:14:18 2011
@@ -1,3 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
THISSERVICE=help
export SERVICE_LIST="${SERVICE_LIST}${THISSERVICE} "
Modified: hive/branches/branch-0.7/bin/ext/hiveserver.sh
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/bin/ext/hiveserver.sh?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/bin/ext/hiveserver.sh (original)
+++ hive/branches/branch-0.7/bin/ext/hiveserver.sh Wed Feb 16 18:14:18 2011
@@ -1,3 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
THISSERVICE=hiveserver
export SERVICE_LIST="${SERVICE_LIST}${THISSERVICE} "
@@ -9,29 +24,8 @@ hiveserver() {
fi
JAR=${HIVE_LIB}/hive-service-*.jar
- version=$($HADOOP version | awk '{if (NR == 1) {print $2;}}');
-
- # Save the regex to a var to workaround quoting incompatabilities
- # between Bash 3.1 and 3.2
- version_re="^([[:digit:]]+)\.([[:digit:]]+)(\.([[:digit:]]+))?.*$"
-
- if [[ "$version" =~ $version_re ]]; then
- major_ver=${BASH_REMATCH[1]}
- minor_ver=${BASH_REMATCH[2]}
- patch_ver=${BASH_REMATCH[4]}
- else
- echo "Unable to determine Hadoop version information."
- echo "'hadoop version' returned:"
- echo `$HADOOP version`
- exit 6
- fi
-
- if [ $minor_ver -lt 20 ]; then
- exec $HADOOP jar $AUX_JARS_CMD_LINE $JAR $CLASS $HIVE_PORT "$@"
- else
- # hadoop 20 or newer - skip the aux_jars option and hiveconf
- exec $HADOOP jar $JAR $CLASS $HIVE_PORT "$@"
- fi
+ # hadoop 20 or newer - skip the aux_jars option and hiveconf
+ exec $HADOOP jar $JAR $CLASS $HIVE_PORT "$@"
}
hiveserver_help() {
Modified: hive/branches/branch-0.7/bin/ext/hwi.sh
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/bin/ext/hwi.sh?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/bin/ext/hwi.sh (original)
+++ hive/branches/branch-0.7/bin/ext/hwi.sh Wed Feb 16 18:14:18 2011
@@ -1,3 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
THISSERVICE=hwi
export SERVICE_LIST="${SERVICE_LIST}${THISSERVICE} "
@@ -24,32 +39,10 @@ hwi() {
HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:$f
done
- version=$($HADOOP version | awk '{if (NR == 1) {print $2;}}');
- # Save the regex to a var to workaround quoting incompatabilities
- # between Bash 3.1 and 3.2
- version_re="^([[:digit:]]+)\.([[:digit:]]+)(\.([[:digit:]]+))?.*$"
-
- if [[ "$version" =~ $version_re ]]; then
- major_ver=${BASH_REMATCH[1]}
- minor_ver=${BASH_REMATCH[2]}
- patch_ver=${BASH_REMATCH[4]}
- else
- echo "Unable to determine Hadoop version information."
- echo "'hadoop version' returned:"
- echo `$HADOOP version`
- exit 6
- fi
-
export HADOOP_CLASSPATH
- if [ $minor_ver -lt 20 ]; then
- exec $HADOOP jar $AUX_JARS_CMD_LINE ${HWI_JAR_FILE} $CLASS $HIVE_OPTS "$@"
- else
- # hadoop 20 or newer - skip the aux_jars option and hiveconf
- exec $HADOOP jar ${HWI_JAR_FILE} $CLASS $HIVE_OPTS "$@"
- fi
- #nohup $HADOOP jar $AUX_JARS_CMD_LINE ${HWI_JAR_FILE} $CLASS $HIVE_OPTS "$@" >/dev/null 2>/dev/null &
-
+ # hadoop 20 or newer - skip the aux_jars option and hiveconf
+ exec $HADOOP jar ${HWI_JAR_FILE} $CLASS $HIVE_OPTS "$@"
}
hwi_help(){
Modified: hive/branches/branch-0.7/bin/ext/jar.sh
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/bin/ext/jar.sh?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/bin/ext/jar.sh (original)
+++ hive/branches/branch-0.7/bin/ext/jar.sh Wed Feb 16 18:14:18 2011
@@ -27,23 +27,6 @@ jar () {
HIVE_LIB=`cygpath -w "$HIVE_LIB"`
fi
- version=$($HADOOP version | awk '{if (NR == 1) {print $2;}}');
-
- # Save the regex to a var to workaround quoting incompatabilities
- # between Bash 3.1 and 3.2
- version_re="^([[:digit:]]+)\.([[:digit:]]+)(\.([[:digit:]]+))?.*$"
-
- if [[ "$version" =~ $version_re ]]; then
- major_ver=${BASH_REMATCH[1]}
- minor_ver=${BASH_REMATCH[2]}
- patch_ver=${BASH_REMATCH[4]}
- else
- echo "Unable to determine Hadoop version information."
- echo "'hadoop version' returned:"
- echo `$HADOOP version`
- exit 6
- fi
-
if [ -z "$RUNJAR" ] ; then
echo "RUNJAR not specified"
exit 3
@@ -54,12 +37,8 @@ jar () {
exit 3
fi
- if [ $minor_ver -lt 20 ]; then
- exec $HADOOP jar $AUX_JARS_CMD_LINE $RUNJAR $RUNCLASS $HIVE_OPTS "$@"
- else
- # hadoop 20 or newer - skip the aux_jars option and hiveconf
- exec $HADOOP jar $RUNJAR $RUNCLASS $HIVE_OPTS "$@"
- fi
+ # hadoop 20 or newer - skip the aux_jars option and hiveconf
+ exec $HADOOP jar $RUNJAR $RUNCLASS $HIVE_OPTS "$@"
}
jar_help () {
Modified: hive/branches/branch-0.7/bin/ext/metastore.sh
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/bin/ext/metastore.sh?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/bin/ext/metastore.sh (original)
+++ hive/branches/branch-0.7/bin/ext/metastore.sh Wed Feb 16 18:14:18 2011
@@ -1,3 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
THISSERVICE=metastore
export SERVICE_LIST="${SERVICE_LIST}${THISSERVICE} "
@@ -9,29 +24,8 @@ metastore() {
fi
JAR=${HIVE_LIB}/hive-service-*.jar
- version=$($HADOOP version | awk '{if (NR == 1) {print $2;}}');
-
- # Save the regex to a var to workaround quoting incompatabilities
- # between Bash 3.1 and 3.2
- version_re="^([[:digit:]]+)\.([[:digit:]]+)(\.([[:digit:]]+))?.*$"
-
- if [[ "$version" =~ $version_re ]]; then
- major_ver=${BASH_REMATCH[1]}
- minor_ver=${BASH_REMATCH[2]}
- patch_ver=${BASH_REMATCH[4]}
- else
- echo "Unable to determine Hadoop version information."
- echo "'hadoop version' returned:"
- echo `$HADOOP version`
- exit 6
- fi
-
- if [ $minor_ver -lt 20 ]; then
- exec $HADOOP jar $AUX_JARS_CMD_LINE $JAR $CLASS $METASTORE_PORT "$@"
- else
- # hadoop 20 or newer - skip the aux_jars option and hiveconf
- exec $HADOOP jar $JAR $CLASS $METASTORE_PORT "$@"
- fi
+ # hadoop 20 or newer - skip the aux_jars option and hiveconf
+ exec $HADOOP jar $JAR $CLASS $METASTORE_PORT "$@"
}
metastore_help() {
Modified: hive/branches/branch-0.7/bin/ext/rcfilecat.sh
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/bin/ext/rcfilecat.sh?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/bin/ext/rcfilecat.sh (original)
+++ hive/branches/branch-0.7/bin/ext/rcfilecat.sh Wed Feb 16 18:14:18 2011
@@ -1,3 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
THISSERVICE=rcfilecat
export SERVICE_LIST="${SERVICE_LIST}${THISSERVICE} "
Modified: hive/branches/branch-0.7/bin/ext/util/execHiveCmd.sh
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/bin/ext/util/execHiveCmd.sh?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/bin/ext/util/execHiveCmd.sh (original)
+++ hive/branches/branch-0.7/bin/ext/util/execHiveCmd.sh Wed Feb 16 18:14:18 2011
@@ -1,3 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
execHiveCmd () {
CLASS=$1;
shift;
@@ -12,28 +27,6 @@ execHiveCmd () {
HIVE_LIB=`cygpath -w "$HIVE_LIB"`
fi
- version=$($HADOOP version | awk '{if (NR == 1) {print $2;}}');
-
- # Save the regex to a var to workaround quoting incompatabilities
- # between Bash 3.1 and 3.2
- version_re="^([[:digit:]]+)\.([[:digit:]]+)(\.([[:digit:]]+))?.*$"
-
- if [[ "$version" =~ $version_re ]]; then
- major_ver=${BASH_REMATCH[1]}
- minor_ver=${BASH_REMATCH[2]}
- patch_ver=${BASH_REMATCH[4]}
- else
- echo "Unable to determine Hadoop version information."
- echo "'hadoop version' returned:"
- echo `$HADOOP version`
- exit 6
- fi
-
- if [ $minor_ver -lt 20 ]; then
- exec $HADOOP jar $AUX_JARS_CMD_LINE ${HIVE_LIB}/hive-cli-*.jar $CLASS $HIVE_OPTS "$@"
- else
- # hadoop 20 or newer - skip the aux_jars option. picked up from hiveconf
- exec $HADOOP jar ${HIVE_LIB}/hive-cli-*.jar $CLASS $HIVE_OPTS "$@"
- fi
-
+ # hadoop 20 or newer - skip the aux_jars option. picked up from hiveconf
+ exec $HADOOP jar ${HIVE_LIB}/hive-cli-*.jar $CLASS $HIVE_OPTS "$@"
}
Modified: hive/branches/branch-0.7/bin/hive
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/bin/hive?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/bin/hive (original)
+++ hive/branches/branch-0.7/bin/hive Wed Feb 16 18:14:18 2011
@@ -155,6 +155,31 @@ if [ ! -f ${HADOOP} ]; then
exit 4;
fi
+# Make sure we're using a compatible version of Hadoop
+hadoop_version=$($HADOOP version | awk '{if (NR == 1) {print $2;}}');
+
+# Save the regex to a var to workaround quoting incompatabilities
+# between Bash 3.1 and 3.2
+hadoop_version_re="^([[:digit:]]+)\.([[:digit:]]+)(\.([[:digit:]]+))?.*$"
+
+if [[ "$hadoop_version" =~ $hadoop_version_re ]]; then
+ hadoop_major_ver=${BASH_REMATCH[1]}
+ hadoop_minor_ver=${BASH_REMATCH[2]}
+ hadoop_patch_ver=${BASH_REMATCH[4]}
+else
+ echo "Unable to determine Hadoop version information."
+ echo "'hadoop version' returned:"
+ echo `$HADOOP version`
+ exit 5
+fi
+
+if [ $hadoop_minor_ver -ne 20 -o $hadoop_patch_ver -eq 0 ]; then
+ echo "Hive requires Hadoop 0.20.x (x >= 1)."
+ echo "'hadoop version' returned:"
+ echo `$HADOOP version`
+ exit 6
+fi
+
if [ "${AUX_PARAM}" != "" ]; then
HIVE_OPTS="$HIVE_OPTS -hiveconf hive.aux.jars.path=${AUX_PARAM}"
AUX_JARS_CMD_LINE="-libjars ${AUX_PARAM}"
@@ -180,7 +205,7 @@ done
if [ "$TORUN" = "" ] ; then
echo "Service $SERVICE not found"
echo "Available Services: $SERVICE_LIST"
- exit 5
+ exit 7
else
$TORUN "$@"
fi
Modified: hive/branches/branch-0.7/bin/hive-config.sh
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/bin/hive-config.sh?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/bin/hive-config.sh (original)
+++ hive/branches/branch-0.7/bin/hive-config.sh Wed Feb 16 18:14:18 2011
@@ -1,4 +1,3 @@
-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Modified: hive/branches/branch-0.7/build.properties
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/build.properties?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/build.properties (original)
+++ hive/branches/branch-0.7/build.properties Wed Feb 16 18:14:18 2011
@@ -10,7 +10,7 @@ javac.deprecation=off
javac.args=
javac.args.warnings=
-hadoop.version=0.20.0
+hadoop.version=0.20.1
hadoop.mirror=http://mirror.facebook.net/facebook/hive-deps
build.dir.hive=${hive.root}/build
Modified: hive/branches/branch-0.7/build.xml
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/build.xml?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/build.xml (original)
+++ hive/branches/branch-0.7/build.xml Wed Feb 16 18:14:18 2011
@@ -206,7 +206,7 @@
</antcall>
<for keepgoing="${test.continue.on.failure}" param="file">
<path>
- <fileset dir="." includes="*/build.xml" excludes="ant/*,odbc/*"/>
+ <fileset dir="." includes="*/build.xml" excludes="ant/*,odbc/*,shims/*"/>
</path>
<sequential>
<ant antfile="@{file}" target="test" inheritAll="false" inheritRefs="true">
Modified: hive/branches/branch-0.7/cli/build.xml
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/cli/build.xml?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/cli/build.xml (original)
+++ hive/branches/branch-0.7/cli/build.xml Wed Feb 16 18:14:18 2011
@@ -27,6 +27,20 @@ to call at top-level: ant deploy-contrib
<property name="src.dir" location="${basedir}/src/java"/>
<import file="../build-common.xml"/>
+ <target name="compile" depends="init, setup, ivy-retrieve">
+ <echo message="Compiling: ${ant.project.name}"/>
+ <javac
+ encoding="${build.encoding}"
+ srcdir="${src.dir}"
+ includes="**/*.java"
+ destdir="${build.classes}"
+ debug="${javac.debug}"
+ deprecation="${javac.deprecation}">
+ <compilerarg line="${javac.args} ${javac.args.warnings}" />
+ <classpath refid="classpath"/>
+ </javac>
+ </target>
+
<target name="test">
<echo message="Nothing to do!"/>
</target>
Modified: hive/branches/branch-0.7/cli/ivy.xml
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/cli/ivy.xml?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/cli/ivy.xml (original)
+++ hive/branches/branch-0.7/cli/ivy.xml Wed Feb 16 18:14:18 2011
@@ -1,8 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
<ivy-module version="2.0">
<info organisation="org.apache.hadoop.hive" module="cli"/>
<dependencies>
<dependency org="hadoop" name="core" rev="${hadoop.version.ant-internal}">
<artifact name="hadoop" type="source" ext="tar.gz"/>
- </dependency>
+ </dependency>
+ <dependency org="commons-cli" name="commons-cli" rev="${commons-cli.version}"/>
</dependencies>
</ivy-module>
Modified: hive/branches/branch-0.7/cli/src/java/org/apache/hadoop/hive/cli/OptionsProcessor.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/cli/src/java/org/apache/hadoop/hive/cli/OptionsProcessor.java?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/cli/src/java/org/apache/hadoop/hive/cli/OptionsProcessor.java (original)
+++ hive/branches/branch-0.7/cli/src/java/org/apache/hadoop/hive/cli/OptionsProcessor.java Wed Feb 16 18:14:18 2011
@@ -18,175 +18,81 @@
package org.apache.hadoop.hive.cli;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.apache.commons.cli2.Argument;
-import org.apache.commons.cli2.CommandLine;
-import org.apache.commons.cli2.Group;
-import org.apache.commons.cli2.Option;
-import org.apache.commons.cli2.OptionException;
-import org.apache.commons.cli2.WriteableCommandLine;
-import org.apache.commons.cli2.builder.ArgumentBuilder;
-import org.apache.commons.cli2.builder.DefaultOptionBuilder;
-import org.apache.commons.cli2.builder.GroupBuilder;
-import org.apache.commons.cli2.commandline.Parser;
-import org.apache.commons.cli2.option.PropertyOption;
-import org.apache.commons.cli2.resource.ResourceConstants;
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* OptionsProcessor.
- *
+ *
*/
public class OptionsProcessor {
-
protected static final Log l4j = LogFactory.getLog(OptionsProcessor.class.getName());
+ private final Options options = new Options();
+ private org.apache.commons.cli.CommandLine commandLine;
- private final Parser parser = new Parser();
- private final Option confOptions, initFilesOption, isSilentOption,
- execOption, fileOption, isHelpOption, isVerboseOption;
-
- /**
- * Shamelessly cloned from Hadoop streaming take in multiple -hiveconf x=y parameters.
- */
- class MultiPropertyOption extends PropertyOption {
- private String optionString;
- private boolean keyValue;
-
- MultiPropertyOption() {
- super();
- }
-
- MultiPropertyOption(final String optionString, final String description, final int id, boolean keyValue) {
- super(optionString, description, id);
- this.optionString = optionString;
- this.keyValue = keyValue;
- }
-
- @Override
- public boolean canProcess(final WriteableCommandLine commandLine, final String argument) {
- boolean ret = (argument != null) && argument.startsWith(optionString);
-
- return ret;
- }
-
- @Override
- public void process(final WriteableCommandLine commandLine, final ListIterator arguments)
- throws OptionException {
- final String arg = (String) arguments.next();
-
- if (!canProcess(commandLine, arg)) {
- throw new OptionException(this, ResourceConstants.UNEXPECTED_TOKEN, arg);
- }
-
- ArrayList properties = new ArrayList();
- String next = "";
- while (arguments.hasNext()) {
- next = (String) arguments.next();
- if (!next.startsWith("-")) {
-
- if (keyValue && (next.indexOf("=") == -1)) {
- throw new OptionException(this, ResourceConstants.UNEXPECTED_TOKEN, "argument: '"
- + next + "' is not of the form x=y");
- }
- properties.add(next);
- } else {
- arguments.previous();
- break;
- }
- }
-
- // add to any existing values (support specifying args multiple times)
- List<String> oldVal = (List<String>) commandLine.getValue(this);
- if (oldVal == null) {
- commandLine.addValue(this, properties);
- } else {
- oldVal.addAll(properties);
- }
- }
- }
-
- private Option createBoolOption(DefaultOptionBuilder builder, String longName, String shortName,
- String desc) {
- builder.reset();
- if (longName == null) {
- return builder.withShortName(shortName).withDescription(desc).create();
- } else {
- return builder.withShortName(shortName).withLongName(longName).withDescription(desc).create();
- }
- }
-
- private Option createOptionWithArg(DefaultOptionBuilder builder, String longName,
- String shortName, String desc, Argument arg) {
- builder.reset();
-
- DefaultOptionBuilder dob = builder.withShortName(shortName).withArgument(arg).withDescription(
- desc);
- if (longName != null) {
- dob = dob.withLongName(longName);
- }
+ @SuppressWarnings("static-access")
+ public OptionsProcessor() {
- return dob.create();
- }
+ // -e 'quoted-query-string'
+ options.addOption(OptionBuilder
+ .hasArg()
+ .withArgName("quoted-query-string")
+ .withDescription("SQL from command line")
+ .create('e'));
+
+ // -f <query-file>
+ options.addOption(OptionBuilder
+ .hasArg()
+ .withArgName("filename")
+ .withDescription("SQL from files")
+ .create('f'));
+
+ // -i <init-query-file>
+ options.addOption(OptionBuilder
+ .hasArg()
+ .withArgName("filename")
+ .withDescription("Initialization SQL file")
+ .create('i'));
+
+ // -hiveconf x=y
+ options.addOption(OptionBuilder
+ .withValueSeparator()
+ .hasArgs(2)
+ .withArgName("property=value")
+ .withLongOpt("hiveconf")
+ .withDescription("Use value for given property")
+ .create());
- public OptionsProcessor() {
- DefaultOptionBuilder builder = new DefaultOptionBuilder("-", "-", false);
+ // [-S|--silent]
+ options.addOption(new Option("S", "silent", false, "Silent mode in interactive shell"));
- ArgumentBuilder argBuilder = new ArgumentBuilder();
+ // [-v|--verbose]
+ options.addOption(new Option("v", "verbose", false, "Verbose mode (echo executed SQL to the console)"));
- // -e
- execOption = createOptionWithArg(builder, "exec", "e", "execute the following command",
- argBuilder.withMinimum(1).withMaximum(1).create());
-
- // -f
- fileOption = createOptionWithArg(builder, "file", "f",
- "execute commands from the following file", argBuilder.withMinimum(1).withMaximum(1)
- .create());
-
- // -S
- isSilentOption = createBoolOption(builder, "silent", "S", "silent mode");
-
- // -v
- isVerboseOption = createBoolOption(builder, "verbose", "v", "verbose mode");
-
- // -help
- isHelpOption = createBoolOption(builder, "help", "h", "help");
-
- // -hiveconf var=val
- confOptions = new MultiPropertyOption("-hiveconf",
- "(n=v) Optional. Add or override Hive/Hadoop properties.", 'D', true);
-
- initFilesOption = new MultiPropertyOption(
- "-i", "File to run before other commands", 'I', false);
-
- new PropertyOption();
- Group allOptions =
- new GroupBuilder().withOption(confOptions).withOption(initFilesOption)
- .withOption(isSilentOption).withOption(isHelpOption)
- .withOption(execOption).withOption(fileOption)
- .withOption(isVerboseOption).create();
- parser.setGroup(allOptions);
+ // [-h|--help]
+ options.addOption(new Option("h", "help", false, "Print help information"));
}
- private CommandLine cmdLine;
-
public boolean process_stage1(String[] argv) {
try {
- cmdLine = parser.parse(argv);
-
- List<String> hiveConfArgs = (List<String>) cmdLine.getValue(confOptions);
- if (null != hiveConfArgs) {
- for (String s : hiveConfArgs) {
- String[] parts = s.split("=", 2);
- System.setProperty(parts[0], parts[1]);
- }
+ commandLine = new GnuParser().parse(options, argv);
+ Properties confProps = commandLine.getOptionProperties("hiveconf");
+ for (String propKey : confProps.stringPropertyNames()) {
+ System.setProperty(propKey, confProps.getProperty(propKey));
}
- } catch (OptionException oe) {
- System.err.println(oe.getMessage());
+ } catch (ParseException e) {
+ System.err.println(e.getMessage());
+ printUsage();
return false;
}
return true;
@@ -194,58 +100,42 @@ public class OptionsProcessor {
public boolean process_stage2(CliSessionState ss) {
ss.getConf();
- // -S
- ss.setIsSilent(cmdLine.hasOption(isSilentOption));
- // -e
- ss.execString = (String) cmdLine.getValue(execOption);
- // -f
- ss.fileName = (String) cmdLine.getValue(fileOption);
- // -v
- ss.setIsVerbose(cmdLine.hasOption(isVerboseOption));
- // -i
- List<String> initFiles = (List<String>) cmdLine.getValue(initFilesOption);
- if (null != initFiles) {
- ss.initFiles = initFiles;
- }
- // -h
- if (cmdLine.hasOption(isHelpOption)) {
- printUsage(null);
+
+ if (commandLine.hasOption('h')) {
+ printUsage();
return false;
}
+
+ ss.setIsSilent(commandLine.hasOption('S'));
+
+ ss.execString = commandLine.getOptionValue('e');
+
+ ss.fileName = commandLine.getOptionValue('f');
+
+ ss.setIsVerbose(commandLine.hasOption('v'));
+
+ String[] initFiles = commandLine.getOptionValues('i');
+ if (null != initFiles) {
+ ss.initFiles = Arrays.asList(initFiles);
+ }
+
if (ss.execString != null && ss.fileName != null) {
- printUsage("-e and -f option cannot be specified simultaneously");
+ System.err.println("The '-e' and '-f' options cannot be specified simultaneously");
+ printUsage();
return false;
}
- List<String> hiveConfArgs = (List<String>) cmdLine.getValue(confOptions);
- if (null != hiveConfArgs) {
- for (String s : hiveConfArgs) {
- String[] parts = s.split("=", 2);
- ss.cmdProperties.setProperty(parts[0], parts[1]);
+ if (commandLine.hasOption("hiveconf")) {
+ Properties confProps = commandLine.getOptionProperties("hiveconf");
+ for (String propKey : confProps.stringPropertyNames()) {
+ ss.cmdProperties.setProperty(propKey, confProps.getProperty(propKey));
}
}
return true;
}
- public void printUsage(String error) {
- if (error != null) {
- System.err.println("Invalid arguments: " + error);
- }
- System.err.println("");
- System.err.println(
- "Usage: hive [--config confdir] [-hiveconf x=y]* [-i <init-filename>]*"
- + " [-f <filename>|-e <query-string>] [-S] [-v]");
- System.err.println("");
- System.err.println(" -i <filename> init Sql file");
- System.err.println(" -e 'quoted query string' Sql from command line");
- System.err.println(" -f <filename> Sql from files");
- System.err.println(" -S Silent mode in interactive shell");
- System.err.println(" -v Verbose mode (echo executed Sql to the console)");
- System.err.println("");
- System.err.println("-e and -f cannot be specified together. In the absence of these");
- System.err.println(" options, interactive shell is started.");
- System.err.println("");
-
+ private void printUsage() {
+ new HelpFormatter().printHelp("hive", options);
}
}
Modified: hive/branches/branch-0.7/eclipse-templates/.classpath
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/eclipse-templates/.classpath?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/eclipse-templates/.classpath (original)
+++ hive/branches/branch-0.7/eclipse-templates/.classpath Wed Feb 16 18:14:18 2011
@@ -10,7 +10,6 @@
<classpathentry exported="true" kind="lib" path="cli/lib/jline-@jline.version@.jar"/>
<classpathentry exported="true" kind="lib" path="lib/json.jar"/>
<classpathentry exported="true" kind="lib" path="lib/asm-@asm.version@.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/commons-cli-@commons-cli.version@.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-codec-@commons-codec.version@.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-lang-@commons-lang.version@.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-logging-@commons-logging.version@.jar"/>
@@ -29,6 +28,7 @@
<classpathentry kind="lib" path="build/dist/lib/datanucleus-core-@datanucleus-core.version@.jar"/>
<classpathentry kind="lib" path="build/dist/lib/datanucleus-enhancer-@datanucleus-enhancer.version@.jar"/>
<classpathentry kind="lib" path="build/dist/lib/datanucleus-rdbms-@datanucleus-rdbms.version@.jar"/>
+ <classpathentry kind="lib" path="build/dist/lib/commons-cli-@commons-cli.version@.jar"/>
<classpathentry kind="lib" path="build/dist/lib/commons-collections-@commons-collections.version@.jar"/>
<classpathentry kind="lib" path="build/dist/lib/commons-dbcp-@commons-dbcp.version@.jar"/>
<classpathentry kind="lib" path="build/dist/lib/datanucleus-connectionpool-@datanucleus-connectionpool.version@.jar"/>
Modified: hive/branches/branch-0.7/ivy/libraries.properties
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/ivy/libraries.properties?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/ivy/libraries.properties (original)
+++ hive/branches/branch-0.7/ivy/libraries.properties Wed Feb 16 18:14:18 2011
@@ -27,7 +27,7 @@ datanucleus-core.version=2.0.3
datanucleus-enhancer.version=2.0.3
datanucleus-rdbms.version=2.0.3
checkstyle.version=5.0
-commons-cli.version=2.0-SNAPSHOT
+commons-cli.version=1.2
commons-codec.version=1.3
commons-collections.version=3.2.1
commons-dbcp.version=1.4
Modified: hive/branches/branch-0.7/shims/build.xml
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/shims/build.xml?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/shims/build.xml (original)
+++ hive/branches/branch-0.7/shims/build.xml Wed Feb 16 18:14:18 2011
@@ -60,7 +60,7 @@ to call at top-level: ant deploy-contrib
<target name="compile" depends="init">
<antcall target="build_shims" inheritRefs="false" inheritAll="false">
- <param name="hadoop.version.ant-internal" value="0.20.0" />
+ <param name="hadoop.version.ant-internal" value="${hadoop.version}" />
</antcall>
<antcall target="build_shims" inheritRefs="false" inheritAll="false">
<param name="hadoop.version.ant-internal" value="${hadoop.security.version}" />
Modified: hive/branches/branch-0.7/shims/ivy.xml
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.7/shims/ivy.xml?rev=1071351&r1=1071350&r2=1071351&view=diff
==============================================================================
--- hive/branches/branch-0.7/shims/ivy.xml (original)
+++ hive/branches/branch-0.7/shims/ivy.xml Wed Feb 16 18:14:18 2011
@@ -1,7 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
<ivy-module version="2.0">
<info organisation="org.apache.hadoop.hive" module="shims"/>
<dependencies>
- <dependency org="hadoop" name="core" rev="0.20.0">
+ <dependency org="hadoop" name="core" rev="${hadoop.version}">
<artifact name="hadoop" type="source" ext="tar.gz"/>
</dependency>
<dependency org="hadoop" name="core" rev="${hadoop.security.version}">