-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Small tasks on SQL compatibility #10540
Description
-
1. Implement
UNION DISTINCT. For implementation just add Distinct transform after union.
Add syntaxUNIONwithout ALL or DISTINCT and settingunion_default_mode(similar tojoin_default_strictness) with values: empty string, ALL, DISTINCT. When set to empty string, UNION without ALL or DISTINCT will throw an exception. When set to ALL or DISTINCT, the query will be rewritten in AST level. -
2. Implement NULL and NOT NULL modifiers after data type in table definition and in all places where data type can be parsed (e.g. CAST function/expression). If the type is not Nullable and if NULL is specified, it will be treated as Nullable; if NOT NULL is specified, it's noop. E.g.
INT NULLis the same asNullable(INT). If the type is Nullable and NULL or NOT NULL modifiers are specified, exception will be thrown. Add a settingdata_type_default_nullablewith values 0 and 1. If the value is 1, then data types without explicit modifier in table definition will be Nullable. -
3. Implement a setting
rollup_use_nullwith values 0 and 1. When value is 1 and there is GROUP BY ... WITH ROLLUP or WITH CUBE, then RollupTransform and CubeTransform will treat GROUP BY keys as Nullable and emit Nullable columns. Add group_by_use_nulls setting #38642 -
4. Implement positional specification for ORDER BY, GROUP BY and LIMIT BY. E.g. ORDER BY 1, 2. This does not correspond to SQL standard but improves compatibility with other DBMS. It should be controlled by setting
enable_positional_arguments. Feature request: GROUP BY column number support #2592 -
5. Implement a setting
aggregate_functions_nullable_result. When this setting is enabled, aggregate functions will be rewritten with-OrNullmodifier. Add settingaggregate_functions_null_for_empty#16123 -
6.
countandcountDistinct(among with alluniqvariants) from Nullable arguments should return non-Nullable result. For implementation, add a property toIAggregateFunction. -
7. Add support for multi-word expressions for data types, e.g. CHAR VARYING, DOUBLE PRECISION. Most of these complex expressions will simply map to existing data types.
-
8. Support numeric parameters in VARCHAR, VARBINARY, INT... data types (e.g.
VARCHAR(255)) and ignore them completely. -
9.
CASToperator should accept not only exact data types but also data type modifiers Compatibility of CAST operator. #7119. -
10. Provide NUMERIC as a synonim to DECIMAL; provide many other similar symonims. Example: https://dev.mysql.com/doc/refman/8.0/en/other-vendor-data-types.html