From 8b83da56ff61568827d8debfa1264f1db2be68bd Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Thu, 21 Nov 2024 20:44:33 +0800 Subject: [PATCH] Refactor ColumnSegmentBoundInfo (#33764) * Refactor ColumnSegmentBoundInfo * Refactor ColumnSegmentBoundInfo --- .../generic/bound/ColumnSegmentBoundInfo.java | 48 ++++--------------- .../generic/match/MatchAgainstExpression.java | 2 - 2 files changed, 8 insertions(+), 42 deletions(-) diff --git a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/generic/bound/ColumnSegmentBoundInfo.java b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/generic/bound/ColumnSegmentBoundInfo.java index 77c041ff88654..a4b8a674379e9 100644 --- a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/generic/bound/ColumnSegmentBoundInfo.java +++ b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/generic/bound/ColumnSegmentBoundInfo.java @@ -17,13 +17,13 @@ package org.apache.shardingsphere.sql.parser.statement.core.segment.generic.bound; -import lombok.RequiredArgsConstructor; +import lombok.Getter; import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue; /** * Column segment bound info. */ -@RequiredArgsConstructor +@Getter public final class ColumnSegmentBoundInfo { private final IdentifierValue originalDatabase; @@ -35,45 +35,13 @@ public final class ColumnSegmentBoundInfo { private final IdentifierValue originalColumn; public ColumnSegmentBoundInfo(final IdentifierValue originalColumn) { - originalDatabase = new IdentifierValue(""); - originalSchema = new IdentifierValue(""); - originalTable = new IdentifierValue(""); - this.originalColumn = originalColumn; + this(null, null, null, originalColumn); } - /** - * Get original database. - * - * @return original database - */ - public IdentifierValue getOriginalDatabase() { - return null == originalDatabase ? new IdentifierValue("") : originalDatabase; - } - - /** - * Get original schema. - * - * @return original schema - */ - public IdentifierValue getOriginalSchema() { - return null == originalSchema ? new IdentifierValue("") : originalSchema; - } - - /** - * Get original table. - * - * @return original table - */ - public IdentifierValue getOriginalTable() { - return null == originalTable ? new IdentifierValue("") : originalTable; - } - - /** - * Get original column. - * - * @return original column - */ - public IdentifierValue getOriginalColumn() { - return null == originalColumn ? new IdentifierValue("") : originalColumn; + public ColumnSegmentBoundInfo(final IdentifierValue originalDatabase, final IdentifierValue originalSchema, final IdentifierValue originalTable, final IdentifierValue originalColumn) { + this.originalDatabase = null == originalDatabase ? new IdentifierValue("") : originalDatabase; + this.originalSchema = null == originalSchema ? new IdentifierValue("") : originalSchema; + this.originalTable = null == originalTable ? new IdentifierValue("") : originalTable; + this.originalColumn = null == originalColumn ? new IdentifierValue("") : originalColumn; } } diff --git a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/generic/match/MatchAgainstExpression.java b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/generic/match/MatchAgainstExpression.java index f33d22bc35527..97202a1197fec 100644 --- a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/generic/match/MatchAgainstExpression.java +++ b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/generic/match/MatchAgainstExpression.java @@ -19,7 +19,6 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import lombok.Setter; import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment; import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment; @@ -31,7 +30,6 @@ */ @RequiredArgsConstructor @Getter -@Setter public final class MatchAgainstExpression implements ExpressionSegment { private final int startIndex;