databendlabs / databend

๐——๐—ฎ๐˜๐—ฎ, ๐—”๐—ป๐—ฎ๐—น๐˜†๐˜๐—ถ๐—ฐ๐˜€ & ๐—”๐—œ. Modern alternative to Snowflake. Cost-effective and simple for massive-scale analytics. https://databend.com
https://docs.databend.com
Other
7.71k stars 732 forks source link

chore: add extra bracket for `and` and `or` to make explain clear #16494

Closed xudong963 closed 2 days ago

xudong963 commented 3 days ago

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

Tests

Type of change


This change isโ€‚Reviewable

BohuTANG commented 3 days ago

Some tests still need to fix the format.

andylokandy commented 3 days ago

What bug does this fix? maybe add a test.

xudong963 commented 3 days ago

What bug does this fix? maybe add a test.

In fact, there is no bug, and has a higher priority than or (I changed the title).

By adding () can make explain clearer.

ZhiHanZ commented 3 days ago

Hi @xudong963 Could you add the following logic tests on https://github.com/datafuselabs/databend/blob/main/tests/sqllogictests/suites/task/task_dag_test.test for this PR.

statement ok
DROP TASK IF EXISTS mytaskchild2

statement ok 
CREATE TASK mytaskchild2
  WAREHOUSE = 'mywh'
  AFTER 'mytaskroot'
  WHEN ((SYSTEM$STREAM_HAS_DATA('stream1') AND SYSTEM$STREAM_HAS_DATA('stream2')) OR (SYSTEM$STREAM_HAS_DATA('stream3') AND SYSTEM$STREAM_HAS_DATA('stream4'))) AND SYSTEM$STREAM_HAS_DATA('stream5')
  AS SELECT 1;

query SSSS
select name, warehouse, schedule, definition, condition_text, after from system.tasks where name = 'mytaskchild2'
----
mytaskchild2 mywh NULL SELECT 1 ((SYSTEM$STREAM_HAS_DATA('stream1') AND SYSTEM$STREAM_HAS_DATA('stream2')) OR (SYSTEM$STREAM_HAS_DATA('stream3') AND SYSTEM$STREAM_HAS_DATA('stream4'))) AND SYSTEM$STREAM_HAS_DATA('stream5') mytaskroot