I have been searching on google for the last 20 minutes. I have gone through the Apache Flink documentation too specifically the CSV format but haven't found a way to skip the first header row.
The CSV looks like this:
AccountKey,InstrumentCode,Quantity,BuySell,Price
SB11,MSFT,100,Buy,250.57
SB11,AMZN,125,Sell,309
I really am looking for a property to set which will make the CSV reader skip the header row. The following table definition does not work:
CREATE TABLE trades (
AccountNo varchar(10),
Symbol varchar(10),
Quantity integer,
BuySell varchar(4),
Price decimal
) WITH (
'connector' = 'filesystem',
'path' = '/mnt/d/Work/Github/Flink-Samples/data/trade-data.csv',
'format' = 'csv'
);
The error I see on sql-client.sh is:
[ERROR] Could not execute SQL statement. Reason:
java.lang.NumberFormatException: For input string: "Quantity"
I expect the CSV reader reads the rows when I execute a
select * from trades
So far, the only way I have found is to put a # character to make the header appear as a comment and use the following table definition:
CREATE TABLE trades (
AccountNo varchar(10),
Symbol varchar(10),
Quantity integer,
BuySell varchar(4),
Price decimal
) WITH (
'connector' = 'filesystem',
'path' = '/mnt/d/Work/Github/Flink-Samples/data/trade-data.csv',
'format' = 'csv',
'csv.allow-comments' = 'true'
);