Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package feast.ingestion.sources.file

import java.sql.Timestamp
import java.sql.{Timestamp, Date}

import feast.ingestion.FileSource
import org.apache.spark.sql.functions.col
Expand All @@ -30,9 +30,17 @@ object FileReader {
start: DateTime,
end: DateTime
): DataFrame = {
sqlContext.read
val reader = sqlContext.read
.parquet(source.path)
.filter(col(source.eventTimestampColumn) >= new Timestamp(start.getMillis))
.filter(col(source.eventTimestampColumn) < new Timestamp(end.getMillis))

source.datePartitionColumn match {
case Some(partitionColumn) if partitionColumn.nonEmpty =>
reader
.filter(col(partitionColumn) >= new Date(start.getMillis))
.filter(col(partitionColumn) <= new Date(end.getMillis))
case _ => reader
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class BatchPipelineIT extends SparkSpec with ForAllTestContainer {
val rows = generateDistinctRows(gen, 10000, groupByEntity)
val tempPath = storeAsParquet(sparkSession, rows)
val configWithOfflineSource = config.copy(
source = FileSource(tempPath, Map.empty, "eventTimestamp")
source = FileSource(tempPath, Map.empty, "eventTimestamp", datePartitionColumn = Some("date"))
)

BatchPipeline.createPipeline(sparkSession, configWithOfflineSource)
Expand Down