Skip to content

[IOTDB-2679] Support logical operators in select clauses#5273

Merged
SteveYurongSu merged 7 commits intoapache:masterfrom
flashzxi:compareExpression
Mar 27, 2022
Merged

[IOTDB-2679] Support logical operators in select clauses#5273
SteveYurongSu merged 7 commits intoapache:masterfrom
flashzxi:compareExpression

Conversation

@flashzxi
Copy link
Contributor

Description

Add some functions to support select logical expression in select clauses.

Details

Now you can select logical expressions like a>b, fore example

select a, a>10, !(a<20) && a<30 from root.test;

output:

IoTDB> select a, a>10, !(a<20) && a<30 from root.test;
+-----------------------------+-----------+----------------+--------------------------------------+
|                         Time|root.test.a|root.test.a > 10|!root.test.a < 20 & (root.test.a < 30)|
+-----------------------------+-----------+----------------+--------------------------------------+
|1970-01-01T08:00:00.001+08:00|         23|            true|                                  true|
|1970-01-01T08:00:00.002+08:00|         33|            true|                                 false|
|1970-01-01T08:00:00.004+08:00|         13|            true|                                 false|
|1970-01-01T08:00:00.005+08:00|         26|            true|                                  true|
|1970-01-01T08:00:00.008+08:00|          1|           false|                                 false|
|1970-01-01T08:00:00.010+08:00|         23|            true|                                  true|
+-----------------------------+-----------+----------------+--------------------------------------+

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.007%) to 65.427% when pulling 473eb33 on flashzxi:compareExpression into 31108de on apache:master.

@SteveYurongSu
Copy link
Member

Hi @cornmonster @ericpai, PTAL :D

Copy link
Member

@SteveYurongSu SteveYurongSu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a great feature! I will take a look ASAP.

Please add some docs for this PR.

@ericpai
Copy link
Member

ericpai commented Mar 21, 2022

Description

Add some functions to support select logical expression in select clauses.

Details

Now you can select logical expressions like a>b, fore example

select a, a>10, !(a<20) && a<30 from root.test;

output:

IoTDB> select a, a>10, !(a<20) && a<30 from root.test;
+-----------------------------+-----------+----------------+--------------------------------------+
|                         Time|root.test.a|root.test.a > 10|!root.test.a < 20 & (root.test.a < 30)|
+-----------------------------+-----------+----------------+--------------------------------------+
|1970-01-01T08:00:00.001+08:00|         23|            true|                                  true|
|1970-01-01T08:00:00.002+08:00|         33|            true|                                 false|
|1970-01-01T08:00:00.004+08:00|         13|            true|                                 false|
|1970-01-01T08:00:00.005+08:00|         26|            true|                                  true|
|1970-01-01T08:00:00.008+08:00|          1|           false|                                 false|
|1970-01-01T08:00:00.010+08:00|         23|            true|                                  true|
+-----------------------------+-----------+----------------+--------------------------------------+

@flashzxi Could you add some docs about this excellent feature in English and Chinese :)

@flashzxi
Copy link
Contributor Author

@ericpai Please take a look

@ericpai
Copy link
Member

ericpai commented Mar 25, 2022

@flashzxi why the file mod of .bat and .sh are changed to 100644? They should be excutable.

@flashzxi
Copy link
Contributor Author

@flashzxi why the file mod of .bat and .sh are changed to 100644? They should be excutable.
I haven't modified them. Maybe caused by the difference of \n and \r\n on win and mac platform?

@flashzxi flashzxi force-pushed the compareExpression branch from def963b to 98e7e76 Compare March 25, 2022 12:06
@ericpai
Copy link
Member

ericpai commented Mar 26, 2022

LGTM. Thanks for the excellent feature!

@ericpai
Copy link
Member

ericpai commented Mar 26, 2022

@SteveYurongSu Are there any other comments?

@ericpai
Copy link
Member

ericpai commented Mar 26, 2022

The tests are failure caused by other modules, please rebase and sync with the master code. @flashzxi

@SteveYurongSu
Copy link
Member

@ericpai Thanks for the reviewing :D

Copy link
Member

@SteveYurongSu SteveYurongSu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. This is great :D

@SteveYurongSu SteveYurongSu merged commit 1705a8a into apache:master Mar 27, 2022
xinzhongtianxia pushed a commit to xinzhongtianxia/iotdb that referenced this pull request Apr 5, 2022
…er_meta

* remotes/upstream/master:
  Rename SchemaEngine to LocalSchemaProcessor and Rename SchemaRegionManager to SchemaEngine (apache#5359)
  Add SchemaRegion Interfaces to SchemaEngine (apache#5349)
  [IOTDB-2803] adapt metadata write operation to plannode (apache#5344)
  [IOTDB-2679] Support logical operators in select clauses (apache#5273)
  [IOTDB-2671][metrics] Improve the implementation of iotdbReporter (apache#5338)

# Conflicts:
#	server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/LogicalPlanner.java
#	server/src/test/java/org/apache/iotdb/db/mpp/sql/plan/LogicalPlannerTest.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants