this doesnt work

This commit is contained in:
Zoltan Haindrich 2024-08-05 14:15:02 +00:00
parent c40474285c
commit 1063948749
2 changed files with 30 additions and 7 deletions

View File

@ -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<String> 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, "<taskId>");
hookDispatcher.dispatch(DruidHook.MSQ_PLAN, str);
}
catch (JsonProcessingException e) {

View File

@ -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