zoukankan      html  css  js  c++  java
  • 基于hdfs文件创建hive表

    create table customer
    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'
    location '/datalake/raw/customer'
    tblproperties (
        'avro.schema.literal'='{
        "namespace": "example.avro",
        "type": "record",
        "name": "Customer",
        "fields": [
            {"name":"id", "type":"int"},
            {"name":"first_name", "type":"string"},
            {"name":"last_name", "type":"string"},
            {"name":"dob", "type":"long"}
         ]
    }');

    create table address
    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'
    location '/datalake/raw/address'
    tblproperties (
        'avro.schema.literal'='{
        "namespace": "example.avro",
        "type": "record",
        "name": "Address",
        "fields": [
            {"name":"id", "type":"int"},
            {"name":"street1", "type":"string"},
            {"name":"street2", "type":"string"},
            {"name":"city", "type":"string"},
            {"name":"state", "type":"string"},
            {"name":"country", "type":"string"},
            {"name":"zip_code", "type":"string"}
         ]
    }');


    create table contact
    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'
    location '/datalake/raw/contacts/load1'
    tblproperties (
        'avro.schema.literal'='{
        "namespace": "example.avro",
        "type": "record",
        "name": "Contact",
        "fields": [
            {"name":"id", "type":"string"},
            {"name":"cell", "type":"string"},
            {"name":"phone", "type":"string"},
            {"name":"email", "type":"string"}
         ]
    }');

    热爱孤独生活
  • 相关阅读:
    python 的class和def 定义执行语句相关
    python _和__ 下划线命名规则
    python2和python3编码问题【encode和decode】
    cpython源码阅读
    eCPRI
    python内存管理/垃圾回收
    Class() vs self.__class__()
    JAVA学习日报 11/24
    JAVA学习日报 11/23
    JAVA学习日报 11/22
  • 原文地址:https://www.cnblogs.com/rigid/p/14472230.html
Copyright © 2011-2022 走看看