-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add functions as UDF input types fix immutable test proof of concept lambda follow up extend lambda functionality proof of concept lambda feat: add lambda syntax to grammar change g4 proof of concept lambda initial type checking bug fixes, clean up clean-up and adding lambda sql type stuff adding lambdas to sql types Type cleanup adding contexts cleanup updating qtt extending support for maps Updating for multiple input types Steven's ast fix + functional tests Initial experiment for new sql type getting return types working cleanup
- Loading branch information
Showing
47 changed files
with
3,130 additions
and
175 deletions.
There are no files selected for viewing
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
73 changes: 73 additions & 0 deletions
73
ksqldb-common/src/main/java/io/confluent/ksql/function/types/LambdaType.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,73 @@ | ||
/* | ||
* Copyright 2021 Confluent Inc. | ||
* | ||
* Licensed under the Confluent Community License (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.confluent.io/confluent-community-license | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package io.confluent.ksql.function.types; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public final class LambdaType extends ObjectType { | ||
|
||
private final ImmutableList<ParamType> inputTypes; | ||
private final ParamType returnType; | ||
|
||
public LambdaType( | ||
final List<ParamType> inputTypes, | ||
final ParamType returnType | ||
) { | ||
this.inputTypes = ImmutableList.copyOf( | ||
Objects.requireNonNull(inputTypes, "inputTypes")); | ||
this.returnType = Objects.requireNonNull(returnType, "returnType"); | ||
} | ||
|
||
public static LambdaType of( | ||
final List<ParamType> inputTypes, | ||
final ParamType returnType | ||
) { | ||
return new LambdaType(inputTypes, returnType); | ||
} | ||
|
||
public List<ParamType> inputTypes() { | ||
return inputTypes; | ||
} | ||
|
||
public ParamType returnType() { | ||
return returnType; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
final LambdaType lambdaType = (LambdaType) o; | ||
return Objects.equals(inputTypes, lambdaType.inputTypes) | ||
&& Objects.equals(returnType, lambdaType.returnType); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(inputTypes, returnType); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "LAMBDA<" + inputTypes + ", " + returnType + ">"; | ||
} | ||
} |
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
Oops, something went wrong.