Package org.apache.drill.exec.physical
Class EndpointAffinity
java.lang.Object
org.apache.drill.exec.physical.EndpointAffinity
EndpointAffinity captures affinity value for a given single Drillbit endpoint.
-
Constructor Summary
ConstructorDescriptionCreate EndpointAffinity instance for given Drillbit endpoint.EndpointAffinity
(CoordinationProtos.DrillbitEndpoint endpoint, double affinity) Create EndpointAffinity instance for given Drillbit endpoint and affinity initialized to given affinity value.EndpointAffinity
(CoordinationProtos.DrillbitEndpoint endpoint, double affinity, boolean mandatory, int maxWidth) Creates EndpointAffinity instance for given DrillbitEndpoint, affinity and mandatory assignment requirement flag. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAffinity
(double f) Add given affinity value to existing affinity value.boolean
double
Get the affinity value.Return the Drillbit endpoint in this instance.int
int
hashCode()
boolean
Is this endpoint required to be in fragment endpoint assignment list?void
Set the endpoint requires at least one assignment.void
setMaxWidth
(int maxWidth) Set the new max width as the minimum of the the given value and current max width.toString()
-
Constructor Details
-
EndpointAffinity
Create EndpointAffinity instance for given Drillbit endpoint. Affinity is initialized to 0. Affinity can be added after EndpointAffinity object creation usingaddAffinity(double)
.- Parameters:
endpoint
- Drillbit endpoint.
-
EndpointAffinity
Create EndpointAffinity instance for given Drillbit endpoint and affinity initialized to given affinity value. Affinity can be added after EndpointAffinity object creation usingaddAffinity(double)
.- Parameters:
endpoint
- Drillbit endpoint.affinity
- Initial affinity value.
-
EndpointAffinity
public EndpointAffinity(CoordinationProtos.DrillbitEndpoint endpoint, double affinity, boolean mandatory, int maxWidth) Creates EndpointAffinity instance for given DrillbitEndpoint, affinity and mandatory assignment requirement flag.- Parameters:
endpoint
- Drillbit endpointaffinity
- Initial affinity valuemandatory
- Is this endpoint requires at least one mandatory assignment?maxWidth
- Maximum allowed assignments for this endpoint.
-
-
Method Details
-
getEndpoint
Return the Drillbit endpoint in this instance.- Returns:
- Drillbit endpoint.
-
getAffinity
public double getAffinity()Get the affinity value. Affinity value is Double.POSITIVE_INFINITY if the Drillbit endpoint requires an assignment.- Returns:
- affinity value
-
addAffinity
public void addAffinity(double f) Add given affinity value to existing affinity value.- Parameters:
f
- Affinity value (must be a non-negative value).- Throws:
IllegalArgumentException
- If the given affinity value is negative.
-
setAssignmentRequired
public void setAssignmentRequired()Set the endpoint requires at least one assignment. -
isAssignmentRequired
public boolean isAssignmentRequired()Is this endpoint required to be in fragment endpoint assignment list?- Returns:
- Returns true for mandatory assignment, false otherwise.
-
getMaxWidth
public int getMaxWidth()- Returns:
- Maximum allowed assignments for this endpoint.
-
setMaxWidth
public void setMaxWidth(int maxWidth) Set the new max width as the minimum of the the given value and current max width.- Parameters:
maxWidth
-
-
hashCode
public int hashCode() -
equals
-
toString
-