You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "vogievetsky (via GitHub)" <gi...@apache.org> on 2023/04/06 15:15:12 UTC

[GitHub] [druid] vogievetsky commented on a diff in pull request #14017: Web console: use new sampler features

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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org