Skip to content

Commit

Permalink
fix some error
Browse files Browse the repository at this point in the history
Signed-off-by: maggie-zhu <[email protected]>
  • Loading branch information
maggie-zhu committed Jan 21, 2025
1 parent e0071f0 commit 9dd9d64
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// Copyright 2021-present StarRocks, Inc. All rights reserved.
//
// Licensed 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
//
// https://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 com.starrocks.connector.parser;

import com.starrocks.analysis.Expr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@

public class Pinot2SRFunctionCallTransformer extends BaseFunctionCallTransformer {

public Pinot2SRFunctionCallTransformer() { super(); }
public Pinot2SRFunctionCallTransformer() {
super();
}

@Override
public Expr convert(String fnName, List<Expr> children) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,8 @@ protected ParseNode visitFunctionCall(FunctionCall node, ParseTreeContext contex
List<Expr> arguments = visit(node.getArguments(), context, Expr.class);

Expr callExpr;
Expr convertedFunctionCall = Trino2SRFunctionCallTransformer.convert(node.getName().toString(), arguments);
Trino2SRFunctionCallTransformer trino2SRFunctionCallTransformer = new Trino2SRFunctionCallTransformer();
Expr convertedFunctionCall = trino2SRFunctionCallTransformer.convert(node.getName().toString(), arguments);
if (convertedFunctionCall != null) {
callExpr = convertedFunctionCall;
} else if (DISTINCT_FUNCTION.contains(node.getName().toString())) {
Expand Down Expand Up @@ -1022,7 +1023,8 @@ protected ParseNode visitCoalesceExpression(CoalesceExpression node, ParseTreeCo
@Override
protected ParseNode visitExtract(Extract node, ParseTreeContext context) {
String fieldString = node.getField().toString().toLowerCase();
Expr expr = Trino2SRFunctionCallTransformer.convert(fieldString,
Trino2SRFunctionCallTransformer trino2SRFunctionCallTransformer = new Trino2SRFunctionCallTransformer();
Expr expr = trino2SRFunctionCallTransformer.convert(fieldString,
Lists.newArrayList((Expr) visit(node.getExpression(), context)));
return Objects.requireNonNullElseGet(expr, () -> new FunctionCallExpr(fieldString,
new FunctionParams(Lists.newArrayList((Expr) visit(node.getExpression(), context)))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@

public class Trino2SRFunctionCallTransformer extends BaseFunctionCallTransformer {

public Trino2SRFunctionCallTransformer() { super(); }
public Trino2SRFunctionCallTransformer() {
super();
}

@Override
public Expr convert(String fnName, List<Expr> children) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.starrocks.qe.OriginStatement;
import com.starrocks.qe.SessionVariable;
import com.starrocks.server.GlobalStateMgr;
import com.starrocks.sql.analyzer.AstToSQLBuilder;
import com.starrocks.sql.ast.ImportColumnsStmt;
import com.starrocks.sql.ast.PrepareStmt;
import com.starrocks.sql.ast.StatementBase;
Expand Down

0 comments on commit 9dd9d64

Please sign in to comment.