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 @@ -312,6 +312,8 @@ public Expression visitUnboundSlot(UnboundSlot unboundSlot, ExpressionRewriteCon
}
if (firstBound.getDataType() instanceof NestedColumnPrunable) {
context.cascadesContext.getStatementContext().setHasNestedColumns(true);
} else if (firstBound.containsType(ElementAt.class, StructElement.class)) {
context.cascadesContext.getStatementContext().setHasNestedColumns(true);
}
return firstBound;
default:
Expand Down Expand Up @@ -1126,7 +1128,7 @@ private Optional<Expression> bindNestedFields(UnboundSlot unboundSlot, Slot slot
}
throw new AnalysisException("No such field '" + fieldName + "' in '" + lastFieldName + "'");
}
return Optional.of(new Alias(expression));
return Optional.of(new Alias(expression, unboundSlot.getName(), slot.getQualifier()));
}

public static boolean sameTableName(String boundSlot, String unboundSlot) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,15 @@ public void testCteAndUnion() throws Throwable {
);
}

@Test
public void testDereference() throws Exception {
assertColumn("select s.city from tbl",
"struct<city:text>",
ImmutableList.of(path("s", "city")),
ImmutableList.of()
);
}

@Test
public void testPushDownThroughJoin() {
PlanChecker.from(connectContext)
Expand Down
Loading