Source:
public TableSchema resolve(TableSchema tableSchema) { final String rowtime; if (!tableSchema.getWatermarkSpecs().isEmpty()) { rowtime = tableSchema.getWatermarkSpecs().get(0).getRowtimeAttribute(); if (rowtime.contains(".")) { throw new ValidationException( String.format("Nested field '%s' as rowtime attribute is not supported right now.", rowtime)); } } else { rowtime = null; } String[] fieldNames = tableSchema.getFieldNames(); DataType[] fieldTypes = tableSchema.getFieldDataTypes(); TableSchema.Builder builder = TableSchema.builder(); for (int i = 0; i < tableSchema.getFieldCount(); ++i) { TableColumn tableColumn = tableSchema.getTableColumns().get(i); DataType fieldType = fieldTypes[i]; DataType exprType = null; if (tableColumn.isGenerated()) { exprType = resolveExpressionDataType(tableColumn.getExpr().get(), tableSchema); } if (exprType != null && isProctime(exprType)) { if (fieldNames[i].equals(rowtime)) { throw new TableException("Watermark can not be defined for a processing time attribute column."); } fieldType = exprType; } else if (isStreamingMode && fieldNames[i].equals(rowtime)) { TimestampType originalType = (TimestampType) fieldType.getLogicalType(); LogicalType rowtimeType = new TimestampType( originalType.isNullable(), TimestampKind.ROWTIME, originalType.getPrecision()); fieldType = TypeConversions.fromLogicalToDataType(rowtimeType); } if (tableColumn.isGenerated()) { builder.field(fieldNames[i], fieldType, tableColumn.getExpr().get()); } else { builder.field(fieldNames[i], fieldType); } } tableSchema.getWatermarkSpecs().forEach(builder::watermark); tableSchema.getPrimaryKey().ifPresent( pk -> builder.primaryKey(pk.getName(), pk.getColumns().toArray(new String[0]))); return builder.build(); }

Target:
public TableSchema resolve(TableSchema tableSchema) { final String rowtime; if (!tableSchema.getWatermarkSpecs().isEmpty()) { rowtime = tableSchema.getWatermarkSpecs().get(0).getRowtimeAttribute(); if (rowtime.contains(".")) { throw new ValidationException( String.format("Nested field '%s' as rowtime attribute is not supported right now.", rowtime)); } } else { rowtime = null; } String[] fieldNames = tableSchema.getFieldNames(); DataType[] fieldTypes = tableSchema.getFieldDataTypes(); TableSchema.Builder builder = TableSchema.builder(); for (int i = 0; i < tableSchema.getFieldCount(); ++i) { TableColumn tableColumn = tableSchema.getTableColumns().get(i); DataType fieldType = fieldTypes[i]; if (tableColumn.isGenerated()) { fieldType = resolveExpressionDataType(tableColumn.getExpr().get(), tableSchema); if (isProctime(fieldType)) { if (fieldNames[i].equals(rowtime)) { throw new TableException("Watermark can not be defined for a processing time attribute column."); } } } if (isStreamingMode && fieldNames[i].equals(rowtime)) { TimestampType originalType = (TimestampType) fieldType.getLogicalType(); LogicalType rowtimeType = new TimestampType( originalType.isNullable(), TimestampKind.ROWTIME, originalType.getPrecision()); fieldType = TypeConversions.fromLogicalToDataType(rowtimeType); } if (tableColumn.isGenerated()) { builder.field(fieldNames[i], fieldType, tableColumn.getExpr().get()); } else { builder.field(fieldNames[i], fieldType); } } tableSchema.getWatermarkSpecs().forEach(builder::watermark); tableSchema.getPrimaryKey().ifPresent( pk -> builder.primaryKey(pk.getName(), pk.getColumns().toArray(new String[0]))); return builder.build(); }