You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/01/15 11:02:09 UTC

[GitHub] [calcite] pengzhiwei2018 opened a new pull request #1763: [CALCITE-3738] Missing order by logical plan for insert statement

pengzhiwei2018 opened a new pull request #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] amaliujia commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement

Posted by GitBox <gi...@apache.org>.
amaliujia commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763#issuecomment-574920385
 
 
   LGTM thanks!

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] hsyuan commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement

Posted by GitBox <gi...@apache.org>.
hsyuan commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763#issuecomment-574965566
 
 
   Correct.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] vlsi commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement

Posted by GitBox <gi...@apache.org>.
vlsi commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763#issuecomment-576148007
 
 
   Even though it does not guarantee that the order will be preserved, it makes sense to keep the sorting.
   
   For instance, it would enable to cluder rows appropriately, so later selects would be faster (less physical IO).
   
   Oracle DB explicitly mentions that case in the documentation: https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_7002.htm#SQLRF54628

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] amaliujia commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement

Posted by GitBox <gi...@apache.org>.
amaliujia commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763#issuecomment-574961200
 
 
   That wasn't the use case I was thinking of but I got what you meant. So basically you think python script should sort the data rather than relying on a non-guaranteed contract of the ordering.
   
   
   It sounds make sense to me.
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] hsyuan commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement

Posted by GitBox <gi...@apache.org>.
hsyuan commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763#issuecomment-574960249
 
 
   Then the script should add a ORDER-BY clause in the query, otherwise ordering is not guaranteed.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] hsyuan commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement

Posted by GitBox <gi...@apache.org>.
hsyuan commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763#issuecomment-574948962
 
 
   You are tagging wrong person. :)
   Perhaps. A relation is a bag (multi-set), which is un-ordered. This is the foundation of relational algebra.
   When you insert into a log file, it just happens to be sorted on disk. But when you read it out, order is not guaranteed unless you specify order-by. 
   https://en.wikipedia.org/wiki/Relation_(database)

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] amaliujia edited a comment on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement

Posted by GitBox <gi...@apache.org>.
amaliujia edited a comment on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763#issuecomment-574961200
 
 
   That wasn't the use case I was thinking of but I got what you meant. So basically you think python script should sort the data rather than relying on a non-guaranteed contract of the ordering from raw data.
   
   
   It sounds make sense to me.
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] amaliujia commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement

Posted by GitBox <gi...@apache.org>.
amaliujia commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763#issuecomment-574959845
 
 
   oops!
   
   Agreed with the relation algebra (table by default does not have an ordering)
   
   I was thinking the use case of writing to a log file which preserve the order. And then the log file will be consumed by non sql case: e.g. python scripts which expects the order as the log file is generated from a ORDER BY query.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] amaliujia commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement

Posted by GitBox <gi...@apache.org>.
amaliujia commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763#issuecomment-578235585
 
 
   The Oracle's documentation is a good reference.
   
   +1 on this PR. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] hsyuan merged pull request #1763: [CALCITE-3738] Missing order by logical plan for insert statement

Posted by GitBox <gi...@apache.org>.
hsyuan merged pull request #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] vlsi edited a comment on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement

Posted by GitBox <gi...@apache.org>.
vlsi edited a comment on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763#issuecomment-576148007
 
 
   Even though it does not guarantee that the order will be preserved, it makes sense to keep the sorting, so this PR looks good to me.
   
   For instance, it would enable to cluder rows appropriately, so later selects would be faster (less physical IO).
   
   Oracle DB explicitly mentions that case in the documentation: https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_7002.htm#SQLRF54628

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [calcite] amaliujia commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement

Posted by GitBox <gi...@apache.org>.
amaliujia commented on issue #1763: [CALCITE-3738] Missing order by logical plan for insert statement
URL: https://github.com/apache/calcite/pull/1763#issuecomment-574944740
 
 
   @hsuanyi that's an interesting perspective. Will the ordering depends on sinks? For example, insert into a log file which will preserve the order (assume order by timestamp), but some DB might not. If so it's still better to keep the logical sort rel there and leave engines to figure it out?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services