MaxCompute中,CAST(substr(sdk_channel,1,1) AS BIGINT) = 1 或 CAST(t.is_client AS BIGINT) = 1 报错: Illegal type cast - in function cast, value 'n' cannot be casted from String to Bigint
substr 是对字符串截取 (),该函数里面的 两个参数 是 下标和截取个数,代码截的是 string类型,外面的 cast 函数是对类型进行转换,如果里面截出来的例如:abc,根本无法转换成 bigint,如果截出来是数字 123 是可以的 转成 bigint的。 例如:select cast(substr("1234",1,1) as BIGINT );
如有更多疑问咨询可以加入MaxCompute开发者社区钉群点击链接
阿里大数据官方技术圈