Package org.apache.druid.frame.key
Class FrameComparisonWidgetImpl
java.lang.Object
org.apache.druid.frame.key.FrameComparisonWidgetImpl
- All Implemented Interfaces:
FrameComparisonWidget
@NotThreadSafe
public class FrameComparisonWidgetImpl
extends Object
implements FrameComparisonWidget
Implementation of
FrameComparisonWidget for pairs of FrameType.isRowBased() frames.
Comparison logic in this class is very similar to RowKeyComparator, but is different because it works
on Frames instead of byte[].-
Method Summary
Modifier and TypeMethodDescriptionintcompare(int row, FrameComparisonWidget otherWidget, int otherRow) Compare a specific row of this frame to a specific row of another frame.intCompare a specific row of this frame to the provided key.static FrameComparisonWidgetImplcreate(Frame frame, RowSignature signature, List<KeyColumn> keyColumns, List<FieldReader> keyColumnReaders) Create aFrameComparisonWidgetfor the given frame.booleanhasNonNullKeyParts(int row, int[] keyParts) Whether particular key parts in a particular row are non-null.readKey(int row) CreatesRowKeyfrom a row in the frame.
-
Method Details
-
create
public static FrameComparisonWidgetImpl create(Frame frame, RowSignature signature, List<KeyColumn> keyColumns, List<FieldReader> keyColumnReaders) Create aFrameComparisonWidgetfor the given frame. Only possible for row-based frames. The provided keyColumns must be a prefix ofFrameReader.signature().- Parameters:
frame- frame, must satisfyFrameType.isRowBased()signature- signature for the framekeyColumns- columns to sort bykeyColumnReaders- readers for key columns
-
readKey
- Specified by:
readKeyin interfaceFrameComparisonWidget
-
hasNonNullKeyParts
public boolean hasNonNullKeyParts(int row, int[] keyParts) Description copied from interface:FrameComparisonWidgetWhether particular key parts in a particular row are non-null.- Specified by:
hasNonNullKeyPartsin interfaceFrameComparisonWidget- Parameters:
row- row numberkeyParts- parts to check
-
compare
Description copied from interface:FrameComparisonWidgetCompare a specific row of this frame to the provided key. The key must have been created with sortColumns that match the ones used to create this widget, or else results are undefined. Comparison considers null to be equal to null. Callers that need to determine if key parts are null (perhaps because they *don't* want to consider null to be equal to null) should useFrameComparisonWidget.hasNonNullKeyParts(int, int[])to check the relevant parts.- Specified by:
comparein interfaceFrameComparisonWidget
-
compare
Description copied from interface:FrameComparisonWidgetCompare a specific row of this frame to a specific row of another frame. The other frame must have the same sort key, or else results are undefined. The other frame may be the same object as this frame; for example, this is used byFrameSortto sort frames in-place. Comparison considers null to be equal to null. Callers that need to determine if key parts are null (perhaps because they *don't* want to consider null to be equal to null) should useFrameComparisonWidget.hasNonNullKeyParts(int, int[])to check the relevant parts.- Specified by:
comparein interfaceFrameComparisonWidget
-