AnyhowStep / sql-compiler

An experimental SQL compiler
MIT License
0 stars 0 forks source link

Notes on BitExpression and Partitions #21

Open AnyhowStep opened 3 years ago

AnyhowStep commented 3 years ago

The following are semantically equivalent,

CREATE TABLE T (X INT)
  PARTITION BY HASH(X IS NULL);
CREATE TABLE T (X INT)
  PARTITION BY HASH((X IS NULL));

The difference is X IS NULL vs (X IS NULL).

When given X IS NULL, we get a syntax error.

When given (X IS NULL), we are told IS NULL is not a valid partition function (ER_PARTITION_FUNCTION_IS_NOT_ALLOWED) per,

We should probably allow Expression in the HashPartition rule, then push error checks down the pipeline.

Right now, X IS NULL will give,

And (X IS NULL) will just parse successfully without any parse errors.