GitHub user gczsjdy opened a pull request:

    https://github.com/apache/spark/pull/17359

    Add aggreagate expression nGrams

    ## What changes were proposed in this pull request?
    
    This is the implementation of Hive's `ngrams`, which is a popular 
statistical and data mining function.
    
    N-grams are  subsequences of length N drawn from a longer sequence. The 
purpose of the `ngrams` aggregate expression is to find the k most frequent 
n-grams from one or more sequences.
    
    This expression has the pattern of : ngrams(children: 
Array<Array<String>>(or Array<String>), n: Int, k: Int, accuracy: Int), all 
parameters are of `Expresion` type, I use the above way to indicate the type 
after evaluation. Among the parameters, 
    children indicates the 'longer sequence' we collect n-grams from;
    n & k indicate the top k n-grams;
    accuracy is related to the memory used for frequency estimation, more 
memory will give more accurate frequency counts.
    
    ## How was this patch tested?
    
    Unit tests are in `NGramsQuerySuite` 


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gczsjdy/spark UdafNGram

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/17359.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #17359
    
----

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to