Code Monkey home page Code Monkey logo

impala-distinct-count's Introduction

impala-distinct-count

Impala Custom UDAF functions :Support for multi columns distinct count

When you use low version impala to distinct count different columns like "select count(distinct column1),count(distinct column2) from ...", the following error will appear "errorMessage:AnalysisException: all DISTINCT aggregate functions need to have the same set of parameters as ...".So I develop this udaf distinct_count to solve this problem.

Example

For example, there is a Impala table tb1 like this:

column1 column2 column3
abc ADE 234
abc CDF 445
abc ADE 237
abc CDF 445

You can query with distinct_count() function : select distinct_count(column1),distinct_count(column2),distinct_count(column3) from tb1 the result is :

1 2 3

Building

This udaf distinct_count depends on impala-udf-devel
You should get udf-internal.h,udf.h,udf.cc from impala-udf-devel and compile with sources.
The target file is libdistinct_count.so
Put libdistinct_count.so to hdfs path and execute the sql in impala ๏ผš
create aggregate function distinct_count(string) returns string location 'hdfs://xxx/user/impala/udf/libdistinct_count.so' update_fn='DistinctCountUpdate';
Then you can use this function.

impala-distinct-count's People

Contributors

gevygg avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

wutao0914

impala-distinct-count's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.