Skip to content

Fix: CHAR type casting error #49

@taewhi

Description

@taewhi
CREATE TABLE tpch.region ( r_regionkey INTEGER NOT NULL, r_name CHAR(25) NOT NULL, r_comment VARCHAR(152)); 

When an aggregate function is used, no query results are returned because filter condition is simplified.

EXPLAIN PLAN FOR SELECT SUM(r_regionkey) FROM tpch.region WHERE r_name = 'MIDDLE EAST'; +--------------------------------------------------------------------------+ | PLAN | +--------------------------------------------------------------------------+ | JdbcToEnumerableConverter JdbcAggregate(group=[{}], EXPR$0=[SUM($0)]) JdbcFilter(condition=[=($1, 'MIDDLE EAST ')]) JdbcTableScan(table=[[traindb, TPCH_1G, REGION]]) | +--------------------------------------------------------------------------+ 

Without the aggregate function, the filter condition is not simplified as follows.

EXPLAIN PLAN FOR SELECT * FROM tpch.region WHERE r_name = 'MIDDLE EAST'; +------------------------------------------------------------------------+ | PLAN | +------------------------------------------------------------------------+ | JdbcToEnumerableConverter JdbcFilter(condition=[=($1, CAST('MIDDLE EAST'):CHAR(25) NOT NULL)]) JdbcTableScan(table=[[traindb, TPCH_1G, REGION]]) | +------------------------------------------------------------------------+ 

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions