【发布时间】:2015-08-12 08:46:28
【问题描述】:
我正在尝试执行此查询:
add FILE /home/user1/test/test_udf.py;
SELECT a.hash_code, col2
FROM (SELECT transform (col2, col3) using 'python test_udf.py' as hash_code, col2
FROM sample_table) a ;
我能够使用 udf 成功生成 hash_code,但另一列 (col2) 被填充为 NULL。
样本输出:
sjhfshhalksjlkfj128798172jasjhas NULL
ajsdlkja982988290819189089089889 NULL
jhsad817982mnsandkjsahj982398290 NULL
【问题讨论】:
-
SELECT a.hash_code, a.col2 from (select transform (col2,col3) using 'python test_udf.py' as hash_code, col2 from sample_table) a ;也给出了相同的结果
-
真值是
NULL吗? -
不,我在“col2”列中有有效值
-
试试
SELECT a.hash_code, a.col2 from (select col2, transform (col2,col3) using 'python test_udf.py' as hash_codefrom sample_table) a? -
对于上述查询,我的查询失败,“无法在选择表达式中识别 'transform' '(' 'package_id' 附近的输入。我将原始查询粘贴在这里供您参考。SELECT a.hash_code ,a.package_id from (select package_id, transform (package_id,file_name,system) using 'python md5hash_conv_udf.py' as hash_code from raw_pharm_pbm.audit_table) a ;