Annotation utilities for Apache Spark providing API stability annotations and test categorization tags
npx @tessl/cli install tessl/maven-org-apache-spark--spark-tags_2-11@2.4.0Apache Spark Tags provides annotation utilities for categorizing and marking API components and test suites in Apache Spark. It includes stability annotations to mark API maturity levels and test tags for organizing test execution in Spark's comprehensive testing infrastructure.
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-tags_2.11</artifactId>
<version>2.4.8</version>
</dependency>Main API annotations:
import org.apache.spark.annotation.*;Individual API annotations:
import org.apache.spark.annotation.Experimental;
import org.apache.spark.annotation.DeveloperApi;
import org.apache.spark.annotation.Private;
import org.apache.spark.annotation.AlphaComponent;
import org.apache.spark.annotation.InterfaceStability;Scala annotation:
import org.apache.spark.annotation.Since;Test tags (test scope only):
import org.apache.spark.tags.SlowHiveTest;
import org.apache.spark.tags.ExtendedHiveTest;
import org.apache.spark.tags.ExtendedYarnTest;
import org.apache.spark.tags.DockerTest;Note: Test tags are located in src/test and are not part of the main API.
import org.apache.spark.annotation.Experimental;
import org.apache.spark.annotation.DeveloperApi;
import org.apache.spark.annotation.InterfaceStability;
// Mark experimental user-facing API
@Experimental
public class MySparkComponent {
// Implementation
}
// Mark developer-focused API
@DeveloperApi
public void internalMethod() {
// Implementation
}
// Mark stable API
@InterfaceStability.Stable
public interface PublicAPI {
void stableMethod();
}import org.apache.spark.tags.SlowHiveTest;
import org.apache.spark.tags.DockerTest;
import org.junit.Test;
public class MySparkTests {
@Test
@SlowHiveTest
public void testHiveIntegration() {
// Slow Hive test implementation
}
@Test
@DockerTest
public void testDockerEnvironment() {
// Docker-based test implementation
}
}These annotations help communicate the stability and intended audience of Spark APIs.
Marks experimental user-facing APIs that might change or be removed in minor versions.
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})
public @interface Experimental {}Note: When used with Scaladoc, the first line of the comment must be ":: Experimental ::" with no trailing blank line.
Marks lower-level, unstable APIs intended for developers that might change or be removed in minor versions.
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})
public @interface DeveloperApi {}Note: When used with Scaladoc, the first line of the comment must be ":: DeveloperApi ::" with no trailing blank line.
Marks classes considered private to Spark internals with high likelihood of change, used when standard Java/Scala visibility modifiers are insufficient.
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})
public @interface Private {}Note: When used with Scaladoc, the first line of the comment must be ":: Private ::" with no trailing blank line.
Marks new components of Spark which may have unstable APIs.
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})
public @interface AlphaComponent {}Note: When used with Scaladoc, the first line of the comment must be ":: AlphaComponent ::" with no trailing blank line.
Container class providing stability annotations to inform users about API reliability.
public class InterfaceStability {
@Documented
public @interface Stable {}
@Documented
public @interface Evolving {}
@Documented
public @interface Unstable {}
}@InterfaceStability.Stable: Marks stable APIs that retain source and binary compatibility within major releases. Can change between major releases but stable within major version.
@InterfaceStability.Evolving: Marks APIs meant to evolve towards becoming stable APIs, but not yet stable. Can change between feature releases (e.g., 2.1 to 2.2).
@InterfaceStability.Unstable: Marks unstable APIs with no guarantee on stability. Unannotated classes are considered unstable.
Annotates program elements to specify the Spark version when a feature was first introduced. This is a Spark-internal annotation used for API documentation.
private[spark] class Since(version: String) extends StaticAnnotationUsage Example:
@Since("2.0.0")
def newFeature(): Unit = {
// Implementation added in Spark 2.0.0
}Note: This annotation is used extensively throughout Spark's codebase to track API additions and changes across versions.
These annotations are ScalaTest TagAnnotations for organizing and selectively running different categories of tests.
Tags slow-running Hive-related tests for selective execution.
@TagAnnotation
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface SlowHiveTest {}Tags extended Hive-related tests that require additional setup or time.
@TagAnnotation
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface ExtendedHiveTest {}Tags extended YARN-related tests for distributed computing scenarios.
@TagAnnotation
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface ExtendedYarnTest {}Tags Docker-based tests that require Docker environment for execution.
@TagAnnotation
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface DockerTest {}The package is organized into two main components:
org.apache.spark.annotation (main source: src/main/java and src/main/scala): API documentation and stability markers
org.apache.spark.tags (test source: src/test/java): Test categorization system
The module has minimal dependencies:
Note: Despite test tags referencing @TagAnnotation, ScalaTest is not a direct dependency of this module. Test environments using these tags need to provide ScalaTest separately.