shanthoosh commented on a change in pull request #1242: SAMZA-2425: Add support
for sub-query in joins
URL: https://github.com/apache/samza/pull/1242#discussion_r362601027
##########
File path:
samza-sql/src/main/java/org/apache/samza/sql/translator/JoinTranslator.java
##########
@@ -292,17 +294,27 @@ private String dumpRelPlanForNode(RelNode relNode) {
SqlExplainLevel.EXPPLAN_ATTRIBUTES);
}
- private SqlIOConfig resolveSourceConfigForTable(RelNode relNode,
TranslatorContext context) {
+ private SqlIOConfig resolveSQlIOForTable(RelNode relNode, TranslatorContext
context) {
+ // Let's recursively get to the TableScan node to identify IO for the
table.
if (relNode instanceof LogicalProject) {
- return resolveSourceConfigForTable(((LogicalProject)
relNode).getInput(), context);
+ return resolveSQlIOForTable(((LogicalProject) relNode).getInput(),
context);
}
- // We are returning the sourceConfig for the table as null when the table
is in another join rather than an output
- // table, that's because the output of stream-table join is considered a
stream.
- if (relNode.getInputs().size() > 1) {
+ if (relNode instanceof LogicalFilter) {
+ return resolveSQlIOForTable(((LogicalFilter) relNode).getInput(),
context);
+ }
+
+ // We return null for table IO as the table seems to be involved in
another join. The output of stream-table join
+ // is considered a stream. Hence, we return null for the table.
+ if (relNode instanceof LogicalJoin && relNode.getInputs().size() > 1) {
Review comment:
1. There're other kinds of `RelNode` which are not covered by `instanceOf`
checks in recursive function. Do we need to handle other kinds of `RelNode`
here? If not, why?
2. Can you please add a unit-test in JoinTranslator for these changes?
3. Just curious. Would the schema validations be applied on the result of
the sub-queries within joins?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services