直接在hql中使用中文会报错:
org.apache.hadoop.ipc.RemoteException:
java.io.IOException: java.lang.RuntimeException:
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException:
Invalid byte 1 of 1-byte UTF-8
sequence.
at
org.apache.hadoop.mapred.JobTracker.submitJob(JobTracker.java:3759)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown
Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.hadoop.ipc.RPC$Server.call(RPC.java:557)
at
org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1416)
at
org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1412)
at java.security.AccessController.doPrivileged(Native
Method)
at
javax.security.auth.Subject.doAs(Subject.java:396)
at
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1115)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1410)
Caused by:
java.lang.RuntimeException:
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException:
Invalid byte 1 of 1-byte UTF-8
sequence.
at
org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1387)
at
org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:1261)
at
org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1192)
at
org.apache.hadoop.conf.Configuration.get(Configuration.java:415)
at
org.apache.hadoop.mapred.JobConf.checkAndWarnDeprecation(JobConf.java:1957)
at
org.apache.hadoop.mapred.JobConf.<init>(JobConf.java:386)
at
org.apache.hadoop.mapred.JobInProgress.<init>(JobInProgress.java:413)
at
org.apache.hadoop.mapred.JobTracker.submitJob(JobTracker.java:3757)
... 10 more
受文章http://superlxw1234.iteye.com/blog/1622414
“用java中匹配中文的正则即可:
Sql代码
?
1 |
|
”的启发,使用unicode码(反斜线需转义):province rlike
‘^(\\u5317\\u4eac|\\u5929\\u6d25)‘