xiaokang commented on code in PR #10322: URL: https://github.com/apache/doris/pull/10322#discussion_r923966756
########## fe/fe-core/src/main/java/org/apache/doris/analysis/JsonLiteral.java: ########## @@ -0,0 +1,197 @@ +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.analysis; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.Objects; + +import com.google.common.base.Preconditions; +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; + +import org.apache.doris.common.io.Text; +import org.apache.doris.thrift.TExprNode; +import org.apache.doris.thrift.TExprNodeType; +import org.apache.doris.thrift.TJsonLiteral; +import org.apache.logging.log4j.LogManager; +import org.apache.doris.catalog.Type; +import org.apache.logging.log4j.Logger; + +import org.apache.doris.catalog.PrimitiveType; +import org.apache.doris.common.AnalysisException; +import org.apache.doris.common.DdlException; +import org.apache.doris.common.ErrorCode; +import org.apache.doris.common.ErrorReport; +import org.apache.doris.qe.VariableVarConverters; + +public class JsonLiteral extends LiteralExpr { + private static final Logger LOG = LogManager.getLogger(JsonLiteral.class); + private JsonParser parser = new JsonParser(); + private String value; + // Means the converted session variable need to be cast to int, such as "cast 'STRICT_TRANS_TABLES' to Integer". + private String beConverted = ""; + + public JsonLiteral() { + super(); + type = Type.JSON; + } + + public JsonLiteral(String value) throws AnalysisException { + try { + parser.parse(value); Review Comment: we can just accept the value and do parse json work in be. -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org