You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/10/28 07:48:31 UTC
[GitHub] [shardingsphere] 794086163 opened a new issue, #21823: SQL query result does not use alias error:Can not get index from column label
794086163 opened a new issue, #21823:
URL: https://github.com/apache/shardingsphere/issues/21823
Caused by: java.sql.SQLFeatureNotSupportedException: Can not get index from column label `split_part`.
at org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSet.lambda$getIndexFromColumnLabelAndIndexMap$0(ShardingSphereResultSet.java:393) ~[shardingsphere-jdbc-core-5.2.1.jar:5.2.1]
at org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions.checkState(ShardingSpherePreconditions.java:41) ~[shardingsphere-infra-util-5.2.1.jar:5.2.1]
at org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSet.getIndexFromColumnLabelAndIndexMap(ShardingSphereResultSet.java:393) ~[shardingsphere-jdbc-core-5.2.1.jar:5.2.1]
at org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSet.getString(ShardingSphereResultSet.java:165) ~[shardingsphere-jdbc-core-5.2.1.jar:5.2.1]
at sun.reflect.GeneratedMethodAccessor194.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_331]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_331]
at org.apache.ibatis.logging.jdbc.ResultSetLogger.invoke(ResultSetLogger.java:69) ~[mybatis-3.5.10.jar:3.5.10]
at com.sun.proxy.$Proxy300.getString(Unknown Source) ~[na:na]
at org.apache.ibatis.type.StringTypeHandler.getNullableResult(StringTypeHandler.java:37) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.type.StringTypeHandler.getNullableResult(StringTypeHandler.java:26) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:85) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createPrimitiveResultObject(DefaultResultSetHandler.java:830) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createResultObject(DefaultResultSetHandler.java:663) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createResultObject(DefaultResultSetHandler.java:642) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:404) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:361) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:335) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:308) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:201) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) ~[mybatis-3.5.10.jar:3.5.10]
at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doQuery(MybatisSimpleExecutor.java:69) ~[mybatis-plus-core-3.4.0.jar:3.4.0]
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) ~[mybatis-3.5.10.jar:3.5.10]
at com.baomidou.mybatisplus.core.executor.MybatisCachingExecutor.query(MybatisCachingExecutor.java:165) ~[mybatis-plus-core-3.4.0.jar:3.4.0]
at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:111) ~[pagehelper-5.2.0.jar:na]
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:62) ~[mybatis-3.5.10.jar:3.5.10]
at com.sun.proxy.$Proxy298.query(Unknown Source) ~[na:na]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145) ~[mybatis-3.5.10.jar:3.5.10]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140) ~[mybatis-3.5.10.jar:3.5.10]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_331]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_331]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_331]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_331]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426) ~[mybatis-spring-2.0.5.jar:2.0.5]
... 148 common frames omitted
![image](https://user-images.githubusercontent.com/37607959/198532969-21df673e-5ddf-4aa0-b0d2-093dfac78408.png)
Can this BUG be fixed?
Thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQL query result does not use alias error:Can not get index from column label [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #21823:
URL: https://github.com/apache/shardingsphere/issues/21823#issuecomment-2060090894
@flydoging You can try the latest 5.4.1, we introduced SQLBinder to handle the analysis of columnLabel.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQL query result does not use alias error:Can not get index from column label [shardingsphere]
Posted by "flydoging (via GitHub)" <gi...@apache.org>.
flydoging commented on issue #21823:
URL: https://github.com/apache/shardingsphere/issues/21823#issuecomment-2081352699
> @flydoging You can try the latest 5.4.1, we introduced SQLBinder to handle the analysis of columnLabel.
Thank you for your reply. Currently, I use data table alias in all queries
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] RaigorJiang closed issue #21823: SQL query result does not use alias error:Can not get index from column label
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang closed issue #21823: SQL query result does not use alias error:Can not get index from column label
URL: https://github.com/apache/shardingsphere/issues/21823
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] 794086163 commented on issue #21823: SQL query result does not use alias error:Can not get index from column label
Posted by GitBox <gi...@apache.org>.
794086163 commented on issue #21823:
URL: https://github.com/apache/shardingsphere/issues/21823#issuecomment-1294623027
SQL:
select split_part("t1".grid_name,'-',1)
from ${tableName} AS "t1"
where
<include refid="GET_GRID_PARAM_WHERE"></include>
AND "t1".${fieldNameTv} is not null
AND "t1".grid_name is not NULL
group by "split_part"("t1".grid_name,'-',1)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] RaigorJiang commented on issue #21823: SQL query result does not use alias error:Can not get index from column label
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #21823:
URL: https://github.com/apache/shardingsphere/issues/21823#issuecomment-1407267392
Hi @794086163
Version 5.3.0 has solved this problem, please refer to #22614
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQL query result does not use alias error:Can not get index from column label [shardingsphere]
Posted by "flydoging (via GitHub)" <gi...@apache.org>.
flydoging commented on issue #21823:
URL: https://github.com/apache/shardingsphere/issues/21823#issuecomment-2081352552
> @flydoging You can try the latest 5.4.1, we introduced SQLBinder to handle the analysis of columnLabel.
Thank you for your reply. Currently, I use data table alias in all queries
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] wj-li commented on issue #21823: SQL query result does not use alias error:Can not get index from column label
Posted by GitBox <gi...@apache.org>.
wj-li commented on issue #21823:
URL: https://github.com/apache/shardingsphere/issues/21823#issuecomment-1336027808
I'm also having the same issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQL query result does not use alias error:Can not get index from column label [shardingsphere]
Posted by "flydoging (via GitHub)" <gi...@apache.org>.
flydoging commented on issue #21823:
URL: https://github.com/apache/shardingsphere/issues/21823#issuecomment-2058963517
When I use the HINT strategy and the query column is an aggregate function, there is still this issue. I am using version 5.3.2
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] RaigorJiang commented on issue #21823: SQL query result does not use alias error:Can not get index from column label
Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #21823:
URL: https://github.com/apache/shardingsphere/issues/21823#issuecomment-1296437542
Hi @794086163,
Thanks for your feedback, can you provide your table structure, just like a `CREATE TABLE` sql statement.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] 794086163 commented on issue #21823: SQL query result does not use alias error:Can not get index from column label
Posted by GitBox <gi...@apache.org>.
794086163 commented on issue #21823:
URL: https://github.com/apache/shardingsphere/issues/21823#issuecomment-1296472150
> Hi @794086163, Thanks for your feedback, can you provide your table structure, just like a `CREATE TABLE` sql statement.
/*
Navicat Premium Data Transfer
Source Server : devPgDb
Source Server Type : PostgreSQL
Source Server Version : 120006
Source Host : 172.16.23.169:5432
Source Catalog : fleet
Source Schema : public
Target Server Type : PostgreSQL
Target Server Version : 120006
File Encoding : 65001
Date: 31/10/2022 10:49:12
*/
-- ----------------------------
-- Table structure for logical_tb1
-- ----------------------------
DROP TABLE IF EXISTS "public"."logical_tb1";
CREATE TABLE "public"."logical_tb1" (
"id" int4 NOT NULL,
"name" varchar(20) COLLATE "pg_catalog"."default"
)
;
-- ----------------------------
-- Records of logical_tb1
-- ----------------------------
INSERT INTO "public"."logical_tb1" VALUES (1, 'a');
INSERT INTO "public"."logical_tb1" VALUES (2, 'bca');
INSERT INTO "public"."logical_tb1" VALUES (3, 'liuer');
INSERT INTO "public"."logical_tb1" VALUES (4, 'ergou');
INSERT INTO "public"."logical_tb1" VALUES (8, 'p');
INSERT INTO "public"."logical_tb1" VALUES (9, 'ooo');
INSERT INTO "public"."logical_tb1" VALUES (33, 'p');
INSERT INTO "public"."logical_tb1" VALUES (44, 'ooo');
-- ----------------------------
-- Primary Key structure for table logical_tb1
-- ----------------------------
ALTER TABLE "public"."logical_tb1" ADD CONSTRAINT "logical_tb1_pkey" PRIMARY KEY ("id");
select split_part("t1".name,'-',1)
from logical_tb1 AS "t1"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] 794086163 commented on issue #21823: SQL query result does not use alias error:Can not get index from column label
Posted by GitBox <gi...@apache.org>.
794086163 commented on issue #21823:
URL: https://github.com/apache/shardingsphere/issues/21823#issuecomment-1296472481
> Hi @794086163, Thanks for your feedback, can you provide your table structure, just like a `CREATE TABLE` sql statement.
DROP TABLE IF EXISTS "public"."logical_tb1";
CREATE TABLE "public"."logical_tb1" (
"id" int4 NOT NULL,
"name" varchar(20) COLLATE "pg_catalog"."default"
)
;
-- ----------------------------
-- Records of logical_tb1
-- ----------------------------
INSERT INTO "public"."logical_tb1" VALUES (1, 'a');
INSERT INTO "public"."logical_tb1" VALUES (2, 'bca');
INSERT INTO "public"."logical_tb1" VALUES (3, 'liuer');
INSERT INTO "public"."logical_tb1" VALUES (4, 'ergou');
INSERT INTO "public"."logical_tb1" VALUES (8, 'p');
INSERT INTO "public"."logical_tb1" VALUES (9, 'ooo');
INSERT INTO "public"."logical_tb1" VALUES (33, 'p');
INSERT INTO "public"."logical_tb1" VALUES (44, 'ooo');
-- ----------------------------
-- Primary Key structure for table logical_tb1
-- ----------------------------
ALTER TABLE "public"."logical_tb1" ADD CONSTRAINT "logical_tb1_pkey" PRIMARY KEY ("id");
select split_part("t1".name,'-',1)
from logical_tb1 AS "t1"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org