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 failed.
 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();
  System.out.println(len);
  String r=s.substring(28, 29);
  System.out.println(r);
 }
}
=======================================

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

can anyone help?

Reply via email to