def hive_to_xlab_type()

in src/ab/plugins/db/hive.py [0:0]


    def hive_to_xlab_type(data_type):
        """
        https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types#LanguageManualTypes-decimal
        """
        data_type = str(data_type).lower()
        if data_type in ('tinyint', 'smallint', 'int', 'integer', 'bigint'):
            return 'Long'
        elif data_type in ('float', 'double', 'numeric') or 'decimal' in data_type:
            return 'Double'
        elif data_type in ('string', 'char', 'varchar'):
            return 'String'
        elif data_type == 'boolean':
            return 'Boolean'
        elif data_type in ('date', 'timestamp', 'interval'):
            return 'Date'
        else:
            raise TypeError('不支持的hive数据类型: {data_type}'.format(data_type=data_type))