In Spark we can use infer schema to dynamically read schema from file e.g.:
df = sqlContext.read.format('com.databricks.spark.csv').options(delimiter='|',header='true', inferschema='true').load('cars.csv')
Is there a way to do same in Flink?
Flink has no built-in support for automatic schema inference from CSV files.
You could implement such functionality on top by analyzing the first rows of a CSV file and generating a corresponding CsvTableSource.