yaooqinn / itachi

A library that brings useful functions from various modern database management systems to Apache Spark
https://itachi.readthedocs.io/
Apache License 2.0
53 stars 4 forks source link

Register functions to an existing SparkSession #10

Closed MrPowers closed 3 years ago

MrPowers commented 3 years ago

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.