-
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.
fix: support UDAFs with different intermediate schema (#3412)
- Loading branch information
1 parent
3eb5327
commit 70e10e9
Showing
22 changed files
with
307 additions
and
77 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
70 changes: 70 additions & 0 deletions
70
ksql-engine/src/main/java/io/confluent/ksql/materialization/AggregatesInfo.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,70 @@ | ||
/* | ||
* Copyright 2019 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.materialization; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.google.errorprone.annotations.Immutable; | ||
import io.confluent.ksql.execution.expression.tree.FunctionCall; | ||
import io.confluent.ksql.schema.ksql.LogicalSchema; | ||
import java.util.List; | ||
|
||
|
||
@Immutable | ||
public final class AggregatesInfo { | ||
|
||
private final int startingColumnIndex; | ||
private final List<FunctionCall> aggregateFunctions; | ||
private final LogicalSchema schema; | ||
|
||
/** | ||
* @param startingColumnIndex column index of first aggregate function. | ||
* @param aggregateFunctions the map of column index to aggregate function. | ||
* @param schema the schema required by the aggregators. | ||
* @return the immutable instance. | ||
*/ | ||
public static AggregatesInfo of( | ||
final int startingColumnIndex, | ||
final List<FunctionCall> aggregateFunctions, | ||
final LogicalSchema schema | ||
) { | ||
return new AggregatesInfo(startingColumnIndex, aggregateFunctions, schema); | ||
} | ||
|
||
private AggregatesInfo( | ||
final int startingColumnIndex, | ||
final List<FunctionCall> aggregateFunctions, | ||
final LogicalSchema prepareSchema | ||
) { | ||
this.startingColumnIndex = startingColumnIndex; | ||
this.aggregateFunctions = ImmutableList | ||
.copyOf(requireNonNull(aggregateFunctions, "aggregateFunctions")); | ||
this.schema = requireNonNull(prepareSchema, "prepareSchema"); | ||
} | ||
|
||
public int startingColumnIndex() { | ||
return startingColumnIndex; | ||
} | ||
|
||
public List<FunctionCall> aggregateFunctions() { | ||
return aggregateFunctions; | ||
} | ||
|
||
public LogicalSchema schema() { | ||
return schema; | ||
} | ||
} |
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
Oops, something went wrong.