I thought about it more and actually don't think spark.sessionState.functionRegistry.registerFunction is so bad. spark.registerFunction[Age]("age") would be a bit cleaner, but it's not like end users will have to invoke this code anyways.
Users can create a cluster, run yaooqinn.itachi.registerPostgresFunctions and then have access to all the Postgres functions. They don't need to worry about setting any configuration options (or init scripts if they're in Databricks).
This is a small change, but hugely important for end users. The existing setup will scare some less technical users away. This interface will encourage the users to start using this lib ;)
Let me know if this syntax looks ok to you. If it looks good, we can add a function that registers the Teradata functions in a similar manner.
I thought about it more and actually don't think
spark.sessionState.functionRegistry.registerFunction
is so bad.spark.registerFunction[Age]("age")
would be a bit cleaner, but it's not like end users will have to invoke this code anyways.Users can create a cluster, run
yaooqinn.itachi.registerPostgresFunctions
and then have access to all the Postgres functions. They don't need to worry about setting any configuration options (or init scripts if they're in Databricks).This is a small change, but hugely important for end users. The existing setup will scare some less technical users away. This interface will encourage the users to start using this lib ;)
Let me know if this syntax looks ok to you. If it looks good, we can add a function that registers the Teradata functions in a similar manner.