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 @@ -51,7 +51,7 @@ public TupleDescriptor createTupleDescriptor() {
}

public SlotDescriptor addSlotDescriptor(TupleDescriptor d) {
SlotDescriptor result = new SlotDescriptor(slotIdGenerator.getNextId(), d);
SlotDescriptor result = new SlotDescriptor(slotIdGenerator.getNextId(), d.getId());
d.addSlot(result);
slotDescs.put(result.getId(), result);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public Void visitPlaceHolderExpr(PlaceHolderExpr expr, TExprNode msg) {
@Override
public Void visitSlotRef(SlotRef expr, TExprNode msg) {
msg.node_type = TExprNodeType.SLOT_REF;
msg.slot_ref = new TSlotRef(expr.getDesc().getId().asInt(), expr.getDesc().getParent().getId().asInt());
msg.slot_ref = new TSlotRef(expr.getDesc().getId().asInt(), expr.getDesc().getParentId().asInt());
msg.slot_ref.setColUniqueId(expr.getDesc().getUniqueId());
msg.slot_ref.setIsVirtualSlot(expr.getDesc().getVirtualColumn() != null);
msg.setLabel(expr.getLabel());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class SlotDescriptor {
private static final Logger LOG = LogManager.getLogger(SlotDescriptor.class);
private final SlotId id;
private final TupleDescriptor parent;
private final TupleId parentId;
private Type type;
private Column column; // underlying column, if there is one

Expand Down Expand Up @@ -66,22 +66,12 @@ public class SlotDescriptor {
private List<TColumnAccessPath> displayAllAccessPaths;
private List<TColumnAccessPath> displayPredicateAccessPaths;

public SlotDescriptor(SlotId id, TupleDescriptor parent) {

public SlotDescriptor(SlotId id, TupleId parentId) {
this.id = id;
this.parent = parent;
this.parentId = parentId;
this.isNullable = true;
}

public SlotDescriptor(SlotId id, TupleDescriptor parent, SlotDescriptor src) {
this.id = id;
this.parent = parent;
this.column = src.column;
this.isNullable = src.isNullable;
this.type = src.type;
this.sourceExprs.add(new SlotRef(src));
}

public SlotId getId() {
return id;
}
Expand Down Expand Up @@ -126,8 +116,8 @@ public void setDisplayPredicateAccessPaths(List<TColumnAccessPath> displayPredic
this.displayPredicateAccessPaths = displayPredicateAccessPaths;
}

public TupleDescriptor getParent() {
return parent;
public TupleId getParentId() {
return parentId;
}

public Type getType() {
Expand Down Expand Up @@ -203,7 +193,7 @@ public TSlotDescriptor toThrift() {
// Non-nullable slots will have 0 for the byte offset and -1 for the bit mask
String colName = materializedColumnName != null ? materializedColumnName :
((column != null) ? column.getNonShadowName() : "");
TSlotDescriptor tSlotDescriptor = new TSlotDescriptor(id.asInt(), parent.getId().asInt(), type.toThrift(), -1,
TSlotDescriptor tSlotDescriptor = new TSlotDescriptor(id.asInt(), parentId.asInt(), type.toThrift(), -1,
0, 0, getIsNullable() ? 0 : -1, colName, -1,
true);
tSlotDescriptor.setIsAutoIncrement(isAutoInc);
Expand Down Expand Up @@ -265,7 +255,7 @@ public void setCaptionAndNormalize(String caption) {

public String debugString() {
String typeStr = (type == null ? "null" : type.toString());
String parentTupleId = (parent == null) ? "null" : parent.getId().toString();
String parentTupleId = (parentId == null) ? "null" : parentId.toString();
return MoreObjects.toStringHelper(this).add("id", id.asInt()).add("parent", parentTupleId).add("col", caption)
.add("type", typeStr).add("nullable", getIsNullable())
.add("isAutoIncrement", isAutoInc).add("subColPath", subColPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public SlotRef(Type type, boolean nullable) {
// tuple id and slot id is meaningless here, nereids just use type and nullable
// to build the TAggregateExpr.param_types
TupleDescriptor tupleDescriptor = new TupleDescriptor(new TupleId(-1));
desc = new SlotDescriptor(new SlotId(-1), tupleDescriptor);
desc = new SlotDescriptor(new SlotId(-1), tupleDescriptor.getId());
tupleDescriptor.addSlot(desc);
desc.setIsNullable(nullable);
this.nullable = nullable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void createLegacyRuntimeFilter(RuntimeFilter filter, JoinNodeBase node, P
targetExpr = new CastExpr(src.getType(), targetExpr, Cast.castNullable(src.isNullable(),
DataType.fromCatalogType(src.getType()), DataType.fromCatalogType(targetExpr.getType())));
}
TupleId targetTupleId = targetSlotRef.getDesc().getParent().getId();
TupleId targetTupleId = targetSlotRef.getDesc().getParentId();
SlotId targetSlotId = targetSlotRef.getSlotId();
scanNodeList.add(scanNode);
targetExprList.add(targetExpr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public void testSlotRefLabelNereidsNotQuery() {
// isNereids=true, isQuery=false, sessionVariable set, desc set
// → Nereids plan-printing path: label + "[#<slotId>]"
TupleDescriptor tupleDesc = new TupleDescriptor(new TupleId(0));
SlotDescriptor slotDesc = new SlotDescriptor(new SlotId(3), tupleDesc);
SlotDescriptor slotDesc = new SlotDescriptor(new SlotId(3), tupleDesc.getId());
slotDesc.setLabel("`col`");
SlotRef expr = new SlotRef(null, "col");
expr.setDesc(slotDesc);
Expand All @@ -307,7 +307,7 @@ public void testSlotRefLabelNereidsNotQuery() {
public void testSlotRefLabelNereidsIsQuery() {
// isNereids=true, isQuery=true → query execution path, slot-id suffix suppressed
TupleDescriptor tupleDesc = new TupleDescriptor(new TupleId(0));
SlotDescriptor slotDesc = new SlotDescriptor(new SlotId(5), tupleDesc);
SlotDescriptor slotDesc = new SlotDescriptor(new SlotId(5), tupleDesc.getId());
slotDesc.setLabel("`score`");
SlotRef expr = new SlotRef(null, "score");
expr.setDesc(slotDesc);
Expand All @@ -320,7 +320,7 @@ public void testSlotRefLabelNereidsIsQuery() {
public void testSlotRefLabelNotNereids() {
// isNereids=false → non-Nereids path, no slot-id suffix regardless of desc
TupleDescriptor tupleDesc = new TupleDescriptor(new TupleId(0));
SlotDescriptor slotDesc = new SlotDescriptor(new SlotId(7), tupleDesc);
SlotDescriptor slotDesc = new SlotDescriptor(new SlotId(7), tupleDesc.getId());
slotDesc.setLabel("`price`");
SlotRef expr = new SlotRef(null, "price");
expr.setDesc(slotDesc);
Expand Down Expand Up @@ -349,7 +349,7 @@ public void testSlotRefNoLabelNoDesc() {
public void testSlotRefDescWithSourceExprs() {
// label=null, desc has sourceExprs → "<slot N> expr visitor result"
TupleDescriptor tupleDesc = new TupleDescriptor(new TupleId(0));
SlotDescriptor slotDesc = new SlotDescriptor(new SlotId(2), tupleDesc);
SlotDescriptor slotDesc = new SlotDescriptor(new SlotId(2), tupleDesc.getId());
slotDesc.setSourceExpr(new IntLiteral(42L));

SlotRef expr = new SlotRef(null, "x");
Expand All @@ -369,7 +369,7 @@ public void testSlotRefDescWithSourceExprs() {
public void testSlotRefDescNoSourceExprs() {
// label=null, desc has no sourceExprs → "<slot N>"
TupleDescriptor tupleDesc = new TupleDescriptor(new TupleId(0));
SlotDescriptor slotDesc = new SlotDescriptor(new SlotId(4), tupleDesc);
SlotDescriptor slotDesc = new SlotDescriptor(new SlotId(4), tupleDesc.getId());

SlotRef expr = new SlotRef(null, "x");
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void testGetPointQueryProjectListFlattensIntermediateProjection() {

private static SlotDescriptor createColumnSlot(TupleDescriptor tupleDescriptor, int slotId,
String columnName) {
SlotDescriptor slotDescriptor = new SlotDescriptor(new SlotId(slotId), tupleDescriptor);
SlotDescriptor slotDescriptor = new SlotDescriptor(new SlotId(slotId), tupleDescriptor.getId());
slotDescriptor.setColumn(new Column(columnName, Type.BIGINT));
slotDescriptor.setLabel(columnName);
tupleDescriptor.addSlot(slotDescriptor);
Expand All @@ -83,7 +83,7 @@ private static SlotDescriptor createColumnSlot(TupleDescriptor tupleDescriptor,

private static SlotDescriptor createExprSlot(TupleDescriptor tupleDescriptor, int slotId,
String label) {
SlotDescriptor slotDescriptor = new SlotDescriptor(new SlotId(slotId), tupleDescriptor);
SlotDescriptor slotDescriptor = new SlotDescriptor(new SlotId(slotId), tupleDescriptor.getId());
slotDescriptor.setType(Type.BIGINT);
slotDescriptor.setLabel(label);
tupleDescriptor.addSlot(slotDescriptor);
Expand Down
Loading