問題タブ [udf]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
performance - 動作するPigAccumulatorInterface実装の良い例はありますか?
HDFSから何百万ものレコードを読み取り、それらを強化して、XMLファイルごとに10KレコードのバッチでXMLファイルとして保存する必要があります。
私はアキュムレータインターフェイスを試し、テストのためにpig.accumulative.batchsizeを2に設定しました。
ただし、呼び出されるメソッドは、Accumulatorの「accumulate」メソッドではなく「exec()」です。
私のUDFクラスの概要は次のとおりです。
java - A GenericUDF Function to Extract a Field From an Array of Structs
I am trying to write a GenericUDF function to collect all of a specific struct field(s) within an array for each record, and return them in an array as well.
I wrote the GenericUDF (as below), and it seems to work but:
1) It does not work when I am performing this on an external table, it works fine on a managed table, any idea?
2) I am having a tough time writing a test on this. I have attached the test I have so far, and it does not work, always getting 'java.util.ArrayList cannot be cast to org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector' or cannot cast String to LazyString', my question is how do I supply a list of structs for the evalue method?
Any help will be greatly appreciated.
The table:
A row of record holds:
1340321132000, 'some_company', [{"productCategory":"footwear"},{"productCategory":"eyewear"}]
This is my code:
My Test:
java - 自動インクリメント UDF はハイブで機能しますが、Impala では null を返します
自動増分値を作成する Java 関数を作成し、この関数に基づいてハイブ UDF も作成しました。ハイブでうまく機能します。この関数に基づいて Impala UDF を作成したところ、自動増分整数ではなく「null」が返されました。
Java UDF コードは次のとおりです。
ハイブ UDF の作成:
Impala UDF の作成:
Hive と Impala での使用:
どんな助けでも大歓迎です!ありがとう、アンナ
python - Apache Pig での Python UDF の使用
私は Apache Pig と Python を初めて使用します。Pig で Python 関数を登録しようとすると、Jython に関連するエラーが発生します。私の python スクリプトudf1.pyは、文字列を大文字に変換します。
Grunt シェルで Pig ローカル モードに登録しようとすると、以下のエラーがスローされます。
すでに pig_util.py をインポートしました。CDH に jython に関連するものをインストールする必要がありますか?.エラーを知ることができませんでした。
Pig バージョン: Apache Pig バージョン 0.11.0-cdh4.7.0
PyCharm Community Edition 4.0.4 を使用して作成された Python スクリプト
Python バージョン: Python 2.6.6 (r266:84292、2014 年 1 月 22 日、09:42:36)
python - Pig スクリプトが UDF を登録できない
作成した Python UDF を使用する単純な Pig スクリプトがあります。UDF 部分を削除すると、スクリプトは正常に完了します。しかし、UDF を登録しようとすると、次のエラーが発生します。
これは私のUDFです:
これは私の豚のスクリプトです:
HUE を使用して Pig を実行しています。データと UDF の両方が同じ HDFS の場所 (pig_test) にあります。