NULL column names in Hive query result

前端 未结 2 840
离开以前
离开以前 2021-01-21 01:34

I have downloaded the weather .txt files from NOAA, which looks like:

WBAN,Date,Time,StationType,SkyCondition,SkyConditionFlag,Visibility,VisibilityFlag,WeatherTy         


        
2条回答
  •  一整个雨季
    2021-01-21 02:31

    To add to Dennis' comment above, you can skip the first line from being inserted into your table if you're using a CSV SerDe like so:

    CREATE EXTERNAL TABLE cases (
      id INT,
      case_number STRING,
      name STRING,
    )
    ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
    STORED AS TEXTFILE
    LOCATION '/hdfs/path'
    tblproperties("skip.header.line.count"="1");
    

    The operative line being:

    tblproperties("skip.header.line.count"="1")
    

提交回复
热议问题