Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package io.trino.spi.exchange;

import io.airlift.slice.Slice;
import io.trino.spi.Experimental;

import javax.annotation.concurrent.ThreadSafe;

Expand All @@ -22,6 +23,7 @@
import java.util.concurrent.CompletableFuture;

@ThreadSafe
@Experimental(eta = "2023-01-01")
public interface Exchange
extends Closeable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
*/
package io.trino.spi.exchange;

import io.trino.spi.Experimental;
import io.trino.spi.QueryId;

import static java.util.Objects.requireNonNull;

@Experimental(eta = "2023-01-01")
public class ExchangeContext
{
private final QueryId queryId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.trino.spi.Experimental;

import java.util.Objects;
import java.util.regex.Pattern;

import static java.util.Objects.requireNonNull;
import static java.util.UUID.randomUUID;

@Experimental(eta = "2023-01-01")
public class ExchangeId
{
private static final Pattern ID_PATTERN = Pattern.compile("[a-zA-Z0-9_-]+");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package io.trino.spi.exchange;

import io.airlift.slice.Slice;
import io.trino.spi.Experimental;

import javax.annotation.concurrent.ThreadSafe;

Expand All @@ -39,6 +40,7 @@
* data written by other instances must be safely discarded
*/
@ThreadSafe
@Experimental(eta = "2023-01-01")
public interface ExchangeManager
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
*/
package io.trino.spi.exchange;

import io.trino.spi.Experimental;

import java.util.Map;

@Experimental(eta = "2023-01-01")
public interface ExchangeManagerFactory
{
String getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
*/
package io.trino.spi.exchange;

import io.trino.spi.Experimental;

@Experimental(eta = "2023-01-01")
public interface ExchangeManagerHandleResolver
{
Class<? extends ExchangeSinkInstanceHandle> getExchangeSinkInstanceHandleClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
package io.trino.spi.exchange;

import io.airlift.slice.Slice;
import io.trino.spi.Experimental;

import javax.annotation.concurrent.ThreadSafe;

import java.util.concurrent.CompletableFuture;

@ThreadSafe
@Experimental(eta = "2023-01-01")
public interface ExchangeSink
{
CompletableFuture<Void> NOT_BLOCKED = CompletableFuture.completedFuture(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
*/
package io.trino.spi.exchange;

import io.trino.spi.Experimental;

/*
* Implementation is expected to be Jackson serializable
*/
@Experimental(eta = "2023-01-01")
public interface ExchangeSinkHandle
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
*/
package io.trino.spi.exchange;

import io.trino.spi.Experimental;

@Experimental(eta = "2023-01-01")
public interface ExchangeSinkInstanceHandle
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package io.trino.spi.exchange;

import io.airlift.slice.Slice;
import io.trino.spi.Experimental;

import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
Expand All @@ -22,6 +23,7 @@
import java.util.concurrent.CompletableFuture;

@ThreadSafe
@Experimental(eta = "2023-01-01")
public interface ExchangeSource
extends Closeable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
*/
package io.trino.spi.exchange;

import io.trino.spi.Experimental;

/*
* Implementation is expected to be Jackson serializable and include equals, hashCode and toString methods
*/
@Experimental(eta = "2023-01-01")
public interface ExchangeSourceHandle
{
int getPartitionId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
*/
package io.trino.spi.exchange;

import io.trino.spi.Experimental;

import java.io.Closeable;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;

@Experimental(eta = "2023-01-01")
public interface ExchangeSourceSplitter
extends Closeable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
*/
package io.trino.spi.exchange;

import io.trino.spi.Experimental;

@Experimental(eta = "2023-01-01")
public class ExchangeSourceStatistics
{
private final long sizeInBytes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ private static URL getUrl(Path path)
}
}

private static Set<String> getSpiEntities(ClassLoader classLoader, boolean includeDeprecated)
private static Set<String> getSpiEntities(ClassLoader classLoader, boolean includeDeprecatedAndExperimental)
throws IOException
{
ImmutableSet.Builder<String> entities = ImmutableSet.builder();
for (ClassInfo classInfo : ClassPath.from(classLoader).getTopLevelClassesRecursive("io.trino.spi")) {
Class<?> clazz = classInfo.load();
addClassEntities(entities, clazz, includeDeprecated);
addClassEntities(entities, clazz, includeDeprecatedAndExperimental);
}
return entities.build().stream()
// Ignore `final` so that we can e.g. remove final from a SPI method.
Expand All @@ -128,9 +128,9 @@ private static Set<String> getSpiEntities(ClassLoader classLoader, boolean inclu
.collect(toImmutableSet());
}

private static void addClassEntities(ImmutableSet.Builder<String> entities, Class<?> clazz, boolean includeDeprecated)
private static void addClassEntities(ImmutableSet.Builder<String> entities, Class<?> clazz, boolean includeDeprecatedAndExperimental)
{
if (isExperimental(clazz, "class " + clazz.getName())) {
if (!includeDeprecatedAndExperimental && isExperimental(clazz, "class " + clazz.getName())) {
return;
}

Expand All @@ -139,46 +139,46 @@ private static void addClassEntities(ImmutableSet.Builder<String> entities, Clas
}

// TODO remove this after Experimental is released
if (isOriginalPtfClass(clazz, includeDeprecated)) {
if (isOriginalPtfClass(clazz, includeDeprecatedAndExperimental)) {
return;
}

for (Class<?> nestedClass : clazz.getDeclaredClasses()) {
addClassEntities(entities, nestedClass, includeDeprecated);
addClassEntities(entities, nestedClass, includeDeprecatedAndExperimental);
}
if (!includeDeprecated && clazz.isAnnotationPresent(Deprecated.class)) {
if (!includeDeprecatedAndExperimental && clazz.isAnnotationPresent(Deprecated.class)) {
return;
}
entities.add("Class: " + clazz.toGenericString());
for (Constructor<?> constructor : clazz.getConstructors()) {
if (isExperimental(constructor, "constructor " + constructor)) {
if (!includeDeprecatedAndExperimental && isExperimental(constructor, "constructor " + constructor)) {
continue;
}
if (!includeDeprecated && constructor.isAnnotationPresent(Deprecated.class)) {
if (!includeDeprecatedAndExperimental && constructor.isAnnotationPresent(Deprecated.class)) {
continue;
}
entities.add("Constructor: " + constructor.toGenericString());
}
for (Method method : clazz.getDeclaredMethods()) {
if (isExperimental(method, "method " + method)) {
if (!includeDeprecatedAndExperimental && isExperimental(method, "method " + method)) {
continue;
}
if (!isPublic(method.getModifiers())) {
continue;
}
if (!includeDeprecated && method.isAnnotationPresent(Deprecated.class)) {
if (!includeDeprecatedAndExperimental && method.isAnnotationPresent(Deprecated.class)) {
continue;
}
entities.add("Method: " + method.toGenericString());
}
for (Field field : clazz.getDeclaredFields()) {
if (isExperimental(field, "field " + field)) {
if (!includeDeprecatedAndExperimental && isExperimental(field, "field " + field)) {
continue;
}
if (!isPublic(field.getModifiers())) {
continue;
}
if (!includeDeprecated && field.isAnnotationPresent(Deprecated.class)) {
if (!includeDeprecatedAndExperimental && field.isAnnotationPresent(Deprecated.class)) {
continue;
}
entities.add("Field: " + field.toGenericString());
Expand All @@ -203,8 +203,8 @@ private static boolean isExperimental(AnnotatedElement element, String descripti
}

// TODO remove this after Experimental is released
private static boolean isOriginalPtfClass(Class<?> clazz, boolean includeDeprecated)
private static boolean isOriginalPtfClass(Class<?> clazz, boolean includeDeprecatedAndExperimental)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this method can be removed.

{
return !includeDeprecated && clazz.getName().startsWith("io.trino.spi.ptf.");
return !includeDeprecatedAndExperimental && clazz.getName().startsWith("io.trino.spi.ptf.");
}
}