You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/07/18 22:54:05 UTC

[GitHub] [incubator-druid] vogievetsky commented on a change in pull request #7986: Web Console: add Group by interval to segments view

vogievetsky commented on a change in pull request #7986: Web Console: add Group by interval to segments view
URL: https://github.com/apache/incubator-druid/pull/7986#discussion_r305145658
 
 

 ##########
 File path: web-console/src/views/segments-view/segments-view.tsx
 ##########
 @@ -134,11 +152,80 @@ export class SegmentsView extends React.PureComponent<SegmentsViewProps, Segment
       hiddenColumns: new LocalStorageBackedArray<string>(
         LocalStorageKeys.SEGMENT_TABLE_COLUMN_SELECTION,
       ),
+      loaded: false,
+      groupByInterval: false,
+
+      // Table state
+      page: null,
+      pageSize: null,
+      sorted: null,
+      filtered: null,
     };
 
     this.segmentsSqlQueryManager = new QueryManager({
-      processQuery: async (query: QueryAndSkip) => {
-        const results: any[] = (await queryDruidSql({ query: query.query })).slice(query.skip);
+      processQuery: async (query: SegmentsQuery, setIntermediateQuery) => {
+        const totalQuerySize = (query.page + 1) * query.pageSize;
+
+        const whereParts = query.filtered
+          .map((f: Filter) => {
+            if (f.id.startsWith('is_')) {
+              if (f.value === 'all') return null;
+              return `${JSON.stringify(f.id)} = ${f.value === 'true' ? 1 : 0}`;
+            } else {
+              return sqlQueryCustomTableFilter(f);
+            }
+          })
+          .filter(Boolean);
+
+        let queryParts: string[];
+        if (query.groupByInterval) {
+          queryParts = [
+            `SELECT`,
+            `  ("start" || '/' || "end") AS "interval",`,
+            `  "segment_id", "datasource", "start", "end", "size", "version", "partition_num", "num_replicas", "num_rows", "is_published", "is_available", "is_realtime", "is_overshadowed", "payload"`,
+            `FROM sys.segments`,
+            `WHERE ("start" || '/' || "end") IN (SELECT "start" || '/' || "end" FROM sys.segments GROUP BY 1 LIMIT ${totalQuerySize})`,
 
 Review comment:
   the inner query should also use the where part

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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