こんにちは、私はこのようなデータを持っています:
{"user_id": "kim95", "type": "Book", "title": "Modern Database Systems: The Object Model, Interoperability, and Beyond.", "year": "1995", "publisher": " ACM Press and Addison-Wesley", "authors": [{"name":"null"}], "source": "DBLP"}
{"user_id": "marshallo79", "type": "本", "title": "不等式: 多数派の理論とその応用.", "年": "1979", "出版社": "学術出版", "authors": [{"name":"Albert W. Marshall"},{"name":"Ingram Olkin"}], "source": "DBLP"}
{"user_id": "knuth86a", "type": "Book", "title": "TeX: The Program", "year": "1986", "publisher": "Addison-Wesley", "authors": [{"name":"Donald E. Knuth"}], "source": "DBLP"} ...
そして、発行者、タイトルを取得してからグループにカウントを適用したいのですが、次のスクリプトで「列が必要です...」というエラーが発生しました。
books = load 'data/book-seded-workings-reduced.json'
using JsonLoader('user_id:chararray,type:chararray,title:chararray,year:chararray,publisher:chararray,authors:{(name:chararray)},source:chararray');
doc = group books by publisher;
res = foreach doc generate group,books.title,count(books.publisher);
DUMP res;
2番目のクエリでは、次のような構造にしたいと思います:(name,year),title
だから私はこれを試しました:
books = load 'data/book-seded-workings-reduced.json'
using JsonLoader('user_id:chararray,type:chararray,title:chararray,year:chararray,publisher:chararray,authors:{(name:chararray)},source:chararray');
flat =group books by (generate FLATTEN((authors.name),year);
tab = foreach flat generate group, books.title;
DUMP tab;
しかし、それもうまくいきません...
何かアイデアはありますか?