#!/bin/bash
set -eux
PATH=~/pkg/orc-1.6.2/build/tools/src/:$PATH
INFILE=./NationalFile_20190901.txt
OUTFILE=./NationalFile_20190901.orc
cat $INFILE | tail -n +2 | xsv input '-d|' -o tmp.csv
csv-import 'struct<FEATURE_ID:int,FEATURE_NAME:string,FEATURE_CLASS:string,STATE_ALPHA:string,STATE_NUMERIC:tinyint,COUNTY_NAME:string,COUNTY_NUMERIC:smallint,PRIMARY_LAT_DMS:string,PRIM_LONG_DMS:string,PRIM_LAT_DEC:double,PRIM_LONG_DEC:double,SOURCE_LAT_DMS:string,SOURCE_LONG_DMS:string,SOURCE_LAT_DEC:double,SOURCE_LONG_DEC:double,ELEV_IN_M:int,ELEV_IN_FT:int,MAP_NAME:string,DATE_CREATED:string,DATE_EDITED:string>' tmp.csv $OUTFILE
rm tmp.csv
