datadudes / json2hive

Generate Hive CREATE TABLE statements from json data
10 stars 5 forks source link

nexted issued #1

Open washcycle opened 6 years ago

washcycle commented 6 years ago
Error: Error while compiling statement: FAILED: ParseException line 9:7 cannot recognize input near 'NUMBER' '>' ',' in column type (state=42000,code=40000)

from

CREATE EXTERNAL TABLE table_name (
  supplier_news ARRAY<STRUCT<
      my_code: STRING,
      my_name: STRING,
      matching_results: INTEGER,
      results: ARRAY<STRUCT<
          id: STRING,
          result_metadata: STRUCT<
            score: NUMBER
          >,
          author: STRING,
          enriched_title: STRUCT<
            entities: ARRAY<STRUCT<
                count: INTEGER,
                sentiment: STRUCT<
                  score: NUMBER,
                  label: STRING
                >,
                text: STRING,
                relevance: NUMBER,
                type: STRING,
                disambiguation: STRUCT<
                  subtype: ARRAY<STRING>,
                  name: STRING,
                  dbpedia_resource: STRING
                >
              >
            >,
            sentiment: STRUCT<
              document: STRUCT<
                score: NUMBER,
                label: STRING
              >
            >,
            semantic_roles: ARRAY<STRUCT<
                subject: STRUCT<
                  text: STRING,
                  keywords: ARRAY<STRUCT<
                      text: STRING
                    >
                  >,
                  entities: ARRAY<STRUCT<
                      type: STRING,
                      text: STRING,
                      disambiguation: STRUCT<
                        subtype: ARRAY<STRING>,
                        name: STRING,
                        dbpedia_resource: STRING
                      >
                    >
                  >
                >,
                sentence: STRING,
                object: STRUCT<
                  text: STRING,
                  keywords: ARRAY<STRUCT<
                      text: STRING
                    >
                  >,
                  entities: ARRAY<STRUCT<
                      type: STRING,
                      text: STRING,
                      disambiguation: STRUCT<
                        subtype: ARRAY<STRING>,
                        name: STRING,
                        dbpedia_resource: STRING
                      >
                    >
                  >
                >,
                action: STRUCT<
                  verb: STRUCT<
                    text: STRING,
                    tense: STRING,
                    negated: BOOLEAN
                  >,
                  text: STRING,
                  normalized: STRING
                >
              >
            >,
            concepts: ARRAY<STRUCT<
                text: STRING,
                relevance: NUMBER,
                dbpedia_resource: STRING
              >
            >,
            categories: ARRAY<STRUCT<
                score: NUMBER,
                label: STRING
              >
            >,
            relations: ARRAY<STRUCT<
                type: STRING,
                sentence: STRING,
                score: NUMBER,
                arguments: ARRAY<STRUCT<
                    text: STRING,
                    entities: ARRAY<STRUCT<
                        type: STRING,
                        text: STRING,
                        disambiguation: STRUCT<
                          subtype: ARRAY<STRING>
                        >
                      >
                    >,
                    location: ARRAY<INTEGER>
                  >
                >
              >
            >,
            keywords: ARRAY<STRUCT<
                text: STRING,
                sentiment: STRUCT<
                  score: NUMBER,
                  label: STRING
                >,
                relevance: NUMBER
              >
            >
          >,
          crawl_date: STRING,
          url: STRING,
          host: STRING,
          text: STRING,
          country: STRING,
          source_type: STRING,
          language: STRING,
          publication_date: STRING,
          enriched_text: STRUCT<
            entities: ARRAY<STRUCT<
                count: INTEGER,
                sentiment: STRUCT<
                  score: NUMBER,
                  label: STRING
                >,
                text: STRING,
                relevance: NUMBER,
                type: STRING,
                disambiguation: STRUCT<
                  subtype: ARRAY<STRING>,
                  name: STRING,
                  dbpedia_resource: STRING
                >
              >
            >,
            sentiment: STRUCT<
              document: STRUCT<
                score: NUMBER,
                label: STRING
              >
            >,
            semantic_roles: ARRAY<STRUCT<
                subject: STRUCT<
                  text: STRING,
                  keywords: ARRAY<STRUCT<
                      text: STRING
                    >
                  >,
                  entities: ARRAY<STRUCT<
                      type: STRING,
                      text: STRING,
                      disambiguation: STRUCT<
                        subtype: ARRAY<STRING>,
                        name: STRING,
                        dbpedia_resource: STRING
                      >
                    >
                  >
                >,
                sentence: STRING,
                object: STRUCT<
                  text: STRING,
                  keywords: ARRAY<STRUCT<
                      text: STRING
                    >
                  >,
                  entities: ARRAY<STRUCT<
                      type: STRING,
                      text: STRING,
                      disambiguation: STRUCT<
                        subtype: ARRAY<STRING>,
                        name: STRING,
                        dbpedia_resource: STRING
                      >
                    >
                  >
                >,
                action: STRUCT<
                  verb: STRUCT<
                    text: STRING,
                    tense: STRING,
                    negated: BOOLEAN
                  >,
                  text: STRING,
                  normalized: STRING
                >
              >
            >,
            concepts: ARRAY<STRUCT<
                text: STRING,
                relevance: NUMBER,
                dbpedia_resource: STRING
              >
            >,
            categories: ARRAY<STRUCT<
                score: NUMBER,
                label: STRING
              >
            >,
            relations: ARRAY<STRUCT<
                type: STRING,
                sentence: STRING,
                score: NUMBER,
                arguments: ARRAY<STRUCT<
                    text: STRING,
                    entities: ARRAY<STRUCT<
                        type: STRING,
                        text: STRING,
                        disambiguation: STRUCT<
                          subtype: ARRAY<STRING>
                        >
                      >
                    >,
                    location: ARRAY<INTEGER>
                  >
                >
              >
            >,
            keywords: ARRAY<STRUCT<
                text: STRING,
                sentiment: STRUCT<
                  score: NUMBER,
                  label: STRING
                >,
                relevance: NUMBER
              >
            >
          >,
          extracted_metadata: STRUCT<
            sha1: STRING,
            filename: STRING,
            file_type: STRING
          >,
          title: STRING,
          forum_title: STRING,
          external_links: ARRAY<STRING>,
          main_image_url: STRING
        >
      >
    >
  >
)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION '';
washcycle commented 6 years ago

Might have fixed it by replacing NUMBER with DOUBLE

DonDebonair commented 6 years ago

Let me know if it persists, and I will look at it :)