복붙노트

[HADOOP] 문제 하이브 AvroSerDe tblProperties 최대 길이

HADOOP

문제 하이브 AvroSerDe tblProperties 최대 길이

나는 AvroSerDe있는 테이블을 만들어보십시오. 난 이미 테이블을 생성하는 명령을 다음 시도했다 :

CREATE EXTERNAL TABLE gaSession
 ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
 STORED AS
 INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
 OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
 TBLPROPERTIES ('avro.schema.url'='hdfs://<<url>>:<<port>>/<<path>>/<<file>>.avsc');

창조는 작동하는 것 같다,하지만 다음 표가 생성됩니다

hive> show create table gaSession;
OK
CREATE EXTERNAL TABLE `gaSession`(
  `error_error_error_error_error_error_error` string COMMENT 'from deserializer',
  `cannot_determine_schema` string COMMENT 'from deserializer',
  `check` string COMMENT 'from deserializer',
  `schema` string COMMENT 'from deserializer',
  `url` string COMMENT 'from deserializer',
  `and` string COMMENT 'from deserializer',
  `literal` string COMMENT 'from deserializer')
ROW FORMAT SERDE
  'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
...

그 후, 나는 정의를 복사 'avro.schema.literal'와 'avro.schema.url'를 대체하지만 테이블이 여전히 작동하지 않습니다.

나는 약간 (임의) 필드를 삭제할 때, 그것은 (예를 들어, 다음과 같은 정의를) 사용할 수 있습니다.

CREATE TABLE gaSession
     ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
     STORED AS
     INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
     OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
     TBLPROPERTIES ('avro.schema.literal'='{"type": "record",
"name": "root",
"fields": [
    {
        "name": "visitorId",
        "type": [
            "long",
            "null"
        ]
    },
    {
        "name": "visitNumber",
        "type": [
            "long",
            "null"
        ]
    },
    {
        "name": "visitId",
        "type": [
            "long",
            "null"
        ]
    },
    {
        "name": "visitStartTime",
        "type": [
            "long",
            "null"
        ]
    },
    {
        "name": "date",
        "type": [
            "string",
            "null"
        ]
    },
    {
        "name": "totals",
        "type": [
            {
                "type": "record",
                "name": "totals",
                "fields": [
                    {
                        "name": "visits",
                        "type": [
                            "long",
                            "null"
                        ]
                    },
                    {
                        "name": "hits",
                        "type": [
                            "long",
                            "null"
                        ]
                    },
                    {
                        "name": "pageviews",
                        "type": [
                            "long",
                            "null"
                        ]
                    },
                    {
                        "name": "timeOnSite",
                        "type": [
                            "long",
                            "null"
                        ]
                    },
                    {
                        "name": "bounces",
                        "type": [
                            "long",
                            "null"
                        ]
                    },
                    {
                        "name": "transactions",
                        "type": [
                            "long",
                            "null"
                        ]
                    },
                    {
                        "name": "transactionRevenue",
                        "type": [
                            "long",
                            "null"
                        ]
                    },
                    {
                        "name": "newVisits",
                        "type": [
                            "long",
                            "null"
                        ]
                    },
                    {
                        "name": "screenviews",
                        "type": [
                            "long",
                            "null"
                        ]
                    },
                    {
                        "name": "uniqueScreenviews",
                        "type": [
                            "long",
                            "null"
                        ]
                    },
                    {
                        "name": "timeOnScreen",
                        "type": [
                            "long",
                            "null"
                        ]
                    },
                    {
                        "name": "totalTransactionRevenue",
                        "type": [
                            "long",
                            "null"
                        ]
                    }
                ]
            },
            "null"
        ]
    }
]
 }');

TBLPROPERTIES / avro.schema.literal는 최대 길이 또는 다른 제한이있다?

하이브-버전 : 0.14.0

해결법

  1. ==============================

    1.호튼 웍스의 지원 팀은 tblproperties 4000 자 제한이 있다는 것을, 확인했다. 그래서 공백을 제거하여 더 큰 테이블을 정의 할 수있게되었습니다. 그렇지 않으면, 당신은 'avro.schema.url'작업을해야합니다.

    호튼 웍스의 지원 팀은 tblproperties 4000 자 제한이 있다는 것을, 확인했다. 그래서 공백을 제거하여 더 큰 테이블을 정의 할 수있게되었습니다. 그렇지 않으면, 당신은 'avro.schema.url'작업을해야합니다.

  2. from https://stackoverflow.com/questions/33098596/issue-hive-avroserde-tblproperties-max-length by cc-by-sa and MIT license