Comments (6)
I spotted my mistake. In the demo project in the my-spark-sql.function
namespace I have the macro
(defmacro udf
[args & body]
(let [udf# (ffn/mk-sym "my-spark-sql.function/udf%d" (count args))]
`(~udf# (fn ~args ~@body))))
however it should be
(defmacro udf
[args & body]
(let [udf# (ffn/mk-sym "my-spark-sql.function/udf%d" (count args))]
`(~udf# (sfn/fn ~args ~@body))))
In the last line I should be creating an anonymous serializable.fn
rather than an anonymous fn
. I didn't manage to strip away enough complexity when building the test project.
Is this something that I could contribute to the Flambo project?
from flambo.
@gareth625 hello! great work, thank you! do you have any examples with udaf (defined aggregate function)? I want to implement group by function over sql.dataset
from flambo.
@NonaryR unfortunately I haven't. I've just had a look and I think it's a slightly different problem as the UDAF isn't an interface it's an abstract class. My Java and Clojure/Java interop isn't strong enough to know how much of a difference this makes.
I'd be interesting to hear what you find out.
I have some ideas but can't test them at the moment and don't want to suggested deadends as I don't really have enough experience to know if they're pointless.
from flambo.
@gareth625 Good catch--yes, to send the function, it needs to be serializable.
And yes, your udf macro looks helpful, and it'd be nice to have it in flambo.function
. Would you like to make a PR for that?
Note that you've duplicated UDF16 a couple times, but I imagine you've caught that by now. :) You might even use a macro to generate numbers 1-16.
Thanks for the proposal, and we look forward to a PR if you're willing.
from flambo.
#131 add udf1-udf3, sql test
from flambo.
Hi @jiyouyou125
Thanks for that. I'd done a bit of work last week but was having trouble in my repl. I've created a PR against your repo with the helper macros to generate all the possible UDF helpers.
I think there's a bit more tidying up that can be done with regard to registering the UDFs but I'm away now until next week.
Sorry for the slow response.
Thanks
Gareth
from flambo.
Related Issues (20)
- Left Outer Join documentation is inaccurate HOT 4
- key-val-fn return NullPointerException when key is vector HOT 1
- Error using flambo sql HOT 1
- Flambo shell HOT 2
- dataframe via jdbc.write() doesn't save results? HOT 1
- Exception: org.apache.spark.SparkException: Failed to get broadcast_0_piece0 of broadcast_0 HOT 1
- Warning killing my CI HOT 3
- `flambo.sql` shadows `clojure.core/count`
- Wrapper for `.foreachRDD` is missing
- Possible issue with set-if-missing? HOT 2
- Getting error on spark job submission HOT 5
- Not working with clojure 1.9
- support spark 2.3.1 HOT 9
- Getting error while using map and filter functions HOT 1
- Getting error while setting Spark configuration
- No session ns in 0.7
- Update log4j 1.x to 2.x
- Error after submitting job to standalone cluster executor
- Add a tuple->vec function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flambo.