Using map/reduce java classes in hive queries

后端 未结 3 863
执念已碎
执念已碎 2021-01-20 19:34

I read like, in hive queries we can use map/reduce scripts.

Can we use java map/reduce classes in Hive queries. If so, can you please provide me the sample.

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-20 20:04

    Assume you have created your "MyMapper" and "MyReducer" classes and put them in a "mymr.jar" jar file. You can use them through streaming as such:

    FROM (
    FROM src
    MAP inkey, inval
    USING 'java -cp myjar.jar
    com.myco.mymr.MyMapper'
    AS k, v
    CLUSTER BY k) mapout
    REDUCE k, v
    USING 'java -cp myjar.jar
    com.myco.mymr.MyReducer'
    

提交回复
热议问题