panbingkun commented on PR #47741:
URL: https://github.com/apache/spark/pull/47741#issuecomment-2292828191

   > > > 
https://github.com/openjdk/jdk/blob/dfacda488bfbe2e11e8d607a6d08527710286982/src/java.base/share/classes/java/util/Arrays.java#L2146-L2173
   > > > ```
   > > >     /**
   > > >      * Searches the specified array for the specified object using the 
binary
   > > >      * search algorithm. The array must be sorted into ascending order
   > > >      * according to the
   > > >      * {@linkplain Comparable natural ordering}
   > > >      * of its elements (as by the
   > > >      * {@link #sort(Object[])} method) prior to making this call.
   > > >      * If it is not sorted, the results are undefined.
   > > >      * (If the array contains elements that are not mutually 
comparable (for
   > > >      * example, strings and integers), it <i>cannot</i> be sorted 
according
   > > >      * to the natural ordering of its elements, hence results are 
undefined.)
   > > >      * If the array contains multiple
   > > >      * elements equal to the specified object, there is no guarantee 
which
   > > >      * one will be found.
   > > >      *
   > > >      * @param a the array to be searched
   > > >      * @param key the value to be searched for
   > > >      * @return index of the search key, if it is contained in the 
array;
   > > >      *         otherwise, <code>(-(<i>insertion point</i>) - 
1)</code>.  The
   > > >      *         <i>insertion point</i> is defined as the point at which 
the
   > > >      *         key would be inserted into the array: the index of the 
first
   > > >      *         element greater than the key, or {@code a.length} if all
   > > >      *         elements in the array are less than the specified key.  
Note
   > > >      *         that this guarantees that the return value will be 
&gt;= 0 if
   > > >      *         and only if the key is found.
   > > >      * @throws ClassCastException if the search key is not comparable 
to the
   > > >      *         elements of the array.
   > > >      */
   > > > ```
   > > > 
   > > > 
   > > >     
   > > >       
   > > >     
   > > > 
   > > >       
   > > >     
   > > > 
   > > >     
   > > >   
   > > > From the comments of the `java.util.Arrays#binarySearch` method:
   > > > 
   > > > 1. The input array must be in ascending order before calling this 
method; if the array is not sorted, the results are undefined. How we ensured 
this?
   > > > 2. If the array contains multiple elements equal to the specified 
object, there is no guarantee which one will be found. Is this within our 
expectations?
   > > 
   > > 
   > > https://issues.apache.org/jira/browse/SPARK-49203 <img alt="image" 
width="694" 
src="https://private-user-images.githubusercontent.com/15246973/358459180-a309bef1-bddc-4334-b5a4-d1da3c4bd82b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM3Nzk0MzEsIm5iZiI6MTcyMzc3OTEzMSwicGF0aCI6Ii8xNTI0Njk3My8zNTg0NTkxODAtYTMwOWJlZjEtYmRkYy00MzM0LWI1YTQtZDFkYTNjNGJkODJiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE2VDAzMzIxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJlNTE0Y2ViMDI3MTY5MTJiMzFlZjc2ZjEzNDhlNWE3NTY2ZTdmM2YxM2ZmNWRiZmE0ODM5NTJiMTlhY2EzZjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.hm1TGsyDwRF-7fgf1ABWpvwyT1D0y1hdT9VN5sRu75Q";>
 The second one, I think, is also within our expectations and has no impact on 
implemen
 ting `connect plotting function`, right? @zhengruifeng
   > 
   > I think this point should be added to the function comments and emphasize 
that the input must be sorted in ascending order.
   
   Okay.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to