From 0c0e284748a5ad5af22ba7ce1f9f741b9fdff212 Mon Sep 17 00:00:00 2001 From: zhaochun Date: Mon, 16 Sep 2019 18:15:40 +0800 Subject: [PATCH] Resove reduce/reduce conflict in our syntax --- fe/src/main/cup/sql_parser.cup | 4 ---- fe/src/main/java/org/apache/doris/analysis/SetVar.java | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fe/src/main/cup/sql_parser.cup b/fe/src/main/cup/sql_parser.cup index 9b720b0fb065d5..458fe0d465f620 100644 --- a/fe/src/main/cup/sql_parser.cup +++ b/fe/src/main/cup/sql_parser.cup @@ -2712,10 +2712,6 @@ set_expr_or_default ::= {: RESULT = new StringLiteral("ALL"); :} - | ident:name - {: - RESULT = new StringLiteral(name); - :} | expr:expr {: RESULT = expr; diff --git a/fe/src/main/java/org/apache/doris/analysis/SetVar.java b/fe/src/main/java/org/apache/doris/analysis/SetVar.java index 2cb00a9bdfeb33..ea399c919d94cd 100644 --- a/fe/src/main/java/org/apache/doris/analysis/SetVar.java +++ b/fe/src/main/java/org/apache/doris/analysis/SetVar.java @@ -97,6 +97,11 @@ public void analyze(Analyzer analyzer) throws AnalysisException, UserException { return; } + // For the case like "set character_set_client = utf8", we change SlotRef to StringLiteral. + if (value instanceof SlotRef) { + value = new StringLiteral(((SlotRef) value).getColumnName()); + } + value.analyze(analyzer); if (!value.isConstant()) { throw new AnalysisException("Set statement does't support non-constant expr.");