Skip to content

Commit

Permalink
[CALCITE-6125] Automate generation of contributor names in release no…
Browse files Browse the repository at this point in the history
…tes by adding a git mailmap file

Add entries to .mailmap to that release notes since 1.29
would be generated correctly.

Update HOWTO examples showing how to generate release notes.

Add a lint test to ensure that .mailmap remains sorted.

Close #3533
  • Loading branch information
julianhyde committed Nov 20, 2023
1 parent 1eb6551 commit 343132e
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 7 deletions.
148 changes: 148 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Git mail map; see 'git help mailmap' for details.
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to you under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
Abhishek Dasgupta <abhishekdasgupta005@gmail.com>
Adam Kennedy <adamkennedybackup@gmail.com>
Alan Jin <jinlantao@gmail.com>
Ali Mansour <Ali.MANSOUR@murex.com>
Amir Gajst <amir.gajst@sisense.com>
Botong Huang <botong.huang@alibaba-inc.com>
Cancai Cai <77189278+caicancai@users.noreply.github.com>
Charbel Yazbeck <cyazbeck@murex.com>
Chen Kai <chk19940609@gmail.com>
Chunhui Shi <cshi@maprtech.com>
Chunwei Lei <chunwei.lcw@alibaba-inc.com>
Chunwei Lei <chunwei.leii@gmail.com>
Chunwei Lei <chunweilcw@163.com>
Daniel Henneberger <git@danielhenneberger.com>
Daniel Henneberger <me@danielhenneberger.com>
Danny Chan <yuzhao.cyz@alibaba-inc.com>
Danny Chan <yuzhao.cyz@gmail.com>
Darion Yaphet <darion.yaphet@gmail.com>
David Handermann <exceptionfactory@apache.org>
Dhirenda Gautam <dhirenda.gautam@datametica.com>
Divyanshu Srivastava <divyanshu.s@datametica.com>
Dmitry Sysolyatin <dm.sysolyatin@gmail.com>
Dmitry Sysolyatin <dmsysolyatin@gmail.com>
Drew Schmitt <dasch@google.com>
Dylan Adams <dylan.adams@gmail.com>
Evgeniy Stanilovskiy <eugen.stan@netdava.com> # aka Eugen Stan, Evgeny Stanilovsky
Evgeniy Stanilovskiy <stanilovsky@gmail.com>
Feng Guo <guofeng.my@bytedance.com>
Feng Zhu <fengzhu@apache.org> # DonnyZone at github
Feng Zhu <fenzhu@ebay.com>
Feng Zhu <wellfengzhu@gmail.com>
Feng Zhu <wellfengzhu@tencent.com>
Godfrey He <godfreyhe@163.com>
Hequn Cheng <chenghequn@gmail.com>
Hong Shen (沈洪) <yuling.sh@alipay.com>
Hongyu Guo <macroguo@tencent.com>
Hongze Zhang <hongzezhang@tencent.com>
Hsuan-Yi Chu <hsuanyichu@apache.org>
Ian Bertolacci <ian.bertolacci@workday.com>
Jacky Lau <jackylau@apache.org> # aka Yong Liu
Jacky Lau <yongen.ly@alibaba-inc.com>
Jacky Woo <wuchienchao@qq.com>
Jacky Yin <jacky.yin@eoitek.com>
James Kim <james.kim@dremio.com>
Janhui Dong <dongjianhui03@meituan.com>
Jark Wu (云邪) <wuchong.wc@alibaba-inc.com>
Jasmin Trada <jasmin.trada@dremio.com>
Jay Narale <jay.narale@dremio.com>
Jeffery Zhang (张俭) <zj48271@ly.com>
Jerin John <jerinjohn@google.com>
Jiajun Xie <jiajunbernoulli@foxmail.com> # aka Jake Xie, Jiajin Bernoulli
Jiasen Sheng <angelzouxin@gmail.com>
Jin Xing <jinxing.corey@gmail.com>
Jin Xing <jx158167@antfin.com> # aka jx158167
Joey Moore <jhugomoore@google.com>
Johannes Schulte <johannes.schulte@gmail.com>
Julian Feinauer <j.feinauer@pragmaticminds.de>
Julian Hyde <jhyde@apache.org>
Julian Hyde <jhyde@hydromatic.net>
Julian Hyde <julian.hyde@looker.com>
Julian Hyde <julianhyde@gmail.com>
Kevin Liew <kliew@apache.org>
Kevin Liew <kliewkliew@users.noreply.github.com>
Khawla Mouhoubi <mouhoubi.khawla@gmail.com>
Konstantin Orlov <korlov@gridgain.com>
Krisztian Kasa <kasakrisz2@gmail.com>
Lei Shen <shenlang@zbyte-inc.com>
LeoWangLZ <wanglongzhong2006@163.com> # aka Rheet Wong?
Liao Xintao <chiyou@taobao.com>
Lincoln Lee <lincoln.lil@alibaba-inc.com>
Liya Fan <fan_li_ya@foxmail.com>
Louis Kang <louiskuang@google.com> # aka LM Kang
Maryann Xue <maryann.xue@gmail.com>
Maryann Xue <wei.xue@intel.com>
Min Dai <daimin@outlook.com>
Mingcan Wang <jiefei30@126.com>
Mou Wu <wumou.4wei@outlook.com>
Mou Wu <wumou.wm@alibaba-inc.com>
Nick Riasanovsky <nick@bodo.ai> # aka Nicholas J Riasanovsky
Nishant Bangarwa <nishant.monu51@gmail.com>
Pavel Gubin <pavel@contiamo.com>
Pawel Ruchaj <pawel+gitlab@profimedia.co.uk>
Peng Wang <foxpengwang@tencent.com>
pengzhiwei <pengzhiwei2015@icloud.com>
Praveen Kumar <praveen@dremio.com>
Qi Yu (余启) <yuqi5@xiaomi.com>
Qianjin Xu <x1q1j1@163.com>
Rafay Qureshi <qureshi.rafay@gmail.com>
Ruben Quesada Lopez <rubenql@gmail.com>
Rui Wang <amaliujia@163.com>
Runkang He (何润康) <herunkang.runking@bytedance.com>
Runkang He (何润康) <hrunker@gmail.com>
Sandeep Chada <44845836+chadasa@users.noreply.github.com>
Sergei Tsvetkov <9326077@gmail.com>
Sergey Nuyanzin <snuyanzin@gmail.com>
Shikha Somani <shikha.somani@servicesource.com>
Shradha Ambekar <Shradha_Ambekar@intuit.com>
Shuming Li <ming.moriarty@gmail.com>
Shuo Cheng <shuo.cs@alibaba-inc.com>
Slim Bouguerra <slim.bouguerra@gmail.com>
Stamatis Zampetakis <15013153+zabetak@users.noreply.github.com>
Stamatis Zampetakis <zabetak@gmail.com>
Taras Ledkov <tledkov@gridgain.com>
Ted Xu (少杰) <shaojie@alibaba-inc.com>
Venki Korukanti <venki.korukanti@gmail.com>
Venki Korukanti <venki@dremio.com>
Vladimir Ozerov <ppozerov@gmail.com>
Vova Vysotskyi <vvovyk@gmail.com>
Wang Yanlin <1989yanlinwang@163.com>
Wang Yanlin <yanzhi.wyl@antfin.com>
Weijie Wu <wuweijie@apache.org>
Wenhui Tang <wenhui_tang@yeah.net>
Wenrui Meng <wenrui@singleorigin.tech>
Xiaogang Zhou <zhouxiaogang@shizhuang-inc.com>
Xiong Duan <nobigogle@gmail.com>
Xu ZhaoHui <953396112@qq.com> # aka dz, xzh
Xurenhe <xurenhe19910131@gmail.com> # aka wojustme
Yanjing Wang <hannerwang@tencent.com>
Yeong Wei <laiyw@persistent.my>
Yingyu Wang <yingyu.w@gmail.com>
Yingyu Wang <yingyuwang@users.noreply.github.com>
Yiqun Zhang <guiyanakuang@gmail.com>
Zhe Hu <iluffzhe@163.com>
Zhen Wang <awang@marinsoftware.com>
Zhen Wang <zinking3@gmail.com>
Zhengqiang Duan <duanzhengqiang@apache.org>
Zhiqiang He <absolute005@qq.com>
Zhiqiang He <zhiqianghe@apache.org>
Zhong Yu <yuzhong.yz@alibaba-inc.com>
Zou Dan <zoudan@bytedance.com>
Zuozhi Wang <zuozhi.wzz@alibaba-inc.com>
34 changes: 34 additions & 0 deletions core/src/test/java/org/apache/calcite/test/LintTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.checkerframework.checker.nullness.qual.Nullable;
import org.junit.jupiter.api.Test;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
Expand Down Expand Up @@ -408,6 +409,39 @@ private static void checkMessage(String subject, String body,
}
}

/** Ensures that the {@code .mailmap} file is sorted. */
@Test void testMailmapFile() {
final List<File> files = TestUnsafe.getTextFiles();
final File contributorsFile =
getOnlyElement(
filter(files, f -> f.getName().equals(".mailmap")));
final List<String> lines = new ArrayList<>();
forEachLineIn(contributorsFile, line -> {
if (!line.startsWith("#")) {
lines.add(line);
}
});
String line = firstOutOfOrder(lines, String.CASE_INSENSITIVE_ORDER);
if (line != null) {
fail("line '" + line + "' is out of order");
}
}

/** Performs an action for each line in a file. */
private static void forEachLineIn(File file, Consumer<String> consumer) {
try (BufferedReader r = Util.reader(file)) {
for (;;) {
String line = r.readLine();
if (line == null) {
break;
}
consumer.accept(line);
}
} catch (IOException e) {
throw Util.throwAsRuntime(e);
}
}

/** Returns the first element in a list that is out of order, or null if the
* list is sorted. */
private static <E> @Nullable E firstOutOfOrder(Iterable<E> elements,
Expand Down
3 changes: 2 additions & 1 deletion core/src/test/java/org/apache/calcite/util/TestUnsafe.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ public static List<File> getJavaFiles() {
/** Returns a list of text files in git. */
public static List<File> getTextFiles() {
return getGitFiles("*.bat", "*.cmd", "*.csv", "*.fmpp", "*.ftl",
"*.iq", "*.java", "*.json", "*.jj", "*.kt", "*.kts", "*.md",
"*.iq", "*.java", "*.json", "*.jj",
"*.kt", "*.kts", ".mailmap", "*.md",
"*.properties", "*.sh", "*.sql", "*.txt", "*.xml", "*.yaml",
"*.yml");
}
Expand Down
13 changes: 7 additions & 6 deletions site/_docs/howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -756,15 +756,16 @@ Before you start:
a fix version assigned (most likely the version we are
just about to release)

Generate a list of contributors by running the following (changing the
date literal to the date of the previous release):
Generate a list of contributors:
```
# Commits since 1.35
range=calcite-1.35.0..HEAD
# distinct authors
./sqlsh "select distinct author from git_commits where author_timestamp > DATE '2021-06-03' order by 1"
git log --abbrev-commit --pretty=format:'%aN,' $range | sort -u
# most prolific authors
./sqlsh "select author, count(*) from git_commits where commit_timestamp > DATE '2021-06-03' group by author order by 2"
# number of commits, distinct authors, and JIRA cases
./sqlsh "select count(*) as c, count(distinct author) as a, count(*) filter (where message like '%CALCITE-%') as j from git_commits where commit_timestamp > DATE '2021-06-03' order by 1"
git log --abbrev-commit --pretty=format:'%aN' $range | sort | uniq -c | sort -nr
# number of JIRA cases
git log --abbrev-commit --pretty=format:'%f' $range | awk -F- '$1 == "CALCITE" {print $2}' | sort -u | wc
```

Smoke-test `sqlline` with Spatial and Oracle function tables:
Expand Down

0 comments on commit 343132e

Please sign in to comment.