twalthr commented on code in PR #27913:
URL: https://github.com/apache/flink/pull/27913#discussion_r3131093583
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/serde/DynamicTableSourceSpecSerdeTest.java:
##########
@@ -385,6 +387,50 @@ void
testDynamicTableSourceSpecSerdeWithEnrichmentOptions() throws Exception {
.isEqualTo(",");
}
+ @Test
+ void testMetadataFilterPushDownSpecSerde() throws IOException {
+ FlinkTypeFactory factory =
+ new FlinkTypeFactory(
+ Thread.currentThread().getContextClassLoader(),
FlinkTypeSystem.INSTANCE);
+ RexBuilder rexBuilder = new RexBuilder(factory);
+
+ // RowType uses metadata key names (already translated from SQL
aliases)
+ RowType predicateRowType =
+ RowType.of(
+ new LogicalType[] {new TimestampType(3), new
BigIntType()},
+ new String[] {"timestamp", "offset"});
+
+ MetadataFilterPushDownSpec original =
+ new MetadataFilterPushDownSpec(
+ Arrays.asList(
+ // timestamp > '2024-01-01'
+ rexBuilder.makeCall(
+ SqlStdOperatorTable.GREATER_THAN,
+ rexBuilder.makeInputRef(
+
factory.createSqlType(SqlTypeName.TIMESTAMP, 3), 0),
+ rexBuilder.makeTimestampLiteral(
+ new
TimestampString("2024-01-01 00:00:00"), 3)),
+ // offset >= 10
+ rexBuilder.makeCall(
+
SqlStdOperatorTable.GREATER_THAN_OR_EQUAL,
+ rexBuilder.makeInputRef(
+
factory.createSqlType(SqlTypeName.BIGINT), 1),
+ rexBuilder.makeExactLiteral(new
BigDecimal(10)))),
+ predicateRowType);
+
+ PlannerMocks plannerMocks = PlannerMocks.create();
+ SerdeContext serdeCtx =
+ configuredSerdeContext(
+ plannerMocks.getCatalogManager(),
plannerMocks.getTableConfig());
+
+ String json = toJson(serdeCtx, original);
+ MetadataFilterPushDownSpec deserialized =
+ toObject(serdeCtx, json, MetadataFilterPushDownSpec.class);
Review Comment:
to avoid code deduplication, add your test case to the existing
`testDynamicTableSinkSpecSerde` list of serde items
--
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]