forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-22994][table-planner] Improve the performace of invoking nesti…
…ng udf This closes apache#16163
- Loading branch information
Showing
3 changed files
with
124 additions
and
9 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
...r/src/main/scala/org/apache/flink/table/planner/codegen/ExternalGeneratedExpression.scala
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,75 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* 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.flink.table.planner.codegen | ||
|
||
import org.apache.flink.table.types.DataType | ||
|
||
/** | ||
* Describes a external generated expression. | ||
* | ||
* @param dataType type of the resultTerm | ||
* @param internalTerm term to access the internal result of the expression | ||
* @param externalTerm term to access the external result of the expression | ||
* @param nullTerm boolean term that indicates if expression is null | ||
* @param internalCode code necessary to produce internalTerm and nullTerm | ||
* @param externalCode code necessary to produce externalTerm | ||
* @param literalValue None if the expression is not literal. Otherwise it represent the | ||
* original object of the literal. | ||
* | ||
*/ | ||
class ExternalGeneratedExpression( | ||
dataType: DataType, | ||
internalTerm: String, | ||
externalTerm: String, | ||
nullTerm: String, | ||
internalCode: String, | ||
externalCode: String, | ||
literalValue: Option[Any] = None) | ||
extends GeneratedExpression( | ||
internalTerm, | ||
nullTerm, | ||
internalCode, | ||
dataType.getLogicalType, | ||
literalValue) { | ||
|
||
def getExternalCode: String = externalCode | ||
|
||
def getExternalTerm: String = externalTerm | ||
|
||
def getDataType: DataType = dataType | ||
|
||
} | ||
|
||
object ExternalGeneratedExpression { | ||
|
||
def fromGeneratedExpression( | ||
dataType: DataType, | ||
externalTerm: String, | ||
externalCode: String, | ||
generatedExpression: GeneratedExpression) | ||
: ExternalGeneratedExpression = { | ||
new ExternalGeneratedExpression( | ||
dataType, | ||
generatedExpression.resultTerm, | ||
externalTerm, | ||
generatedExpression.nullTerm, | ||
generatedExpression.code, externalCode, | ||
generatedExpression.literalValue) | ||
} | ||
} |
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