apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.88k stars 6.73k forks source link

Can not get all columns when join table #29421

Open 448700174 opened 10 months ago

448700174 commented 10 months ago

select a.*, b.elder_name,b.insurance_no,b.gender,b.birth_day from medical_medicine_kit_order a, elder_info b where a.tenant_id = #{paramMap.tenantId} and a.elder_id = b.elder_id and a.status > 0

Logic SQL: select a.*, b.elder_name,b.insurance_no,b.gender,b.birth_day from medical_medicine_kit_order_12 a, elder_info b where a.elder_id = b.elder_id and a.status > 0 limit 10

Actual SQL: ds ::: select a.*, b.elder_name,b.insurance_no,b.gender,b.birth_day from medical_medicine_kit_order_12 a, elder_info b where a.elder_id = b.elder_id and a.status > 0 limit 10

Error attempting to get column 'id' from result set. Cause: java.sql.SQLFeatureNotSupportedException: Can not get index from column label id. ; Can not get index from column label id.; nested exception is java.sql.SQLFeatureNotSupportedException: Can not get index from column label id.

I can only get elder_name、insurance_no、gender、birth_day。

CREATE TABLE medical_medicine_kit_order ( id bigint unsigned NOT NULL COMMENT 'ID', elder_id int unsigned NOT NULL COMMENT ' ', tenant_id int unsigned NOT NULL COMMENT ' ', medicine_count tinyint NOT NULL COMMENT ' ', source tinyint NOT NULL COMMENT '';)', type tinyint NOT NULL DEFAULT '1' COMMENT ' ', ... PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='';

strongduanmu commented 10 months ago

Hi @448700174, can you try the latest version 5.4.1? I think this problem has been solved.

448700174 commented 10 months ago

I have tried the 5.4.1, But it cannot execute correctly even a simple SQL.

And My configuration on 5.4.1 is as follows:

mode:
type: Standalone repository: type: JDBC props: sql-show: true databaseName: test dataSources: ds: dataSourceClassName: com.zaxxer.hikari.HikariDataSource driverClassName: com.mysql.cj.jdbc.Driver jdbcUrl: jdbc:mysql://xxx:3306/yb_test?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf-8 username: xxx password: xxx minimumIdle: 2 idleTimeoutMilliseconds: 600000 maxPoolSize: 10 minPoolSize: 1 autoCommit: true poolName: MyHikariCP maxLifetimeMilliseconds: 1800000 connectionTimeout: 30000 connectionTestQuery: SELECT 1

rules:

448700174 commented 9 months ago

Can you give me some suggestion on 5.4.1? I guess the problem is that I have not config the single tables with exact table name? But I don't want to do that because I have hundreds tables.

github-actions[bot] commented 8 months ago

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.