You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Carl Steinbach (JIRA)" <ji...@apache.org> on 2009/10/26 03:14:59 UTC

[jira] Created: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

cli.sh can not correctly identify Hadoop minor version numbers less than 20
---------------------------------------------------------------------------

                 Key: HIVE-902
                 URL: https://issues.apache.org/jira/browse/HIVE-902
             Project: Hadoop Hive
          Issue Type: Bug
            Reporter: Carl Steinbach


cli.sh uses the following logic to detect the version of hadoop:

  version=$($HADOOP version | awk '{print $2;}');

  if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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

Apparently bash doesn't expect you to quote the regex:

% ./bash -version
GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)

% hadoop version
Hadoop 0.19.0
Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008

% version=$(hadoop version | awk '{print $2;}')

% echo $version
0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by

% [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
No

% [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
No

% [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
Yes



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Carl Steinbach (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl Steinbach updated HIVE-902:
--------------------------------

    Attachment: HIVE-902.repair.3.patch

- Fix version comparison logic.

> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>            Assignee: Carl Steinbach
>             Fix For: 0.4.1, 0.5.0
>
>         Attachments: HIVE-902.1.patch, HIVE-902.2.patch, HIVE-902.repair.2.patch, HIVE-902.repair.3.patch, HIVE-902.repair.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Carl Steinbach (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772695#action_12772695 ] 

Carl Steinbach commented on HIVE-902:
-------------------------------------

Zheng, can you test the updated patch on Bash 3.1? I can't get 3.1 to build because of readline problems. Thanks.

> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>            Assignee: Carl Steinbach
>             Fix For: 0.4.1, 0.5.0
>
>         Attachments: HIVE-902.1.patch, HIVE-902.2.patch, HIVE-902.repair.2.patch, HIVE-902.repair.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Carl Steinbach (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl Steinbach updated HIVE-902:
--------------------------------

    Attachment: HIVE-902.repair.2.patch

- HIVE-902.repair.patch does not work on Bash 4.0.33

- Underlying issue is described here: http://stackoverflow.com/questions/218156/bash-regex-with-quotes

- Tested HIVE-902.repair.2.patch on Bash 4.0.33 and 3.2.17

> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>            Assignee: Carl Steinbach
>             Fix For: 0.4.1, 0.5.0
>
>         Attachments: HIVE-902.1.patch, HIVE-902.2.patch, HIVE-902.repair.2.patch, HIVE-902.repair.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772641#action_12772641 ] 

Zheng Shao commented on HIVE-902:
---------------------------------

Please replace [0-9]+ with [[:digit:]]+ in the previous comment - that was for debugging.

> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>            Assignee: Carl Steinbach
>             Fix For: 0.4.1, 0.5.0
>
>         Attachments: HIVE-902.1.patch, HIVE-902.2.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Carl Steinbach (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl Steinbach updated HIVE-902:
--------------------------------

    Attachment: HIVE-902.2.patch

- Adjusted regex to handle version numbers like "0.17.2.1"
- On error, now prints out string returned by 'hadoop version'.
- Verified that this works on Bash 3.2.17


> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>         Attachments: HIVE-902.1.patch, HIVE-902.2.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772391#action_12772391 ] 

Zheng Shao commented on HIVE-902:
---------------------------------

HIVE-902.1.patch:

I remember there is a hadoop version 0.17.2.1. It seems the patch does not handle this case.
Can you change the regex to work for that?
Also, please print out the hadoop version in the error message in case we cannot detect hadoop version, to make it easier to debug.

Can you also help try it out on earlier versions of bash (bash 3.00 for example)?


> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>         Attachments: HIVE-902.1.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772437#action_12772437 ] 

Zheng Shao commented on HIVE-902:
---------------------------------

+1. Will commit after test passes.


> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>         Attachments: HIVE-902.1.patch, HIVE-902.2.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zheng Shao updated HIVE-902:
----------------------------

    Attachment: HIVE-902.repair.patch

Carl, can you help test HIVE-902.repair.patch on bash 4.00?

> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>            Assignee: Carl Steinbach
>             Fix For: 0.4.1, 0.5.0
>
>         Attachments: HIVE-902.1.patch, HIVE-902.2.patch, HIVE-902.repair.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772639#action_12772639 ] 

Zheng Shao commented on HIVE-902:
---------------------------------

Carl, it turns out bash 3.00 is complaining:
{code}
hive/bin/ext/cli.sh: line 19: syntax error in conditional expression: unexpected token `('
hive/bin/ext/cli.sh: line 19: syntax error near `^(['
hive/bin/ext/cli.sh: line 19: `  if [[ $version =~ ^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+).*$ ]]; then'
hive/bin/hive: line 173: cli: command not found
{code}

I tried both:
{code}
if [[ $version =~ "^([0-9]+)\.([[:digit:]]+)\.([[:digit:]]+).*$" ]]; then
  major_ver=${BASH_REMATCH[1]};
  minor_ver=${BASH_REMATCH[2]};
  patch_ver=${BASH_REMATCH[3]};
  echo $major_ver $minor_ver $patch_ver;
fi
{code}

and
{code}
if [[ "$version" =~ ^"([0-9]+)\.([[:digit:]]+)\.([[:digit:]]+).*"$ ]]; then
  major_ver=${BASH_REMATCH[1]};
  minor_ver=${BASH_REMATCH[2]};
  patch_ver=${BASH_REMATCH[3]};
  echo $major_ver $minor_ver $patch_ver;
fi
{code}

Both of these worked on bash 3.00.

Can you try these out on bash 4.00? Once it works, can you post another patch on top of the first one (since the first one is already committed..


> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>            Assignee: Carl Steinbach
>             Fix For: 0.4.1, 0.5.0
>
>         Attachments: HIVE-902.1.patch, HIVE-902.2.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zheng Shao updated HIVE-902:
----------------------------

       Resolution: Fixed
    Fix Version/s: 0.5.0
                   0.4.1
     Release Note: HIVE-902. Fix cli.sh to work with hadoop versions less than 20. (Carl Steinbach via zshao)
     Hadoop Flags: [Reviewed]
           Status: Resolved  (was: Patch Available)

Committed. Thanks Carl!

> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>            Assignee: Carl Steinbach
>             Fix For: 0.4.1, 0.5.0
>
>         Attachments: HIVE-902.1.patch, HIVE-902.2.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Carl Steinbach (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl Steinbach updated HIVE-902:
--------------------------------

    Status: Patch Available  (was: Open)

> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>         Attachments: HIVE-902.1.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zheng Shao reassigned HIVE-902:
-------------------------------

    Assignee: Carl Steinbach

> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>            Assignee: Carl Steinbach
>         Attachments: HIVE-902.1.patch, HIVE-902.2.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Carl Steinbach (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl Steinbach updated HIVE-902:
--------------------------------

    Attachment: HIVE-902.1.patch

> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>         Attachments: HIVE-902.1.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVE-902) cli.sh can not correctly identify Hadoop minor version numbers less than 20

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772643#action_12772643 ] 

Zheng Shao commented on HIVE-902:
---------------------------------

By the way, we also want to make it compatible with internal versions like "0.20". Can you make the third argument (patch var) optional in the regex?


> cli.sh can not correctly identify Hadoop minor version numbers less than 20
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-902
>                 URL: https://issues.apache.org/jira/browse/HIVE-902
>             Project: Hadoop Hive
>          Issue Type: Bug
>            Reporter: Carl Steinbach
>            Assignee: Carl Steinbach
>             Fix For: 0.4.1, 0.5.0
>
>         Attachments: HIVE-902.1.patch, HIVE-902.2.patch
>
>
> cli.sh uses the following logic to detect the version of hadoop:
>   version=$($HADOOP version | awk '{print $2;}');
>   if [[ $version =~ "^0\.17" ]] || [[ $version =~ "^0\.18" ]] || [[ $version =~ "^0.19" ]]; 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
> Apparently bash doesn't expect you to quote the regex:
> % ./bash -version
> GNU bash, version 4.0.0(1)-release (i386-apple-darwin9.8.0)
> % hadoop version
> Hadoop 0.19.0
> Subversion https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 -r 713890
> Compiled by ndaley on Fri Nov 14 03:12:29 UTC 2008
> % version=$(hadoop version | awk '{print $2;}')
> % echo $version
> 0.19.0 https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19 by
> % [[ $version =~ "^0\.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ "^0.19" ]] && echo "Yes" || echo "No"
> No
> % [[ $version =~ ^0.19 ]] && echo "Yes" || echo "No"
> Yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.