You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by tu...@apache.org on 2022/06/23 13:51:14 UTC
[shardingsphere] branch master updated: fix when table alias case different throw NullPointException (#18097)
This is an automated email from the ASF dual-hosted git repository.
tuichenchuxin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 976a4cd7174 fix when table alias case different throw NullPointException (#18097)
976a4cd7174 is described below
commit 976a4cd7174cc6c0a9718c4464325e243152c553
Author: Z <42...@users.noreply.github.com>
AuthorDate: Thu Jun 23 21:51:00 2022 +0800
fix when table alias case different throw NullPointException (#18097)
* fix when use alias get table throw NullPointException
* checkstyle, import format
* final keyword
* revert MergerResult, modify TableExtractor to fix this issus
* revert
* checkstyle
---
.../sharding/merge/dql/groupby/GroupByMemoryMergedResult.java | 4 ++--
.../sql/parser/sql/common/extractor/TableExtractor.java | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResult.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResult.java
index fdcef2b4008..c9064f80172 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResult.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResult.java
@@ -126,7 +126,7 @@ public final class GroupByMemoryMergedResult extends MemoryMergedResult<Sharding
}
return result;
}
-
+
private boolean getValueCaseSensitiveFromTables(final QueryResult queryResult,
final SelectStatementContext selectStatementContext, final ShardingSphereSchema schema, final int columnIndex) throws SQLException {
for (SimpleTableSegment each : selectStatementContext.getAllTables()) {
@@ -140,7 +140,7 @@ public final class GroupByMemoryMergedResult extends MemoryMergedResult<Sharding
}
return false;
}
-
+
private List<MemoryQueryResultRow> getMemoryResultSetRows(final SelectStatementContext selectStatementContext,
final Map<GroupByValue, MemoryQueryResultRow> dataMap, final List<Boolean> valueCaseSensitive) {
if (dataMap.isEmpty()) {
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/extractor/TableExtractor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/extractor/TableExtractor.java
index 5492674678b..153f5519775 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/extractor/TableExtractor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/extractor/TableExtractor.java
@@ -263,7 +263,7 @@ public final class TableExtractor {
*/
public boolean needRewrite(final OwnerSegment owner) {
for (TableSegment each : tableContext) {
- if (owner.getIdentifier().getValue().equals(each.getAlias().orElse(null))) {
+ if (owner.getIdentifier().getValue().equalsIgnoreCase(each.getAlias().orElse(null))) {
return false;
}
}