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
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@
<version>3.9.1</version>
</dependency>

<!-- pull up to the version used in okio-jvm to avoid conlict with okhttp-* -->
<dependency>
<!-- pull up to the version used in okio-jvm to avoid conlict with okhttp-* -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>1.9.25</version>
</dependency>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,24 @@
import java.util.UUID;

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

@ThriftStruct
public final class TransactionId
{
private final UUID uuid;

@ThriftConstructor
public TransactionId(UUID uuid)
{
this.uuid = requireNonNull(uuid, "uuid is null");
}

@ThriftConstructor
public TransactionId(String uuid)
{
this(fromString(uuid));
}

public static TransactionId create()
{
return new TransactionId(UUID.randomUUID());
Expand All @@ -43,7 +49,7 @@ public static TransactionId create()
@JsonCreator
public static TransactionId valueOf(String value)
{
return new TransactionId(UUID.fromString(value));
return new TransactionId(fromString(value));
}

@Override
Expand All @@ -67,12 +73,12 @@ public boolean equals(Object obj)

@Override
@JsonValue
@ThriftField(value = 1, name = "uuid")
public String toString()
{
return uuid.toString();
}

@ThriftField(value = 1, name = "uuid")
public UUID getUuid()
{
return uuid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ public TypeSignature(String base, List<TypeSignatureParameter> parameters)
this(TypeSignatureBase.of(base), parameters);
}

@ThriftConstructor
public TypeSignature(TypeSignatureBase typeSignatureBase, List<TypeSignatureParameter> parameters)
{
this.base = typeSignatureBase;
Expand All @@ -111,12 +110,18 @@ public TypeSignature(TypeSignatureBase typeSignatureBase, List<TypeSignaturePara
this.calculated = parameters.stream().anyMatch(TypeSignatureParameter::isCalculated);
}

// Add a ignore field to avoid construct conflict
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to mark a static method as a ThriftConstructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sadly, @ThriftConstructor annotation can only be used with instance constructors.

@ThriftConstructor
public TypeSignature(String signature, boolean ignore)
{
this(parseTypeSignature(signature).getTypeSignatureBase(), parseTypeSignature(signature).getParameters());
}

public TypeSignature getStandardTypeSignature()
{
return new TypeSignature(base.getStandardTypeBase(), parameters);
}

@ThriftField(1)
public TypeSignatureBase getTypeSignatureBase()
{
return base;
Expand All @@ -127,7 +132,6 @@ public String getBase()
return base.toString();
}

@ThriftField(2)
public List<TypeSignatureParameter> getParameters()
{
return parameters;
Expand Down Expand Up @@ -700,6 +704,7 @@ private static boolean isValidStartOfIdentifier(char c)

@Override
@JsonValue
@ThriftField(value = 1, name = "signature")
public String toString()
{
String baseString = base.toString();
Expand All @@ -723,6 +728,12 @@ public String toString()
return typeName.toString();
}

@ThriftField(2)
public boolean getIgnore()
{
return true;
}

private static void checkArgument(boolean argument, String format, Object... args)
{
if (!argument) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import java.util.Objects;

import static com.facebook.drift.annotations.ThriftField.Requiredness.OPTIONAL;
import static com.facebook.presto.common.type.BigintEnumType.LongEnumMap;
import static com.facebook.presto.common.type.ParameterKind.DISTINCT_TYPE;
import static com.facebook.presto.common.type.ParameterKind.LONG;
Expand Down Expand Up @@ -50,7 +49,7 @@ public TypeSignatureParameterUnion(TypeSignature typeSignature)
this.id = (short) TYPE.getValue();
}

@ThriftField(value = 1, requiredness = OPTIONAL)
@ThriftField(1)
public TypeSignature getTypeSignature()
{
return typeSignature;
Expand All @@ -63,19 +62,20 @@ public TypeSignatureParameterUnion(NamedTypeSignature namedTypeSignature)
this.id = (short) NAMED_TYPE.getValue();
}

@ThriftField(value = 2, requiredness = OPTIONAL)
@ThriftField(2)
public NamedTypeSignature getNamedTypeSignature()
{
return namedTypeSignature;
}

@ThriftConstructor
public TypeSignatureParameterUnion(Long longLiteral)
{
this.longLiteral = longLiteral;
this.id = (short) LONG.getValue();
}

@ThriftField(value = 3, requiredness = OPTIONAL)
@ThriftField(3)
public Long getLongLiteral()
{
return longLiteral;
Expand All @@ -88,7 +88,7 @@ public TypeSignatureParameterUnion(String variable)
this.id = (short) VARIABLE.getValue();
}

@ThriftField(value = 4, requiredness = OPTIONAL)
@ThriftField(4)
public String getVariable()
{
return variable;
Expand All @@ -101,7 +101,7 @@ public TypeSignatureParameterUnion(LongEnumMap longEnumMap)
this.id = (short) LONG_ENUM.getValue();
}

@ThriftField(value = 5, requiredness = OPTIONAL)
@ThriftField(5)
public LongEnumMap getLongEnumMap()
{
return longEnumMap;
Expand All @@ -114,7 +114,7 @@ public TypeSignatureParameterUnion(VarcharEnumMap varcharEnumMap)
this.id = (short) VARCHAR_ENUM.getValue();
}

@ThriftField(value = 6, requiredness = OPTIONAL)
@ThriftField(6)
public VarcharEnumMap getVarcharEnumMap()
{
return varcharEnumMap;
Expand All @@ -127,7 +127,7 @@ public TypeSignatureParameterUnion(DistinctTypeInfo distinctTypeInfo)
this.id = (short) DISTINCT_TYPE.getValue();
}

@ThriftField(value = 7, requiredness = OPTIONAL)
@ThriftField(7)
public DistinctTypeInfo getDistinctTypeInfo()
{
return distinctTypeInfo;
Expand Down
1 change: 0 additions & 1 deletion presto-main-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@
<artifactId>jts-core</artifactId>
</dependency>


<dependency>
<groupId>org.apache.datasketches</groupId>
<artifactId>datasketches-memory</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import com.facebook.drift.annotations.ThriftConstructor;
import com.facebook.drift.annotations.ThriftField;
import com.facebook.drift.annotations.ThriftIdlAnnotation;
import com.facebook.drift.annotations.ThriftStruct;
import com.facebook.presto.client.ErrorLocation;
import com.facebook.presto.client.FailureInfo;
Expand Down Expand Up @@ -99,7 +100,8 @@ public String getMessage()

@Nullable
@JsonProperty
@ThriftField(value = 3, isRecursive = TRUE, requiredness = OPTIONAL)
@ThriftField(value = 3, isRecursive = TRUE, requiredness = OPTIONAL, idlAnnotations = {
@ThriftIdlAnnotation(key = "cpp.ref_type", value = "\"shared\"")})
public ExecutionFailureInfo getCause()
{
return cause;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
*/
package com.facebook.presto.execution;

import com.facebook.drift.annotations.ThriftConstructor;
import com.facebook.drift.annotations.ThriftField;
import com.facebook.drift.annotations.ThriftStruct;
import com.facebook.presto.metadata.Split;
import com.facebook.presto.spi.plan.PlanNodeId;
import com.fasterxml.jackson.annotation.JsonCreator;
Expand All @@ -22,13 +25,15 @@
import static com.google.common.base.MoreObjects.toStringHelper;
import static java.util.Objects.requireNonNull;

@ThriftStruct
public class ScheduledSplit
{
private final long sequenceId;
private final PlanNodeId planNodeId;
private final Split split;

@JsonCreator
@ThriftConstructor
public ScheduledSplit(
@JsonProperty("sequenceId") long sequenceId,
@JsonProperty("planNodeId") PlanNodeId planNodeId,
Expand All @@ -40,18 +45,21 @@ public ScheduledSplit(
}

@JsonProperty
@ThriftField(1)
public long getSequenceId()
{
return sequenceId;
}

@JsonProperty
@ThriftField(2)
public PlanNodeId getPlanNodeId()
{
return planNodeId;
}

@JsonProperty
@ThriftField(3)
public Split getSplit()
{
return split;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
*/
package com.facebook.presto.execution;

import com.facebook.drift.annotations.ThriftConstructor;
import com.facebook.drift.annotations.ThriftField;
import com.facebook.drift.annotations.ThriftStruct;
import com.facebook.presto.spi.plan.PlanNodeId;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -24,6 +27,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;

@ThriftStruct
public class TaskSource
{
private final PlanNodeId planNodeId;
Expand All @@ -32,6 +36,7 @@ public class TaskSource
private final boolean noMoreSplits;

@JsonCreator
@ThriftConstructor
public TaskSource(
@JsonProperty("planNodeId") PlanNodeId planNodeId,
@JsonProperty("splits") Set<ScheduledSplit> splits,
Expand All @@ -50,24 +55,28 @@ public TaskSource(PlanNodeId planNodeId, Set<ScheduledSplit> splits, boolean noM
}

@JsonProperty
@ThriftField(1)
public PlanNodeId getPlanNodeId()
{
return planNodeId;
}

@JsonProperty
@ThriftField(2)
public Set<ScheduledSplit> getSplits()
{
return splits;
}

@JsonProperty
@ThriftField(3)
public Set<Lifespan> getNoMoreSplitsForLifespan()
{
return noMoreSplitsForLifespan;
}

@JsonProperty
@ThriftField(value = 4, name = "noMoreSplits")
public boolean isNoMoreSplits()
{
return noMoreSplits;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import com.facebook.drift.annotations.ThriftConstructor;
import com.facebook.drift.annotations.ThriftEnum;
import com.facebook.drift.annotations.ThriftEnumValue;
import com.facebook.drift.annotations.ThriftField;
import com.facebook.drift.annotations.ThriftStruct;
import com.facebook.presto.spi.plan.PartitioningHandle;
Expand Down Expand Up @@ -81,11 +82,24 @@ public static OutputBuffers createSpoolingOutputBuffers()
@ThriftEnum
public enum BufferType
{
PARTITIONED,
BROADCAST,
ARBITRARY,
DISCARDING,
SPOOLING,
PARTITIONED(0),
BROADCAST(1),
ARBITRARY(2),
DISCARDING(3),
SPOOLING(4);

private final int value;

BufferType(int value)
{
this.value = value;
}

@ThriftEnumValue
public int getValue()
{
return value;
}
}

private final BufferType type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@
@ThriftEnum
public enum BlockedReason
{
WAITING_FOR_MEMORY;
WAITING_FOR_MEMORY(0);

private final int value;

BlockedReason(int value)
{
this.value = value;
}

@ThriftEnumValue
public int getValue()
{
return 1;
return value;
}
}
Loading
Loading