vogievetsky commented on code in PR #14017:
URL: https://github.com/apache/druid/pull/14017#discussion_r1159941285
##########
web-console/src/utils/sampler.ts:
##########
@@ -63,6 +63,38 @@ export interface SamplerConfig {
export interface SampleResponse {
data: SampleEntry[];
+ logicalSegmentSchema: { name: string; type: string }[];
+ logicalDimensions: DimensionSpec[];
+ physicalDimensions: DimensionSpec[];
+ numRowsIndexed: number;
+ numRowsRead: number;
+}
+
+export function getHeaderNamesFromSampleResponse(
+ sampleResponse: SampleResponse,
+ ignoreTimeColumn = false,
+) {
+ return filterMap(sampleResponse.logicalSegmentSchema, s =>
+ ignoreTimeColumn && s.name === '__time' ? undefined : s.name,
+ );
+}
+
+export function guessDimensionsFromSampleResponse(sampleResponse:
SampleResponse): DimensionSpec[] {
+ const { logicalDimensions, physicalDimensions, data } = sampleResponse;
+ return logicalDimensions.map(d => {
+ // Boolean column are currently reported as "long" so let's turn them into
"string"
Review Comment:
the reason it is picking string is that if you pick long then it forces the
`true` / `false` in the input to `null` (instead of `1` / `0`)
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]