· 6 years ago · Jun 20, 2019, 02:34 PM
1create table if not exists purchase_history as
2select 1 as id, "Saturday" as day_of_week, "male" as gender, 600 as price, "book" as category, 1 as label
3union all
4select 2 as id, "Friday" as day_of_week, "female" as gender, 4800 as price, "sports" as category, 0 as label
5union all
6select 3 as id, "Friday" as day_of_week, "other" as gender, 18000 as price, "entertainment" as category, 0 as label
7union all
8select 4 as id, "Thursday" as day_of_week, "male" as gender, 200 as price, "food" as category, 0 as label
9union all
10select 5 as id, "Wednesday" as day_of_week, "female" as gender, 1000 as price, "electronics" as category, 1 as label
11;
12
13create table if not exists training as
14select
15id,
16array_concat( – concatenate two arrays of quantitative and categorical features into single array
17quantitative_features(
18array("price"), – quantitative feature names
19price – corresponding column names
20),
21categorical_features(
22array("day of week", "gender", "category"), – categorical feature names
23day_of_week, gender, category – corresponding column names
24)
25) as features,
26label
27from
28purchase_history
29;
30
31at org.apache.hadoop.hive.ql.exec.mr.ExecMapper.close(ExecMapper.java:211)
32 at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:61)
33 at org.apache.hadoop.hive.ql.exec.mr.ExecMapRunner.run(ExecMapRunner.java:37)
34 at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:465)
35 at org.apache.hadoop.mapred.MapTask.run(MapTask.java:349)
36 at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:174)
37 at java.security.AccessController.doPrivileged(Native Method)
38 at javax.security.auth.Subject.doAs(Subject.java:422)
39 at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1729)
40 at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:168)
41Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Error evaluating id
42 at org.apache.hadoop.hive.ql.exec.vector.VectorSelectOperator.process(VectorSelectOperator.java:149)
43 at org.apache.hadoop.hive.ql.exec.Operator.vectorForward(Operator.java:966)
44 at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:939)
45 at org.apache.hadoop.hive.ql.exec.TableScanOperator.process(TableScanOperator.java:125)
46 at org.apache.hadoop.hive.ql.exec.vector.VectorMapOperator.closeOp(VectorMapOperator.java:990)
47 at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:733)
48 at org.apache.hadoop.hive.ql.exec.mr.ExecMapper.close(ExecMapper.java:193)
49 ... 9 more
50Caused by: java.lang.RuntimeException: org.apache.hadoop.hive.ql.exec.UDFArgumentException: argument must be a constant value: array<string>
51 at org.apache.hadoop.hive.ql.exec.vector.udf.VectorUDFAdaptor.evaluate(VectorUDFAdaptor.java:106)
52 at org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression.evaluateChildren(VectorExpression.java:271)
53 at org.apache.hadoop.hive.ql.exec.vector.udf.VectorUDFAdaptor.evaluate(VectorUDFAdaptor.java:111)
54 at org.apache.hadoop.hive.ql.exec.vector.VectorSelectOperator.process(VectorSelectOperator.java:146)
55 ... 15 more
56Caused by: org.apache.hadoop.hive.ql.exec.UDFArgumentException: argument must be a constant value: array<string>
57 at hivemall.utils.hadoop.HiveUtils.getConstStringArray(HiveUtils.java:502)
58 at hivemall.ftvec.trans.QuantitativeFeaturesUDF.initialize(QuantitativeFeaturesUDF.java:80)
59 at org.apache.hadoop.hive.ql.exec.vector.udf.VectorUDFAdaptor.init(VectorUDFAdaptor.java:89)
60 at org.apache.hadoop.hive.ql.exec.vector.udf.VectorUDFAdaptor.evaluate(VectorUDFAdaptor.java:104)
61 ... 18 more
62
631 "price:600.0","day of week#Saturday","gender#male","category#book" 1
642 "price:4800.0","day of week#Friday","gender#female","category#sports"0
653 "price:18000.0","day of week#Friday","gender#other","category#entertainment" 0
664 "price:200.0","day of week#Thursday","gender#male","category#food" 0
675 "price:1000.0","day of week#Wednesday","gender#female","category#electronics" 1