hive 中控制符作为分隔符的使用总结
2016-09-07 13:27
411 查看
hive 默认的字段分隔符为ascii码的控制符\001,建表的时候用fields terminated by '\001',如果要测试的话,造数据在vi 打开文件里面,用ctrl+v然后再ctrl+a可以输入这个控制符\001。按顺序,\002的输入方式为ctrl+v,ctrl+b。以此类推。
控制符在java代码中如何输入呢?采用如下方式:
byte[] bytes = new byte[] {5};
String sendString=new String( bytes ,"GBK");
这样可以输入控制符\005。
参考链接:
http://stackoverflow.com/questions/1635764/string-parsing-in-java-with-delimeter-tab-t-using-split http://zhidao.baidu.com/link?url=kSHmhRmwFMEsqlNfz3AIjlNdAX_zufuZEQCJ0zcecgACwn0yn-TFvnPv5FAROnC6LeOUK3TQgdEbjdDDYKise_
控制符在java代码中如何输入呢?采用如下方式:
byte[] bytes = new byte[] {5};
String sendString=new String( bytes ,"GBK");
这样可以输入控制符\005。
split public String[] split(String regex, int limit) Splits this string around matches of the given regular expression. The array returned by this method contains each substring of this string that is terminated by another substring that matches the given expression or is terminated by the end of the string. The substrings in the array are in the order in which they occur in this string. If the expression does not match any part of the input then the resulting array has just one element, namely this string. The limit parameter controls the number of times the pattern is applied and therefore affects the length of the resulting array. If the limit n is greater than zero then the pattern will be applied at most n - 1 times, the array's length will be no greater than n, and the array's last entry will contain all input beyond the last matched delimiter. If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded. The string "boo:and:foo", for example, yields the following results with these parameters: Regex Limit Result : 2 { "boo", "and:foo" } : 5 { "boo", "and", "foo" } : -2 { "boo", "and", "foo" } o 5 { "b", "", ":and:f", "", "" } o -2 { "b", "", ":and:f", "", "" } o 0 { "b", "", ":and:f" }
参考链接:
http://stackoverflow.com/questions/1635764/string-parsing-in-java-with-delimeter-tab-t-using-split http://zhidao.baidu.com/link?url=kSHmhRmwFMEsqlNfz3AIjlNdAX_zufuZEQCJ0zcecgACwn0yn-TFvnPv5FAROnC6LeOUK3TQgdEbjdDDYKise_
相关文章推荐
- 有关hive 中默认的用控制符作为分隔符的使用总结
- Hive创建表时使用Unicode字符作为字段分隔符(hive unicode character as delimiter)
- Flume使用Hive作为Sink总结
- Flume使用Hive作为Sink总结
- js函数split(),用空格作为分隔符时,使用正则表达式,会存在浏览器兼容问题
- SQLSERVER2005行版本控制的使用总结
- 使用mysql数据库作为Hive的元数据库
- TFS 使用与总结 你的源代码受控制的标志 Power Tools
- 使用MYSQL作为HIVE的METASTORE
- hive中使用保留关键字作为表中的列名
- Unix/Linux中进程控制相关命令总结&, jobs, fg, bg等命令的使用方法
- SQLSERVER2005行版本控制的使用总结
- hive指定多个字符作为列分隔符
- Sort使用Tab作为分隔符
- sort 使用 tab键 作为 分隔符_人生如梦_百度空间
- 竖杠|作为字符串分隔符的使用方法
- AJAX扩展控件ModalPopupExtender([代码控制]弹出模式对话框)的使用方法总结
- spring + mina 作为客户端解析H2协议的使用总结
- hive使用新的总结
- Hive SQL使用和数据加载的一点总结