Github user hyunsik commented on a diff in the pull request:
https://github.com/apache/tajo/pull/138#discussion_r17601979
--- Diff:
tajo-core/src/main/java/org/apache/tajo/engine/planner/PlannerUtil.java ---
@@ -75,19 +84,32 @@ public static boolean checkIfSimpleQuery(LogicalPlan
plan) {
boolean noGroupBy = !plan.getRootBlock().hasNode(NodeType.GROUP_BY);
boolean noWhere = !plan.getRootBlock().hasNode(NodeType.SELECTION);
boolean noJoin = !plan.getRootBlock().hasNode(NodeType.JOIN);
- boolean singleRelation = plan.getRootBlock().hasNode(NodeType.SCAN)
+ boolean singleRelation = (plan.getRootBlock().hasNode(NodeType.SCAN)
|| plan.getRootBlock().hasNode(NodeType.PARTITIONS_SCAN))
&&
PlannerUtil.getRelationLineage(plan.getRootBlock().getRoot()).length == 1;
boolean noComplexComputation = false;
if (singleRelation) {
ScanNode scanNode = plan.getRootBlock().getNode(NodeType.SCAN);
- if (!scanNode.getTableDesc().hasPartition() && scanNode.hasTargets()
- && scanNode.getTargets().length ==
scanNode.getInSchema().size()) {
+ if (scanNode == null) {
+ scanNode = plan.getRootBlock().getNode(NodeType.PARTITIONS_SCAN);
+ }
+ if (scanNode.hasTargets()) {
+ if (scanNode.getTableDesc().hasPartition()) {
+ int numPartitionColumns =
scanNode.getTableDesc().getPartitionMethod().getExpressionSchema().size();
+ if (scanNode.getTargets().length !=
scanNode.getInSchema().size() + numPartitionColumns) {
--- End diff --
I can understand what if-condition mean. But, it is hard for other code
readers to figure out its meaning. Please explain the purpose of this condition
briefly.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---