As I was trying to state in my last answer—which was deleted for some reason—you cannot do any type casting or conversion on data ingested with the scheduler.
To get the correct timestamp you have two options:
- Do the conversion with Kafka Connect using the single message transforms that I linked to in my original answer that was deleted (https://docs.confluent.io/current/connect/transforms/timestampconverter.html), or
- Copy the data from Kafka as is and do the conversion after you have copied the data into a Vertica table or a flex table.
To do the second option, you would take the timestamp-millis epoch from Kafka divide it by 1,000 and then use the TO_TIMESTAMP
function. If the Kafka timestamp-millis epoch was 1556204536000, then you can execute the following SQL to get the actual timestamp:
SELECT TO_TIMESTAMP(1556204536000 / 1000);
Which will return the value:
2019-04-25 15:02:16
However, the second option would require you to do new conversions every time you get new data, so it's really only useful if you are using Kafka for bulk loads.
Your best bet is to use the single message transforms or find some other way of converting the timestamp columns into a string format before you send the data to Kafka. Vertica will accept the string in a TIMESTAMP
column, so you will not need to do any casting on the Vertica side.