You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "ygf11 (via GitHub)" <gi...@apache.org> on 2023/03/13 08:20:54 UTC

[GitHub] [arrow-datafusion] ygf11 opened a new pull request, #5567: minor: port some join tests to sqllogictests

ygf11 opened a new pull request, #5567:
URL: https://github.com/apache/arrow-datafusion/pull/5567

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Part of #4495 and #4870
   # Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   # What changes are included in this PR?
   This pr mainly ports tests whose context is [`join_context`](https://github.com/apache/arrow-datafusion/blob/aeb593f719508973fa4564a32bc2adc767c3713e/datafusion/core/tests/sql/mod.rs#L179-L183) to `join.slt`.
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are these changes tested?
   Yes.
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->


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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] ygf11 commented on a diff in pull request #5567: minor: port some join tests to sqllogictests

Posted by "ygf11 (via GitHub)" <gi...@apache.org>.
ygf11 commented on code in PR #5567:
URL: https://github.com/apache/arrow-datafusion/pull/5567#discussion_r1135249916


##########
datafusion/core/tests/sqllogictests/test_files/join_disable_repartition_joins.slt:
##########
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+
+#   http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+##########
+## Join Tests
+##########
+
+# turn off repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = false;
+
+include ./join.slt

Review Comment:
   Most join tests need run twice with different repartition_joins config(on/off).
   
   This slt file is for tests when the config is off.



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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5567: minor: port some join tests to sqllogictests

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #5567:
URL: https://github.com/apache/arrow-datafusion/pull/5567#discussion_r1135670602


##########
datafusion/core/tests/sqllogictests/test_files/join_disable_repartition_joins.slt:
##########
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+
+#   http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+##########
+## Join Tests
+##########
+
+# turn off repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = false;
+
+include ./join.slt

Review Comment:
   TIL "`include` 👍 



##########
datafusion/core/tests/sqllogictests/test_files/join_disable_repartition_joins.slt:
##########
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+
+#   http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+##########
+## Join Tests
+##########
+
+# turn off repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = false;
+
+include ./join.slt

Review Comment:
   
   I verified the queries run as expected
   
   ```
        Running tests/sqllogictests/src/main.rs (/Users/alamb/Software/target-df2/debug/deps/sqllogictests-18a04f4d360aa062)
   [join_disable_repartition_joins.slt] Running query: "set datafusion.optimizer.repartition_joins = false;"
   [join_disable_repartition_joins.slt] Running query: "CREATE TABLE IF NOT EXISTS students(name TEXT, mark INT) AS VALUES
   ('Stuart', 28),
   ('Amina', 89),
   ('Christen', 50),
   ('Salma', 77),
   ('Samantha', 21);"
   [join_disable_repartition_joins.slt] Running query: "CREATE TABLE IF NOT EXISTS grades(grade INT, min INT, max INT) AS VALUES
   (1, 0, 14),
   (2, 15, 35),
   (3, 36, 55),
   (4, 56, 79),
   (5, 80, 100);"
   [join_disable_repartition_joins.slt] Running query: "SELECT s.*, g.grade FROM students s join grades g on s.mark between g.min and g.max WHERE grade > 2 ORDER BY s.mark DESC"
   [join_disable_repartition_joins.slt] Running query: "drop table IF EXISTS students;"
   [join_disable_repartition_joins.slt] Running query: "drop table IF EXISTS grades;"
   [join_disable_repartition_joins.slt] Running query: "CREATE TABLE IF NOT EXISTS test1(a int, b int) as select 1 as a, 2 as b;"
   [join_disable_repartition_joins.slt] Running query: "CREATE TABLE IF NOT EXISTS test2(a int, b int) as select 1 as a, 2 as b;"
   [join_disable_repartition_joins.slt] Running query: "SELECT * FROM test2 FULL JOIN test1 ON true;"
   [join_disable_repartition_joins.slt] Running query: "drop table IF EXISTS test1;"
   [join_disable_repartition_joins.slt] Running query: "drop table IF EXISTS test2;"
   [join_disable_repartition_joins.slt] Running query: "CREATE TABLE IF NOT EXISTS t1(t1_id INT, t1_name TEXT, t1_int INT) AS VALUES
   (11, 'a', 1),
   (22, 'b', 2),
   (33, 'c', 3),
   (44, 'd', 4);"
   ...
   
   ```



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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb merged pull request #5567: minor: port some join tests to sqllogictests

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #5567:
URL: https://github.com/apache/arrow-datafusion/pull/5567


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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] ygf11 commented on a diff in pull request #5567: minor: port some join tests to sqllogictests

Posted by "ygf11 (via GitHub)" <gi...@apache.org>.
ygf11 commented on code in PR #5567:
URL: https://github.com/apache/arrow-datafusion/pull/5567#discussion_r1135248413


##########
datafusion/core/tests/sqllogictests/test_files/join_disable_repartition_joins.slt:
##########
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+
+#   http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+##########
+## Join Tests
+##########
+
+# turn off repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = false;
+
+include ./join.slt
+
+# turn on repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = true;

Review Comment:
   Most join tests need run twice with different repartition_joins config(`on/off`).
   
   This `slt` file is for tests when the config is off. 



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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5567: minor: port some join tests to sqllogictests

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #5567:
URL: https://github.com/apache/arrow-datafusion/pull/5567#discussion_r1136364254


##########
datafusion/core/tests/sqllogictests/test_files/join_disable_repartition_joins.slt:
##########
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+
+#   http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+##########
+## Join Tests
+##########
+
+# turn off repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = false;
+
+include ./join.slt
+
+# turn on repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = true;

Review Comment:
   > sqllogictest we output the sql, which makes the output noisy and probably not very useful, I was thinking to create a ticket to ouputit file name and indented test name. the similar way as cargo test
   
   
   I think this is a good idea
   
   > do you guys think we should create a .slt file per use case like disabled repartition join? or reuse join.slt?
   
   I like the idea of reusing join.slt but it will likely make some tests in the future harder if they vary based on the setting (e.g. plan tests)
   



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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] ygf11 commented on a diff in pull request #5567: minor: port some join tests to sqllogictests

Posted by "ygf11 (via GitHub)" <gi...@apache.org>.
ygf11 commented on code in PR #5567:
URL: https://github.com/apache/arrow-datafusion/pull/5567#discussion_r1136705258


##########
datafusion/core/tests/sqllogictests/test_files/join_disable_repartition_joins.slt:
##########
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+
+#   http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+##########
+## Join Tests
+##########
+
+# turn off repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = false;
+
+include ./join.slt
+
+# turn on repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = true;

Review Comment:
   > do you guys think we should create a .slt file per use case like disabled repartition join? or reuse join.slt?
   
   I think it's worth creating this file now. I first tried adding everything to `join.slt` and found a lot of duplicated code, since most tests need to be run twice.
   ```sql
   # query x
   statement ok
   set datafusion.optimizer.repartition_joins = false;
   
   query ITI rowsort
   SELECT xxx
   ----
   a a a
   
   # switch to another config
   statement ok
   set datafusion.optimizer.repartition_joins = true;
   
   query ITI rowsort
   SELECT xxx
   ----
   a a a
   ```
   
   Using include reduces a lot of codes, originally the addition was `1100+`, now it is `655`.
   
   For the tests whose setting is complex, we can also add them to `join.slt` instead of adding a new `slt` file.



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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] comphead commented on a diff in pull request #5567: minor: port some join tests to sqllogictests

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #5567:
URL: https://github.com/apache/arrow-datafusion/pull/5567#discussion_r1135726419


##########
datafusion/core/tests/sqllogictests/test_files/join_disable_repartition_joins.slt:
##########
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+
+#   http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+##########
+## Join Tests
+##########
+
+# turn off repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = false;
+
+include ./join.slt
+
+# turn on repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = true;

Review Comment:
   Nice. The only thing a bit concerning me, is 
   - sqllogictest we output the sql, which makes the output noisy and probably not very useful, I was thinking to create a ticket to ouputit file name and indented test name. the similar way as cargo test 
   - do you guys think we should create a .slt file per use case like disabled repartition join? or reuse join.slt?



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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] ygf11 commented on a diff in pull request #5567: minor: port some join tests to sqllogictests

Posted by "ygf11 (via GitHub)" <gi...@apache.org>.
ygf11 commented on code in PR #5567:
URL: https://github.com/apache/arrow-datafusion/pull/5567#discussion_r1136705258


##########
datafusion/core/tests/sqllogictests/test_files/join_disable_repartition_joins.slt:
##########
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+
+#   http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+##########
+## Join Tests
+##########
+
+# turn off repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = false;
+
+include ./join.slt
+
+# turn on repartition_joins
+statement ok
+set datafusion.optimizer.repartition_joins = true;

Review Comment:
   > do you guys think we should create a .slt file per use case like disabled repartition join? or reuse join.slt?
   
   I think it's worth creating this file now. I first tried adding everything to `join.slt` and found a lot of duplicated code, since most tests need to be run twice.
   ```sql
   # query x
   statement ok
   set datafusion.optimizer.repartition_joins = false;
   
   query ITI rowsort
   SELECT xxx
   ----
   a a a
   
   # switch to another config
   statement ok
   set datafusion.optimizer.repartition_joins = true;
   
   query ITI rowsort
   SELECT xxx
   ----
   a a a
   ```
   
   Using include reduces a lot of codes, originally the addition was `1100+`, now it is `655`.
   For the tests whose setting is complex, we can also add them to `join.slt`.



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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on pull request #5567: minor: port some join tests to sqllogictests

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #5567:
URL: https://github.com/apache/arrow-datafusion/pull/5567#issuecomment-1469804584

   Thanks @ygf11 !


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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org