val df_read_old = spark.read.format("csv").option("header", "true").option("delimiter","^").schema(old_schema).load("D:\\TESTSCALA\\"+"${lstfile}") // is not able to read file from variable.
Любой другой способ сделать это, или мне что-то не хватает.
появляется ошибка ниже, пока файл доступен по заданному пути:
Exception in thread "main" org.apache.spark.sql.AnalysisException: Path does not exist: file:/D:/TESTSCALA/${lstfile};
at org.apache.spark.sql.execution.datasources.DataSource$.org$apache$spark$sql$execution$datasources$DataSource$$checkAndGlobPathIfNecessary(DataSource.scala:621)
at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$14.apply(DataSource.scala:350)
at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$14.apply(DataSource.scala:350)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
at scala.collection.immutable.List.flatMap(List.scala:355)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:349)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:178)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:156)
at com.tmobile.dev.compare.serializedmaterial11$.main(test.scala:31)
at com.tmobile.dev.compare.serializedmaterial11.main(test.scala)