2

BigQuery と GithubArchive を試してみることを考えていましたが、コードまたはプロジェクト内の用語を検索し、コミット数の降順で結果を並べ替えるクエリを作成する方法がわかりません。

ヒントをありがとう

4

2 に答える 2

1

BigQuery に読み込まれた GithubArchive データにはソースコードのコピーがないため、コード内の検索用語は使用できません。ただし、リポジトリの説明で用語を検索し、コミット数で上位のリポジトリを選択する場合は、その方法の例を次に示します (この例では用語は「SQL」です)。

select count(*) c, repository_url, repository_description
from [githubarchive:github.timeline]
where type = 'PushEvent' and repository_description contains 'SQL'
group by 2, 3
order by c desc
limit 10

これにより、

14925   https://github.com/danberindei/infinispan   Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.  
9377    https://github.com/postgres/postgres    Mirror of the official PostgreSQL GIT repository. Note that this is just a *mirror* - we don't work with pull requests on github. To contribute, please see http://wiki.postgresql.org/wiki/Submitting_a_Patch   
4876    https://github.com/galderz/infinispan   Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.  
4747    https://github.com/triAGENS/ArangoDB    ArangoDB is a multi-purpose, open-source database with flexible data models for documents, graphs, and key-values. Build high performance applications using a convenient SQL-like query language or JavaScript/Ruby extensions. Use ACID transaction if you require them. Scale horizontally and vertically with a few mouse clicks.    
3590    https://github.com/webnotes/erpnext Open Source, web-based ERP based on Python, Javascript and MySQL.    
3489    https://github.com/anistor/infinispan   Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.  
3263    https://github.com/youtube/vitess   vitess provides servers and tools which facilitate scaling of MySQL databases for large scale web services.  
3071    https://github.com/infinispan/infinispan    Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.  
2631    https://github.com/theory/sqitch    Simple SQL change management     
2358    https://github.com/zzzeek/sqlalchemy    Mirror of SQLAlchemy
于 2015-11-28T01:41:40.840 に答える
1
SELECT COUNT(1) c, repository_url, repository_description
FROM [githubarchive:github.timeline]
WHERE type = 'PushEvent' 
AND REGEXP_MATCH(repository_description, r'(?i)SQL')
GROUP BY 2, 3
ORDER BY c DESC
LIMIT 10

BigQuery は正規表現をサポートしているため、検索パターンと検索用語を柔軟に使用して、検索結果を大幅に改善または絞り込むことができます

以下の参考文献がさらに役立ちます。

BigQuery 正規表現関数
re2 構文

于 2015-11-28T17:57:39.797 に答える