-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Coral-Spark: Migrate some operator transformers from RelNode layer to…
… SqlNode layer
- Loading branch information
Showing
21 changed files
with
591 additions
and
530 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...rc/main/java/com/linkedin/coral/common/transformers/OperatorRenameSqlCallTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Copyright 2023 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.coral.common.transformers; | ||
|
||
import org.apache.calcite.sql.SqlCall; | ||
import org.apache.calcite.sql.SqlNodeList; | ||
import org.apache.calcite.sql.parser.SqlParserPos; | ||
|
||
|
||
/** | ||
* This class is a subclass of {@link SourceOperatorMatchSqlCallTransformer} which renames the source operator | ||
*/ | ||
public class OperatorRenameSqlCallTransformer extends SourceOperatorMatchSqlCallTransformer { | ||
private final String targetOpName; | ||
|
||
public OperatorRenameSqlCallTransformer(String sourceOpName, int numOperands, String targetOpName) { | ||
super(sourceOpName, numOperands); | ||
this.targetOpName = targetOpName; | ||
} | ||
|
||
@Override | ||
protected SqlCall transform(SqlCall sqlCall) { | ||
return createSqlOperatorOfFunction(targetOpName, sqlCall.getOperator().getReturnTypeInference()) | ||
.createCall(new SqlNodeList(sqlCall.getOperandList(), SqlParserPos.ZERO)); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...in/java/com/linkedin/coral/common/transformers/SourceOperatorMatchSqlCallTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright 2023 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.coral.common.transformers; | ||
|
||
import org.apache.calcite.sql.SqlCall; | ||
|
||
|
||
/** | ||
* This class is a subclass of {@link SqlCallTransformer} which transforms a function operator on SqlNode layer | ||
* if the signature of the operator to be transformed, including both the name and the number of operands, | ||
* matches the target values in the condition function. | ||
*/ | ||
public abstract class SourceOperatorMatchSqlCallTransformer extends SqlCallTransformer { | ||
protected final String sourceOpName; | ||
protected final int numOperands; | ||
|
||
public SourceOperatorMatchSqlCallTransformer(String sourceOpName, int numOperands) { | ||
this.sourceOpName = sourceOpName; | ||
this.numOperands = numOperands; | ||
} | ||
|
||
@Override | ||
protected boolean condition(SqlCall sqlCall) { | ||
return sourceOpName.equalsIgnoreCase(sqlCall.getOperator().getName()) | ||
&& sqlCall.getOperandList().size() == numOperands; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 0 additions & 49 deletions
49
coral-spark/src/main/java/com/linkedin/coral/spark/BuiltinUDFMap.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.