hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yu Yang <>
Subject substr() index out of range exception in hive 0.8.1
Date Fri, 25 Jan 2013 03:58:46 GMT
Hi All,

I'm working on hive 0.8.1. and meet following problem.
I use function substr(item,-4,1) to process one item in hive table, and
there is one row in which the content of the item is
"ba_s0一朝忽觉京梦醒,半世浮沉雨打萍--衣俊卿小n实录010", then the job
 I checked the task log, it appeared

java.lang.StringIndexOutOfBoundsException: String index out of range

Then I tried this program on my PC,


//test substring()

public class substrtest {

 public static void main(String args[]){
  String s="ba_s0一朝忽觉京梦醒,半世浮沉雨打萍--衣俊卿小n实录010";
  int len=s.length();
  String r=s.substring(28, 29);

It worked. So I am confused why hive gave me index out of range exception.

can anyone help?
View raw message