This is an automated email from the ASF dual-hosted git repository.
mbudiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push:
new e4f63f9f0b [CALCITE-6493] Add MySQL and other professional term
restrictions
e4f63f9f0b is described below
commit e4f63f9f0ba1ec8b7ae00ac3a0922e84528b9b60
Author: cancaicai <[email protected]>
AuthorDate: Wed Sep 11 15:44:35 2024 +0800
[CALCITE-6493] Add MySQL and other professional term restrictions
---
.../java/org/apache/calcite/test/LintTest.java | 26 ++++++++++++++++++++++
site/develop/index.md | 3 +++
2 files changed, 29 insertions(+)
diff --git a/core/src/test/java/org/apache/calcite/test/LintTest.java
b/core/src/test/java/org/apache/calcite/test/LintTest.java
index bbc520c591..a2605fa6e5 100644
--- a/core/src/test/java/org/apache/calcite/test/LintTest.java
+++ b/core/src/test/java/org/apache/calcite/test/LintTest.java
@@ -41,7 +41,9 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.regex.Matcher;
@@ -66,6 +68,8 @@ class LintTest {
Pattern.compile("^(\\[CALCITE-[0-9]{1,4}][ ]).*");
private static final Path ROOT_PATH =
Paths.get(System.getProperty("gradle.rootDir"));
+ private static final Map<String, String> TERMINOLOGY_MAP = new HashMap<>();
+
@SuppressWarnings("Convert2MethodRef") // JDK 8 requires lambdas
private Puffin.Program<GlobalState> makeProgram() {
return Puffin.builder(GlobalState::new, global -> new FileState(global))
@@ -359,6 +363,19 @@ class LintTest {
empty());
}
+ static {
+ TERMINOLOGY_MAP.put("mysql", "MySQL");
+ TERMINOLOGY_MAP.put("mssql", "MSSQL");
+ TERMINOLOGY_MAP.put("Mysql", "MySQL");
+ TERMINOLOGY_MAP.put("postgresql", "PostgreSQL");
+ TERMINOLOGY_MAP.put("hive", "Hive");
+ TERMINOLOGY_MAP.put("spark", "Spark");
+ TERMINOLOGY_MAP.put("arrow", "Arrow");
+ TERMINOLOGY_MAP.put("presto", "Presto");
+ TERMINOLOGY_MAP.put("oracle", "Oracle");
+ TERMINOLOGY_MAP.put("bigquery", "BigQuery");
+ }
+
private static void checkMessage(String subject, String body,
Consumer<String> consumer) {
if (body.contains("Lint:skip")) {
@@ -393,6 +410,15 @@ class LintTest {
if (subject2.matches("[a-z].*")) {
consumer.accept("Message must start with upper-case letter");
}
+
+ // Check for keywords that should be capitalized
+ for (Map.Entry<String, String> entry : TERMINOLOGY_MAP.entrySet()) {
+ String keyword = entry.getKey();
+ String correctCapitalization = entry.getValue();
+ if (subject2.matches(".*\\b" + keyword + "\\b.*")) {
+ consumer.accept("Message must be capitalized as '" +
correctCapitalization + "'");
+ }
+ }
}
/** Ensures that the {@code contributors.yml} file is sorted by name. */
diff --git a/site/develop/index.md b/site/develop/index.md
index 3bacd91e32..de3221609a 100644
--- a/site/develop/index.md
+++ b/site/develop/index.md
@@ -196,6 +196,9 @@ the implementation ("Add handler for FileNotFound").
* If you are fixing a bug, it is sufficient to describe the bug
("NullPointerException if user is unknown") and people will correctly
surmise that the purpose of your change is to fix the bug.
+* If your Jira title refers to terminology, please capitalize the first
+ letter ("arrow -> Arrow") and properly format the names of software and
+ technologies (e.g., "Mysql -> MySQL").
Then push your commit(s) to GitHub, and create a pull request from
your branch to the calcite main branch. Update the JIRA case