LinkedInAttic / Cubert

Fast and efficient batch computation engine for complex analysis and reporting of massive datasets on Hadoop
http://linkedin.github.io/Cubert/
Apache License 2.0
245 stars 61 forks source link

Compile Error with custom Test UDAF from cubert code #9

Open swapnils10 opened 8 years ago

swapnils10 commented 8 years ago

I have a scenario in which i need to pick the first non null element for each grouping key of CUBE operator.

Where can i find reference steps to write a custom aggregation function for CUBE operator in CUBERT.

The reference for it at link http://linkedin.github.io/Cubert/userdefined/aggregations.html is empty.

Also, I tried to implement custom test UDAF as specified in below path :

https://github.com/linkedin/Cubert/blob/master/src/test/java/com/linkedin/cubert/operator/TestUDAF.java

I have created the jar, registered that jar and declared the function in cubert script which uses that UDAF. However, the script fails with below error :

Caused by: PreconditionException [MISC_ERROR] com.comscore.cookiecount.cubert.functions.TestUDAF should implement one of these interfaces: AdditiveCubeAggregate, PartitionedAdditiveAggregate, EasyCubeAggregate at com.linkedin.cubert.operator.CubeOperator.createAggregators(CubeOperator.java:641) at com.linkedin.cubert.operator.CubeOperator.createOutputSchema(CubeOperator.java:449) at com.linkedin.cubert.operator.CubeOperator.getPostCondition(CubeOperator.java:413) at com.linkedin.cubert.analyzer.physical.SemanticAnalyzer.getPostCondition(SemanticAnalyzer.java:811) at com.linkedin.cubert.analyzer.physical.SemanticAnalyzer.visitOperator(SemanticAnalyzer.java:309) ... 9 more

Caused by: PreconditionException [MISC_ERROR] com.myudfs.cubert.functions. TestUDAF should implement one of these interfaces: AdditiveCubeAggregate, PartitionedAdditiveAggregate, EasyCubeAggregate at com.linkedin.cubert.operator.CubeOperator.createAggregators(CubeOperator.java:641) at com.linkedin.cubert.operator.CubeOperator.createOutputSchema(CubeOperator.java:449) at com.linkedin.cubert.operator.CubeOperator.getPostCondition(CubeOperator.java:413) at com.linkedin.cubert.analyzer.physical.SemanticAnalyzer.getPostCondition(SemanticAnalyzer.java:811) at com.linkedin.cubert.analyzer.physical.SemanticAnalyzer.visitOperator(SemanticAnalyzer.java:309) ... 9 more

Is there something I'm missing in this implementation ?

Thanks,

Swapnil Salunkhe