错误写法:
if(size(ip)>10, (ip[0],ip[1],ip[2],ip[3],ip[4],ip[5],ip[6],ip[7],ip[8],ip[9]), ip) as ip,
报错显示:
Cannot convert column from string to array.解决办法
正确语法:
if(size(ip)>10, array(ip[0],ip[1],ip[2],ip[3],ip[4],ip[5],ip[6],ip[7],ip[8],ip[9]), ip) as ip,
坑:
参考https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF