Java annotations for marking API stability levels and categorizing test suites within the Apache Spark ecosystem.
npx @tessl/cli install tessl/maven-org-apache-spark--spark-tags-2-11@2.4.0Spark Tags provides Java annotations for marking API stability levels and categorizing test suites within the Apache Spark ecosystem. It offers annotation-based mechanisms to communicate API maturity, stability expectations, and test categorization for better software organization and lifecycle management.
pom.xml:
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-tags_2.11</artifactId>
<version>2.4.8</version>
</dependency>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;For test annotations:
import org.apache.spark.tags.DockerTest;
import org.apache.spark.tags.ExtendedHiveTest;
import org.apache.spark.tags.ExtendedYarnTest;
import org.apache.spark.tags.SlowHiveTest;import org.apache.spark.annotation.Experimental;
import org.apache.spark.annotation.DeveloperApi;
import org.apache.spark.annotation.InterfaceStability;
// Mark an experimental API
@Experimental
public class NewFeature {
// Experimental functionality
}
// Mark a developer-focused API
@DeveloperApi
public class InternalUtils {
// Lower-level API for developers
}
// Mark interface stability
@InterfaceStability.Stable
public interface PublicApi {
// Stable public interface
}
// Mark test methods
@ExtendedHiveTest
public class MyHiveIntegrationTest {
// Hive-specific tests
}Annotations for marking the stability and intended audience of APIs within the Spark ecosystem.
Marks experimental user-facing APIs that may 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 {}Usage:
Marks lower-level, unstable APIs intended for developers that may change 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 {}Usage:
Marks classes considered private to Spark internals with high likelihood of change.
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD,
ElementType.PARAMETER, ElementType.CONSTRUCTOR,
ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})
public @interface Private {}Usage:
private[spark] visibilityMarks new Spark components that 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 {}Usage:
Nested annotations within the InterfaceStability class for marking interface stability levels.
public class InterfaceStability {
@Documented
public @interface Stable {}
@Documented
public @interface Evolving {}
@Documented
public @interface Unstable {}
}Marks stable APIs that retain source and binary compatibility within a major release.
@Documented
public @interface Stable {}Usage:
Marks APIs evolving towards stability that may change between feature releases.
@Documented
public @interface Evolving {}Usage:
Marks unstable APIs with no stability guarantee.
@Documented
public @interface Unstable {}Usage:
ScalaTest tag annotations for categorizing and selectively running test suites based on their requirements.
ScalaTest tag annotation for tests requiring Docker infrastructure.
@TagAnnotation
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface DockerTest {}Usage:
ScalaTest tag annotation for extended Hive integration tests.
@TagAnnotation
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface ExtendedHiveTest {}Usage:
ScalaTest tag annotation for extended YARN integration tests.
@TagAnnotation
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface ExtendedYarnTest {}Usage:
ScalaTest tag annotation for slow-running Hive integration tests.
@TagAnnotation
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface SlowHiveTest {}Usage:
All annotations use standard Java annotation infrastructure with these common characteristics:
// Retention policy for API stability annotations
RetentionPolicy.RUNTIME
// Retention policy for test annotations
RetentionPolicy.RUNTIME
// Common target elements for API annotations
ElementType.TYPE, ElementType.FIELD, ElementType.METHOD,
ElementType.PARAMETER, ElementType.CONSTRUCTOR,
ElementType.LOCAL_VARIABLE, ElementType.PACKAGE
// Target elements for test annotations
ElementType.METHOD, ElementType.TYPEThese annotations do not throw exceptions. They are processed at compile-time and runtime by annotation processors and testing frameworks. Invalid usage typically results in compilation warnings or test framework configuration issues rather than runtime exceptions.