This is an automated email from the ASF dual-hosted git repository.

danny0405 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/master by this push:
     new ebbba56  [CALCITE-3871] Remove dependency of 
org.apiguardian:apiguardian-api
ebbba56 is described below

commit ebbba566fbdbdd0923adda596467090d708cc14b
Author: yuzhao.cyz <yuzhao....@gmail.com>
AuthorDate: Wed Mar 25 14:49:30 2020 +0800

    [CALCITE-3871] Remove dependency of org.apiguardian:apiguardian-api
    
    Also fix the pigunit version to 0.16.0.
---
 bom/build.gradle.kts                               |   1 -
 core/build.gradle.kts                              |   1 -
 .../java/org/apache/calcite/rel/RelWriter.java     |   3 +-
 .../main/java/org/apache/calcite/rex/RexNode.java  |   3 +-
 .../main/java/org/apache/calcite/rex/RexUtil.java  |   3 +-
 .../main/java/org/apache/calcite/runtime/Hook.java |   3 +-
 .../main/java/org/apache/calcite/sql/SqlKind.java  |   2 +-
 gradle.properties                                  |   3 +-
 linq4j/build.gradle.kts                            |   2 -
 .../main/java/org/apache/calcite/linq4j/API.java   | 120 +++++++++++++++++++++
 .../apache/calcite/linq4j/EnumerableDefaults.java  |   2 -
 11 files changed, 126 insertions(+), 17 deletions(-)

diff --git a/bom/build.gradle.kts b/bom/build.gradle.kts
index ed4e16d..4dc2867 100644
--- a/bom/build.gradle.kts
+++ b/bom/build.gradle.kts
@@ -104,7 +104,6 @@ dependencies {
         apiv("org.apache.pig:pig")
         apiv("org.apache.pig:pigunit", "pig")
         apiv("org.apache.spark:spark-core_2.10", "spark")
-        apiv("org.apiguardian:apiguardian-api")
         apiv("org.bouncycastle:bcpkix-jdk15on", "bouncycastle")
         apiv("org.bouncycastle:bcprov-jdk15on", "bouncycastle")
         apiv("org.cassandraunit:cassandra-unit")
diff --git a/core/build.gradle.kts b/core/build.gradle.kts
index f80da4c..caa7df2 100644
--- a/core/build.gradle.kts
+++ b/core/build.gradle.kts
@@ -41,7 +41,6 @@ dependencies {
 
     api("com.fasterxml.jackson.core:jackson-annotations")
     api("org.apache.calcite.avatica:avatica-core")
-    api("org.apiguardian:apiguardian-api")
 
     implementation("com.esri.geometry:esri-geometry-api")
     implementation("com.fasterxml.jackson.core:jackson-core")
diff --git a/core/src/main/java/org/apache/calcite/rel/RelWriter.java 
b/core/src/main/java/org/apache/calcite/rel/RelWriter.java
index 4f6d114..883d8bb 100644
--- a/core/src/main/java/org/apache/calcite/rel/RelWriter.java
+++ b/core/src/main/java/org/apache/calcite/rel/RelWriter.java
@@ -16,12 +16,11 @@
  */
 package org.apache.calcite.rel;
 
+import org.apache.calcite.linq4j.API;
 import org.apache.calcite.rex.RexNode;
 import org.apache.calcite.sql.SqlExplainLevel;
 import org.apache.calcite.util.Pair;
 
-import org.apiguardian.api.API;
-
 import java.util.List;
 
 /**
diff --git a/core/src/main/java/org/apache/calcite/rex/RexNode.java 
b/core/src/main/java/org/apache/calcite/rex/RexNode.java
index 7a8f058..37b3987 100644
--- a/core/src/main/java/org/apache/calcite/rex/RexNode.java
+++ b/core/src/main/java/org/apache/calcite/rex/RexNode.java
@@ -17,11 +17,10 @@
 package org.apache.calcite.rex;
 
 import org.apache.calcite.config.CalciteSystemProperty;
+import org.apache.calcite.linq4j.API;
 import org.apache.calcite.rel.type.RelDataType;
 import org.apache.calcite.sql.SqlKind;
 
-import org.apiguardian.api.API;
-
 import java.util.Collection;
 import java.util.concurrent.atomic.AtomicInteger;
 
diff --git a/core/src/main/java/org/apache/calcite/rex/RexUtil.java 
b/core/src/main/java/org/apache/calcite/rex/RexUtil.java
index 7dd6a9d..c53a7ea 100644
--- a/core/src/main/java/org/apache/calcite/rex/RexUtil.java
+++ b/core/src/main/java/org/apache/calcite/rex/RexUtil.java
@@ -16,6 +16,7 @@
  */
 package org.apache.calcite.rex;
 
+import org.apache.calcite.linq4j.API;
 import org.apache.calcite.linq4j.function.Predicate1;
 import org.apache.calcite.plan.RelOptPredicateList;
 import org.apache.calcite.plan.RelOptUtil;
@@ -50,8 +51,6 @@ import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 
-import org.apiguardian.api.API;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
diff --git a/core/src/main/java/org/apache/calcite/runtime/Hook.java 
b/core/src/main/java/org/apache/calcite/runtime/Hook.java
index 22ac163..c97d5f7 100644
--- a/core/src/main/java/org/apache/calcite/runtime/Hook.java
+++ b/core/src/main/java/org/apache/calcite/runtime/Hook.java
@@ -16,11 +16,10 @@
  */
 package org.apache.calcite.runtime;
 
+import org.apache.calcite.linq4j.API;
 import org.apache.calcite.rel.RelRoot;
 import org.apache.calcite.util.Holder;
 
-import org.apiguardian.api.API;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlKind.java 
b/core/src/main/java/org/apache/calcite/sql/SqlKind.java
index b3e42a8..b3366d8 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlKind.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlKind.java
@@ -16,7 +16,7 @@
  */
 package org.apache.calcite.sql;
 
-import org.apiguardian.api.API;
+import org.apache.calcite.linq4j.API;
 
 import java.util.Collection;
 import java.util.EnumSet;
diff --git a/gradle.properties b/gradle.properties
index a60e5de..73aee7f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -62,7 +62,6 @@ spotbugs.version=3.1.11
 # but prefer more recent versions.
 # elasticsearch does not like asm:6.2.1+
 aggdesigner-algorithm.version=6.0
-apiguardian-api.version=1.1.0
 asm.version=7.2
 bouncycastle.version=1.60
 cassandra-all.version=3.11.2
@@ -118,7 +117,7 @@ natty.version=0.13
 ojdbc8.version=19.3.0.0
 opencsv.version=2.3
 pig.version=0.16.0
-pigunit.version=
+pigunit.version=0.16.0
 postgresql.version=9.3-1102-jdbc41
 protobuf.version=3.6.1
 quidem.version=0.9
diff --git a/linq4j/build.gradle.kts b/linq4j/build.gradle.kts
index 7a9db17..b348101 100644
--- a/linq4j/build.gradle.kts
+++ b/linq4j/build.gradle.kts
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 dependencies {
-    api("org.apiguardian:apiguardian-api")
-
     implementation("com.google.guava:guava")
     implementation("org.apache.calcite.avatica:avatica-core")
 }
diff --git a/linq4j/src/main/java/org/apache/calcite/linq4j/API.java 
b/linq4j/src/main/java/org/apache/calcite/linq4j/API.java
new file mode 100644
index 0000000..9861d73
--- /dev/null
+++ b/linq4j/src/main/java/org/apache/calcite/linq4j/API.java
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+package org.apache.calcite.linq4j;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * {@code @API} is used to annotate public types, methods, constructors, and
+ * fields within a framework or application in order to publish their
+ * {@link #status} and level of stability and to indicate how they are intended
+ * to be used by {@link #consumers} of the API.
+ *
+ * <p>If {@code @API} is present on a type, it is considered to hold for all
+ * public members of the type as well. However, a member of such an annotated
+ * type is allowed to declare a {@link Status} of lower stability. For example,
+ * a class annotated with {@code @API(status = STABLE)} may declare a 
constructor
+ * for internal usage that is annotated with {@code @API(status = INTERNAL)}.
+ *
+ * <p>This annotation is inspired by
+ * <a 
href="https://github.com/apiguardian-team/apiguardian/blob/master/src/main/java/org/apiguardian/api/API.java";>apiguardian</a>,
+ * we move the annotation into our project because we don't want the project 
to have additional
+ * dependency jar which includes only a single Java file.
+ *
+ * @since 1.23.0
+ */
+@Target({ TYPE, METHOD, CONSTRUCTOR, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface API {
+
+  /**
+   * The current {@linkplain Status status} of the API.
+   */
+  Status status();
+
+  /**
+   * The version of the API when the {@link #status} was last changed.
+   *
+   * <p>Defaults to an empty string, signifying that the <em>since</em>
+   * version is unknown.
+   */
+  String since() default "";
+
+  /**
+   * List of packages belonging to intended consumers.
+   *
+   * <p>The supplied packages can be fully qualified package names or
+   * patterns containing asterisks that will be used as wildcards.
+   *
+   * <p>Defaults to {@code "*"}, signifying that the API is intended to be
+   * consumed by any package.
+   */
+  String[] consumers() default "*";
+
+  /**
+   * Indicates the status of an API element and therefore its level of
+   * stability as well.
+   */
+  enum Status {
+
+    /**
+     * Must not be used by any external code. Might be removed without prior
+     * notice.
+     */
+    INTERNAL,
+
+    /**
+     * Should no longer be used. Might disappear in the next minor release.
+     */
+    DEPRECATED,
+
+    /**
+     * Intended for new, experimental features where the publisher of the
+     * API is looking for feedback.
+     *
+     * <p>Use with caution. Might be promoted to {@link #MAINTAINED} or
+     * {@link #STABLE} in the future, but might also be removed without
+     * prior notice.
+     */
+    EXPERIMENTAL,
+
+    /**
+     * Intended for features that will not be changed in a 
backwards-incompatible
+     * way for at least the next minor release of the current major version.
+     * If scheduled for removal, such a feature will be demoted to
+     * {@link #DEPRECATED} first.
+     */
+    MAINTAINED,
+
+    /**
+     * Intended for features that will not be changed in a 
backwards-incompatible
+     * way in the current major version.
+     */
+    STABLE;
+
+  }
+
+}
diff --git 
a/linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java 
b/linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java
index 80ac509..e9530a1 100644
--- a/linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java
+++ b/linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java
@@ -40,8 +40,6 @@ import com.google.common.collect.HashMultiset;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Sets;
 
-import org.apiguardian.api.API;
-
 import java.math.BigDecimal;
 import java.util.AbstractList;
 import java.util.AbstractMap;

Reply via email to