Skip to content

Commit

Permalink
rename (linkedin#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinGe00 authored Jul 24, 2024
1 parent 96e24e0 commit f817412
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018-2023 LinkedIn Corporation. All rights reserved.
* Copyright 2018-2024 LinkedIn Corporation. All rights reserved.
* Licensed under the BSD-2 Clause license.
* See LICENSE in the project root for license information.
*/
Expand All @@ -20,10 +20,11 @@


/**
* ConvertletTable for Hive Operators
* ConvertletTable for transformations only relevant to Coral's Intermediate Representation, not specific
* any SQL dialect. These transformations keep data parity between the SqlNode and RelNode layer, keeping the IR intact.
* @see ReflectiveConvertletTable documentation for method naming and visibility rules
*/
public class HiveConvertletTable extends ReflectiveConvertletTable {
public class CoralConvertletTable extends ReflectiveConvertletTable {

@SuppressWarnings("unused")
public RexNode convertFunctionFieldReferenceOperator(SqlRexContext cx, FunctionFieldReferenceOperator op,
Expand All @@ -33,14 +34,15 @@ public RexNode convertFunctionFieldReferenceOperator(SqlRexContext cx, FunctionF
return cx.getRexBuilder().makeFieldAccess(funcExpr, fieldName, false);
}

/**
* Override {@link StandardConvertletTable#convertCast} to avoid cast optimizations that remove the cast.
*/
@SuppressWarnings("unused")
public RexNode convertCast(SqlRexContext cx, SqlCastFunction cast, SqlCall call) {
final SqlNode left = call.operand(0);
RexNode leftRex = cx.convertExpression(left);
SqlDataTypeSpec dataType = call.operand(1);
RelDataType castType = dataType.deriveType(cx.getValidator(), true);
// can not call RexBuilder.makeCast() since that optimizes to remove the cast
// we don't want to remove the cast
return cx.getRexBuilder().makeAbstractCast(castType, leftRex);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public HiveFunctionResolver getFunctionResolver() {

@Override
protected SqlRexConvertletTable getConvertletTable() {
return new HiveConvertletTable();
return new CoralConvertletTable();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017-2023 LinkedIn Corporation. All rights reserved.
* Copyright 2017-2024 LinkedIn Corporation. All rights reserved.
* Licensed under the BSD-2 Clause license.
* See LICENSE in the project root for license information.
*/
Expand All @@ -24,8 +24,8 @@
import com.linkedin.coral.common.HiveMetastoreClient;
import com.linkedin.coral.common.HiveRelBuilder;
import com.linkedin.coral.common.ToRelConverter;
import com.linkedin.coral.hive.hive2rel.CoralConvertletTable;
import com.linkedin.coral.hive.hive2rel.DaliOperatorTable;
import com.linkedin.coral.hive.hive2rel.HiveConvertletTable;
import com.linkedin.coral.hive.hive2rel.HiveSqlValidator;
import com.linkedin.coral.hive.hive2rel.functions.HiveFunctionResolver;
import com.linkedin.coral.hive.hive2rel.functions.StaticHiveFunctionRegistry;
Expand Down Expand Up @@ -63,7 +63,7 @@ public TrinoToRelConverter(Map<String, Map<String, List<String>>> localMetaStore

@Override
protected SqlRexConvertletTable getConvertletTable() {
return new HiveConvertletTable();
return new CoralConvertletTable();
}

@Override
Expand Down

0 comments on commit f817412

Please sign in to comment.