wzx140 commented on code in PR #3459:
URL: https://github.com/apache/fluss/pull/3459#discussion_r3401280414
##########
fluss-server/src/main/java/org/apache/fluss/server/utils/ServerRpcMessageUtils.java:
##########
@@ -355,17 +359,33 @@ public static List<TableChange>
toAddColumns(List<PbAddColumn> addColumns) {
return addColumns.stream()
.filter(Objects::nonNull)
.map(
- pbAddColumn ->
- TableChange.addColumn(
- pbAddColumn.getColumnName(),
- JsonSerdeUtils.readValue(
- pbAddColumn.getDataTypeJson(),
- DataTypeJsonSerde.INSTANCE),
- pbAddColumn.hasComment() ?
pbAddColumn.getComment() : null,
-
toColumnPosition(pbAddColumn.getColumnPositionType())))
+ pbAddColumn -> {
+ AggFunction aggFunction =
+ pbAddColumn.hasSerializedAggFunction()
+ ? deserializeAggFunction(
+
pbAddColumn.getSerializedAggFunction())
+ : null;
+ return TableChange.addColumn(
+ pbAddColumn.getColumnName(),
+ JsonSerdeUtils.readValue(
+ pbAddColumn.getDataTypeJson(),
+ DataTypeJsonSerde.INSTANCE),
+ pbAddColumn.hasComment() ?
pbAddColumn.getComment() : null,
+
toColumnPosition(pbAddColumn.getColumnPositionType()),
+ aggFunction);
+ })
.collect(Collectors.toList());
}
+ private static AggFunction deserializeAggFunction(byte[]
serializedAggFunction) {
+ try {
+ return InstantiationUtils.deserializeObject(
+ serializedAggFunction, AggFunction.class.getClassLoader());
+ } catch (IOException | ClassNotFoundException e) {
+ throw new FlussRuntimeException("Failed to deserialize aggregation
function.", e);
+ }
+ }
Review Comment:
Fixed
##########
fluss-server/src/main/java/org/apache/fluss/server/utils/TableDescriptorValidation.java:
##########
@@ -377,6 +380,20 @@ private static void checkMergeEngine(
}
}
+ /** Validates that the schema doesn't contain any aggregation functions. */
+ public static void validateNoAggregationFunctions(Schema schema) {
Review Comment:
Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]