[ https://issues.apache.org/jira/browse/LUCENE-9395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17128849#comment-17128849 ]
Lucene/Solr QA commented on LUCENE-9395: ---------------------------------------- | (x) *{color:red}-1 overall{color}* | \\ \\ || Vote || Subsystem || Runtime || Comment || || || || || {color:brown} Prechecks {color} || | {color:red}-1{color} | {color:red} test4tests {color} | {color:red} 0m 0s{color} | {color:red} The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. {color} | || || || || {color:brown} master Compile Tests {color} || | {color:green}+1{color} | {color:green} compile {color} | {color:green} 1m 13s{color} | {color:green} master passed {color} | || || || || {color:brown} Patch Compile Tests {color} || | {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 53s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} javac {color} | {color:green} 0m 53s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} Release audit (RAT) {color} | {color:green} 0m 53s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} Check forbidden APIs {color} | {color:green} 0m 53s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} Validate source patterns {color} | {color:green} 0m 53s{color} | {color:green} the patch passed {color} | || || || || {color:brown} Other Tests {color} || | {color:green}+1{color} | {color:green} unit {color} | {color:green} 6m 9s{color} | {color:green} core in the patch passed. {color} | | {color:black}{color} | {color:black} {color} | {color:black} 10m 3s{color} | {color:black} {color} | \\ \\ || Subsystem || Report/Notes || | JIRA Issue | LUCENE-9395 | | JIRA Patch URL | https://issues.apache.org/jira/secure/attachment/13005170/LUCENE-9395.patch | | Optional Tests | compile javac unit ratsources checkforbiddenapis validatesourcepatterns | | uname | Linux lucene2-us-west.apache.org 4.4.0-170-generic #199-Ubuntu SMP Thu Nov 14 01:45:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux | | Build tool | ant | | Personality | /home/jenkins/jenkins-slave/workspace/PreCommit-LUCENE-Build/sourcedir/dev-tools/test-patch/lucene-solr-yetus-personality.sh | | git revision | master / 4dcdd75 | | ant | version: Apache Ant(TM) version 1.9.6 compiled on July 20 2018 | | Default Java | LTS | | Test Results | https://builds.apache.org/job/PreCommit-LUCENE-Build/282/testReport/ | | modules | C: lucene/core U: lucene/core | | Console output | https://builds.apache.org/job/PreCommit-LUCENE-Build/282/console | | Powered by | Apache Yetus 0.7.0 http://yetus.apache.org | This message was automatically generated. > ConstantValuesSource creates more than one DoubleValues unnecessarily > ---------------------------------------------------------------------- > > Key: LUCENE-9395 > URL: https://issues.apache.org/jira/browse/LUCENE-9395 > Project: Lucene - Core > Issue Type: Improvement > Components: core/search > Affects Versions: 8.5.2 > Reporter: Tony Xu > Priority: Minor > Attachments: LUCENE-9395.patch > > > At my day job, we use ConstantValuesSource to represent default values or a > constant query-level feature by calling *_DoubleValuesSource.constant_*. I > realized under the hood the _*ConstantValuesSource.getDoubleValues*_ creates > a new _*DoubleValues*_ which simply return the specified value each time it > is called. > Unless I missed something, I don't see a risk of creating one > _*DoubleValues*_ as use it as the return value of all _*getDoubleValues**()*_ > calls given that the constant _*DoubleValues*_ doesn't maintain any state. > We can also offer the user flexibilities of how to initialize it. > 1) _*DoubleValuesSource.constant(double constant)*_ – we can eagerly > initialize an `DoubleValues` that returns the constant and make it the return > value of all _*getDoubleValues()*_ calls. > 2) _*DoubleValuesSource.constant(DoubleSupplier doubleSupplier)*_ – For lazy > evaluation if the constant takes some time to compute and user expects the > returned DVS will not be used in all code path. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org