Hive function quarter() returns 'invalid function'

时间:2015-07-28 22:57:12

标签: hadoop hive hdinsight

This says the function quarter() was introduced in Hive 1.3

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-DateFunctions

I am using the default version of HDInsight (3.1) to run Hadoop:

https://azure.microsoft.com/en-us/documentation/articles/hdinsight-component-versioning/

When I try to use the quarter function I get:

Logging initialized using configuration in file:/C:/apps/dist/hive-0.13.0.2.1.15.1-0001/conf/hive-log4j.properties SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/apps/dist/hadoop-2.4.0.2.1.15.1-0001/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/C:/apps/dist/hbase-0.98.0.2.1.15.1-0001-hadoop2/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] FAILED: SemanticException [Error 10011]: Line 10:1 Invalid function 'quarter'

What am I missing?

3 个答案:

答案 0 :(得分:2)

如果您使用的是不支持quarter()的旧版hive,请尝试以下操作:

ceil(month(date) / 3.0)

答案 1 :(得分:0)

Unfortunately HDInsight 3.1 is only running Hive 0.13.1 and the quarter function isn't available until version 1.3. You can see all of the hive release here

答案 2 :(得分:0)

下面给出了各种版本的HDInsight中的Hive版本。因此,您的配置单元版本为0.13.1,而配置单元版本1.3支持该季度。

HDINSIGHT VERSION 3.2- Hive-0.14.0

HDINSIGHT VERSION 3.1- Hive-0.13.1

HDINSIGHT VERSION 3.0- Hive-0.12.0

HDINSIGHT VERSION 2.1- Hive-0.11.0