简体   繁体   中英

LOAD error mismatched input '-' expecting RIGHT_PAREN, column with hyphen

My code:

book = LOAD '/user/samanthafox/books.csv' USING PigStorage (',') AS (ISBN:chararray, Book-Title:chararray,Book-Author:chararray,Year-Of-Publication:chararray,Publisher:chararray); dump book ;

Error code:

org.apache.pig.PigServer - exception during parsing: Error during parsing. <file script.pig, line 1, column 89> mismatched input '-' expecting RIGHT_PAREN

You can't have hyphens in column names. For best practice I'd advise only using lower-case letters and underscores - you're unlikely to encounter problems in any kind of data store if you do this.

book = LOAD '/user/samanthafox/books.csv' USING PigStorage (',') AS
(isbn: chararray, book_title: chararray, book_author: chararray, year_of_publication: chararray, publisher: chararray);
dump book;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM