You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hivemall.apache.org by GitBox <gi...@apache.org> on 2021/03/25 08:51:38 UTC

[GitHub] [incubator-hivemall] myui opened a new pull request #232: [HIVEMALL-301] Remove macros and replace them with UDF

myui opened a new pull request #232:
URL: https://github.com/apache/incubator-hivemall/pull/232


   ## What changes were proposed in this pull request?
   
   Remove macros and replace them with UDF
   
   ## What type of PR is it?
   
   Improvement, Refactoring
   
   ## What is the Jira issue?
   
   https://issues.apache.org/jira/browse/HIVEMALL-301
   
   ## How was this patch tested?
   
   manual tests
   
   ## Checklist
   
   - [x] Did you apply source code formatter, i.e., `./bin/format_code.sh`, for your commit?
   - [ ] Did you run system tests on Hive (or Spark)?
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-hivemall] asfgit closed pull request #232: [HIVEMALL-301] Remove macros and replace them with UDF

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #232:
URL: https://github.com/apache/incubator-hivemall/pull/232


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-hivemall] myui commented on pull request #232: [HIVEMALL-301] Remove macros and replace them with UDF

Posted by GitBox <gi...@apache.org>.
myui commented on pull request #232:
URL: https://github.com/apache/incubator-hivemall/pull/232#issuecomment-809136825


   ```sql
   create temporary macro max2(x DOUBLE, y DOUBLE)
   if(x>y,x,y);
   
   create temporary macro tfidf2(tf DOUBLE, df_t DOUBLE, n_docs DOUBLE)
   tf * (log(10, n_docs / max2(1,df_t)) + 1.0);
   
   create temporary macro tfidf3(tf DOUBLE, df_t DOUBLE, n_docs DOUBLE)
   tf * (log10(n_docs / max2(1,df_t)) + 1.0);
   
   WITH data AS (
     select
      0.023809524 freq,
      2 as docs,
      3 as total_docs
   )
   select
     tfidf(freq, docs, total_docs) as tfidf_udf,
     tfidf2(freq, docs, total_docs) as tfidf_macro,
     tfidf3(freq, docs, total_docs) as tfidf_macro2
   from
     data;
   ```
   
   > tfidf_udf       tfidf_macro     tfidf_macro2
   > 0.02800217305867646     0.02800217305867646     0.02800217305867646
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org