Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E1B3D18CF9 for ; Fri, 13 Nov 2015 01:42:12 +0000 (UTC) Received: (qmail 32358 invoked by uid 500); 13 Nov 2015 01:42:11 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 32209 invoked by uid 500); 13 Nov 2015 01:42:11 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 32011 invoked by uid 99); 13 Nov 2015 01:42:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Nov 2015 01:42:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 17DA82C1F61 for ; Fri, 13 Nov 2015 01:42:11 +0000 (UTC) Date: Fri, 13 Nov 2015 01:42:11 +0000 (UTC) From: "Dennis Gove (JIRA)" To: dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (SOLR-8185) Add operations support to streaming metrics MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SOLR-8185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14968357#comment-14968357 ] Dennis Gove edited comment on SOLR-8185 at 11/13/15 1:41 AM: ------------------------------------------------------------- Full patch. was (Author: dpgove): Full patch. All tests pass. > Add operations support to streaming metrics > ------------------------------------------- > > Key: SOLR-8185 > URL: https://issues.apache.org/jira/browse/SOLR-8185 > Project: Solr > Issue Type: Improvement > Components: SolrJ > Reporter: Dennis Gove > Assignee: Dennis Gove > Priority: Minor > Attachments: SOLR-8185.patch > > > Adds support for operations on stream metrics. > With this feature one can modify tuple values before applying to the computed metric. There are a lot of use-cases I can see with this - I'll describe one here. > Imagine you have a RollupStream which is computing the average over some field but you cannot be sure that all documents have a value for that field, ie the value is null. When the value is null you want to treat it as a 0. With this feature you can accomplish that like this > {code} > rollup( > search(collection1, q=*:*, fl=\"a_s,a_i,a_f\", sort=\"a_s asc\"), > over=\"a_s\", > avg(a_i, replace(null, withValue=0)), > count(*), > ) > {code} > The operations are applied to the tuple for each metric in the stream which means you perform different operations on different metrics without being impacted by operations on other metrics. > Adding to our previous example, imagine you want to also get the min of a field but do not consider null values. > {code} > rollup( > search(collection1, q=*:*, fl=\"a_s,a_i,a_f\", sort=\"a_s asc\"), > over=\"a_s\", > avg(a_i, replace(null, withValue=0)), > min(a_i), > count(*), > ) > {code} > Also, the tuple is not modified for streams that might wrap this one. Ie, the only thing that sees the applied operation is that particular metric. If you want to apply operations for wrapping streams you can still achieve that with the SelectStream (SOLR-7669). > One feature I'm investigating but this patch DOES NOT add is the ability to assign names to the resulting metric value. For example, to allow for something like this > {code} > rollup( > search(collection1, q=*:*, fl=\"a_s,a_i,a_f\", sort=\"a_s asc\"), > over=\"a_s\", > avg(a_i, replace(null, withValue=0), as="avg_a_i_null_as_0"), > avg(a_i), > count(*, as="totalCount"), > ) > {code} > Right now that isn't possible because the identifier for each metric would be the same "avg_a_i" and as such both couldn't be returned. It's relatively easy to add but I have to investigate its impact on the SQL and FacetStream areas. > Depends on SOLR-7669 (SelectStream) -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org