[ https://issues.apache.org/jira/browse/DRILL-5867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16246537#comment-16246537 ]
ASF GitHub Bot commented on DRILL-5867: --------------------------------------- Github user arina-ielchiieva commented on a diff in the pull request: https://github.com/apache/drill/pull/1029#discussion_r150086785 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java --- @@ -93,13 +96,35 @@ public ProfileInfo(DrillConfig drillConfig, String queryId, long startTime, long this.time = new Date(startTime); this.foreman = foreman; this.link = generateLink(drillConfig, foreman, queryId); - this.query = query.substring(0, Math.min(query.length(), 150)); + this.query = extractQuerySnippet(query); this.state = state; this.user = user; this.totalCost = totalCost; this.queueName = queueName; } + private String extractQuerySnippet(String queryText) { + //Extract upto max char limit as snippet + String sizeCappedQuerySnippet = queryText.substring(0, Math.min(queryText.length(), QUERY_SNIPPET_MAX_CHAR)); + //Trimming down based on line-count + if ( QUERY_SNIPPET_MAX_LINES < sizeCappedQuerySnippet.split(System.lineSeparator()).length ) { + int linesConstructed = 0; + StringBuilder lineCappedQuerySnippet = new StringBuilder(); + String[] queryParts = sizeCappedQuerySnippet.split(System.lineSeparator()); + for (String qPart : queryParts) { + lineCappedQuerySnippet.append(qPart); + if ( ++linesConstructed < QUERY_SNIPPET_MAX_LINES ) { + lineCappedQuerySnippet.append(System.lineSeparator()); --- End diff -- Do we want to append with new line or maybe space for better readability? > List profiles in pages rather than a long verbose listing > --------------------------------------------------------- > > Key: DRILL-5867 > URL: https://issues.apache.org/jira/browse/DRILL-5867 > Project: Apache Drill > Issue Type: Sub-task > Components: Web Server > Affects Versions: 1.11.0 > Reporter: Kunal Khatua > Assignee: Kunal Khatua > Priority: Minor > Fix For: 1.12.0 > > Attachments: DefaultRendering.png, FilteringFailed.png > > -- This message was sent by Atlassian JIRA (v6.4.14#64029)