Hive UDF to DB UDF conversion and partition rewrite

We need to take care cases like there is only one partition. Or the order of user filter is before timerange or after timerange.