diff --git a/euphoria-core/src/main/java/cz/seznam/euphoria/core/annotation/stability/Experimental.java b/euphoria-core/src/main/java/cz/seznam/euphoria/core/annotation/stability/Experimental.java new file mode 100644 index 00000000..db5d9596 --- /dev/null +++ b/euphoria-core/src/main/java/cz/seznam/euphoria/core/annotation/stability/Experimental.java @@ -0,0 +1,25 @@ +package cz.seznam.euphoria.core.annotation.stability; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +/** + * Any (API) item annotated with this annotation signals that the item + * is purely experimental and may be change or completely removed without + * any notice at any time. + *

+ * + * Clients should generally avoid usage of such items, except when experimenting :) + */ +@Documented +@Target({ + ElementType.TYPE, + ElementType.FIELD, + ElementType.METHOD, + ElementType.PARAMETER, + ElementType.CONSTRUCTOR, + ElementType.ANNOTATION_TYPE, + ElementType.PACKAGE +}) +public @interface Experimental {} diff --git a/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/dataset/windowing/Windowing.java b/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/dataset/windowing/Windowing.java index 44c867b3..2f4de3bd 100644 --- a/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/dataset/windowing/Windowing.java +++ b/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/dataset/windowing/Windowing.java @@ -15,8 +15,9 @@ */ package cz.seznam.euphoria.core.client.dataset.windowing; -import cz.seznam.euphoria.core.client.triggers.Trigger; +import cz.seznam.euphoria.core.annotation.stability.Experimental; import cz.seznam.euphoria.core.client.functional.ResultType; +import cz.seznam.euphoria.core.client.triggers.Trigger; import java.io.Serializable; @@ -57,6 +58,7 @@ public interface Windowing extends Serializable { * strategy are to be handled opaque, otherwise a type hint about * the window types */ + @Experimental default ResultType getWindowType() { return null; } diff --git a/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/functional/DelegatedFunction.java b/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/functional/DelegatedFunction.java index 4e14abb2..d20931cf 100644 --- a/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/functional/DelegatedFunction.java +++ b/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/functional/DelegatedFunction.java @@ -15,8 +15,11 @@ */ package cz.seznam.euphoria.core.client.functional; +import cz.seznam.euphoria.core.annotation.stability.Experimental; + import java.io.Serializable; +@Experimental public interface DelegatedFunction extends Serializable { F getDelegate(); diff --git a/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/functional/ResultType.java b/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/functional/ResultType.java index 92b310ec..775ad2ec 100644 --- a/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/functional/ResultType.java +++ b/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/functional/ResultType.java @@ -15,12 +15,13 @@ */ package cz.seznam.euphoria.core.client.functional; +import cz.seznam.euphoria.core.annotation.stability.Experimental; import cz.seznam.euphoria.shaded.guava.com.google.common.reflect.TypeToken; import java.io.Serializable; import java.lang.reflect.Type; -// XXX TypeHint would be a much better name but is already take by flink :/ +@Experimental public abstract class ResultType implements Serializable { private final TypeToken tt = new TypeToken(getClass()) {}; diff --git a/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/functional/ResultTypeAware.java b/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/functional/ResultTypeAware.java index 37ab736d..dec85c6f 100644 --- a/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/functional/ResultTypeAware.java +++ b/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/functional/ResultTypeAware.java @@ -15,8 +15,11 @@ */ package cz.seznam.euphoria.core.client.functional; +import cz.seznam.euphoria.core.annotation.stability.Experimental; + import java.io.Serializable; +@Experimental public interface ResultTypeAware extends Serializable { ResultType getResultType(); diff --git a/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/operator/ReduceByKey.java b/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/operator/ReduceByKey.java index 4799a9b4..a48a799f 100644 --- a/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/operator/ReduceByKey.java +++ b/euphoria-core/src/main/java/cz/seznam/euphoria/core/client/operator/ReduceByKey.java @@ -17,6 +17,7 @@ import cz.seznam.euphoria.core.annotation.operator.Recommended; import cz.seznam.euphoria.core.annotation.operator.StateComplexity; +import cz.seznam.euphoria.core.annotation.stability.Experimental; import cz.seznam.euphoria.core.client.dataset.Dataset; import cz.seznam.euphoria.core.client.dataset.partitioning.Partitioning; import cz.seznam.euphoria.core.client.dataset.windowing.Window; @@ -92,6 +93,7 @@ public DatasetBuilder2 keyBy(UnaryFunction keyFn) { return new DatasetBuilder2<>(name, input, keyFn); } + @Experimental public DatasetBuilder2 keyBy(UnaryFunction keyFn, ResultType keyType) { return new DatasetBuilder2(name, input, new TypeSupport.DelegatedUnaryFunction<>(keyFn, keyType)); }