From 106394874987e1db34bbaed0c4e81393e6429b12 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Mon, 5 Aug 2024 14:15:02 +0000 Subject: [PATCH] this doesnt work --- .../druid/sql/avatica/MSQDruidMeta.java | 27 +++++++++++++++++-- .../msq1.iq | 10 +++---- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/sql/avatica/MSQDruidMeta.java b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/sql/avatica/MSQDruidMeta.java index bae85aefdef..2408ab38ecc 100644 --- a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/sql/avatica/MSQDruidMeta.java +++ b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/sql/avatica/MSQDruidMeta.java @@ -21,7 +21,13 @@ package org.apache.druid.sql.avatica; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; +import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter.SerializeExceptFilter; +import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; import com.google.inject.Inject; import org.apache.calcite.avatica.Meta; import org.apache.calcite.rel.type.RelDataType; @@ -42,6 +48,7 @@ import org.apache.druid.sql.hook.DruidHookDispatcher; import java.util.Collections; import java.util.List; +import java.util.Set; public class MSQDruidMeta extends DruidMeta { @@ -90,10 +97,26 @@ public class MSQDruidMeta extends DruidMeta throw new ISE("Results report not present in the task's report payload"); } try { - String str = objectMapper - .writerWithDefaultPrettyPrinter() +// objectMapper.setexc +// objectMapper.wit + + Set ignorableFieldNames = ImmutableSet.of("sqlQueryId", "startTime", "duration"); + SimpleBeanPropertyFilter simpleFilterProvider = SerializeExceptFilter.serializeAllExcept(ignorableFieldNames); +// simpleFilterProvider.serializeAllExcept(ignorableFieldNames); +// FilterProvider filters = simpleFilterProvider.addFilter("customerFilter", SimpleBeanPropertyFilter.serializeAllExcept(ignorableFieldNames)); + + SerializationFeature f1; + + SimpleFilterProvider ff = new SimpleFilterProvider(); + ff.addFilter("removeSome",simpleFilterProvider); + ; + ObjectWriter writerWithDefaultPrettyPrinter = objectMapper.copy().setFilterProvider(ff) + .writerWithDefaultPrettyPrinter(); + + String str = writerWithDefaultPrettyPrinter .writeValueAsString(payload.getStages()); str = str.replaceAll(taskId, ""); + hookDispatcher.dispatch(DruidHook.MSQ_PLAN, str); } catch (JsonProcessingException e) { diff --git a/extensions-core/multi-stage-query/src/test/quidem/org.apache.druid.msq.exec.MSQQuidemTest/msq1.iq b/extensions-core/multi-stage-query/src/test/quidem/org.apache.druid.msq.exec.MSQQuidemTest/msq1.iq index daee9880b86..d2fd7ec5941 100644 --- a/extensions-core/multi-stage-query/src/test/quidem/org.apache.druid.msq.exec.MSQQuidemTest/msq1.iq +++ b/extensions-core/multi-stage-query/src/test/quidem/org.apache.druid.msq.exec.MSQQuidemTest/msq1.iq @@ -94,7 +94,7 @@ order by 1; "finalize" : true, "maxParseExceptions" : 0, "plannerStrategy" : "DECOUPLED", - "sqlQueryId" : "1e9ae92b-02e5-4506-be2e-8d89ce1dc77d", + "sqlQueryId" : "0d086117-b160-4367-9c73-f2e111ad9c5b", "sqlStringifyArrays" : false } } @@ -127,8 +127,8 @@ order by 1; "partitionCount" : 1, "shuffle" : "globalSort", "output" : "localStorage", - "startTime" : "2024-07-26T04:26:29.003Z", - "duration" : 724, + "startTime" : "2024-08-05T14:14:37.761Z", + "duration" : 628, "sort" : true }, { "stageNumber" : 1, @@ -200,7 +200,7 @@ order by 1; "finalize" : true, "maxParseExceptions" : 0, "plannerStrategy" : "DECOUPLED", - "sqlQueryId" : "1e9ae92b-02e5-4506-be2e-8d89ce1dc77d", + "sqlQueryId" : "0d086117-b160-4367-9c73-f2e111ad9c5b", "sqlStringifyArrays" : false } } @@ -221,7 +221,7 @@ order by 1; "workerCount" : 1, "partitionCount" : 1, "output" : "localStorage", - "startTime" : "2024-07-26T04:26:29.727Z", + "startTime" : "2024-08-05T14:14:38.389Z", "duration" : 2 } ] !msqPlan