akashrn5 commented on a change in pull request #3651: [CARBONDATA-3733] Fix 
Incorrect query results on mv with limit
URL: https://github.com/apache/carbondata/pull/3651#discussion_r395444682
 
 

 ##########
 File path: 
mv/core/src/main/scala/org/apache/carbondata/mv/extension/MVHelper.scala
 ##########
 @@ -85,6 +85,25 @@ object MVHelper {
                                                   "with limit")
       case _ =>
     }
+
+    // Order by columns needs to be present in projection list for creating 
mv. This is because,
+    // we have to perform order by on all segments during query, which 
requires the order by column
+    // data
+    queryPlan.transform {
+      case sort@Sort(order, _, _) =>
+        order.map { orderByCol =>
+          orderByCol.child match {
+            case attr: AttributeReference =>
+              if (!queryPlan.output.contains(attr.toAttribute)) {
+                throw new UnsupportedOperationException(
+                  "Order by columns must be present in project columns")
 
 Review comment:
   please give column name also in error

----------------------------------------------------------------
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

Reply via email to