From e03d860d2726b25fb3b3b4286deea5f58dfdfa36 Mon Sep 17 00:00:00 2001 From: samik Date: Mon, 6 May 2024 22:46:04 +0530 Subject: [PATCH] CDAP-21024: Return null when there is no outputfield --- .../cdap/wrangler/schema/DirectiveOutputSchemaGenerator.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wrangler-core/src/main/java/io/cdap/wrangler/schema/DirectiveOutputSchemaGenerator.java b/wrangler-core/src/main/java/io/cdap/wrangler/schema/DirectiveOutputSchemaGenerator.java index cfac41804..6f2191a4d 100644 --- a/wrangler-core/src/main/java/io/cdap/wrangler/schema/DirectiveOutputSchemaGenerator.java +++ b/wrangler-core/src/main/java/io/cdap/wrangler/schema/DirectiveOutputSchemaGenerator.java @@ -103,6 +103,9 @@ private Schema generateDirectiveOutputSchema(Schema inputSchema) outputFields.add(Schema.Field.of(fieldName, Schema.of(Schema.Type.NULL))); } } + if(outputFields.isEmpty()){ + return null; + } return Schema.recordOf("output", outputFields); }