<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Using Apache Spark for Ensuring Data Quality in Modern Data Lake Pipeline Architectures</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Martina Šestak</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
          <xref ref-type="aff" rid="aff4">4</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Timi Vovk</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
          <xref ref-type="aff" rid="aff4">4</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>, StructField("year"</institution>
          ,
          <addr-line>StringType(), True), StructField("food_loss", DoubleType(), True)</addr-line>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>, StructField("year"</institution>
          ,
          <addr-line>StringType(), True), StructField("month", StringType(), True), StructField("sumDelivery", DoubleType(), True)</addr-line>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>, StructField("year"</institution>
          ,
          <addr-line>StringType(), True), StructField("month", StringType(), True), StructField("sumHarvest", DoubleType(), True)</addr-line>
        </aff>
        <aff id="aff3">
          <label>3</label>
          <institution>SQAMIA 2023: Workshop on Software Quality Analysis</institution>
          ,
          <addr-line>Monitoring, Improvement, and Applications</addr-line>
        </aff>
        <aff id="aff4">
          <label>4</label>
          <institution>University of Maribor, Faculty of Electrical Engineering and Computer Science</institution>
          ,
          <addr-line>Koroška cesta 46, 2000 Maribor</addr-line>
          ,
          <country country="SI">Slovenia</country>
        </aff>
      </contrib-group>
      <fpage>162</fpage>
      <lpage>173</lpage>
      <abstract>
        <p>The large volumes of data generated in modern IT systems raise the need for data quality control mechanisms to ensure that business decisions are grounded in high-quality and accurate data. Big data systems face additional data quality-related challenges that must be addressed throughout the entire data processing pipeline. In this paper, we focus on ensuring data quality in data lakes, as their flexibility in handling heterogeneous data is often left unaccompanied with suitable data quality mechanisms, leading to data swamps and poor results overall. We explore the Apache Spark framework and its features that can be used to implement data lake pipelines while ensuring data quality. A data lake implementation for an agri-food use case based on Spark confirms the suitability of the framework for implementing ELT (Extract, Load, Transform) and other processing jobs in a data lake, data pipeline orchestration and running tests to maintain data quality in data lakes.</p>
      </abstract>
      <kwd-group>
        <kwd>Big data quality</kwd>
        <kwd>Data lake</kwd>
        <kwd>Apache Spark</kwd>
        <kwd>Unit testing</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Modern big data environments are often designed to handle data obtained from heterogeneous
sources, each with its own degree of data structure. This data serves as a valuable asset
exchanged between various information systems within this environment. However, if left
unsupervised, its quality can quickly deteriorate over time. Consequently, the main challenges
in maintaining big data quality are the large volumes of data generated by modern IT systems,
heterogeneity, the constant changes in data, and data security [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>
        Data quality is commonly defined as "the degree to which data satisfy the requirements
defined by the product-owner organization" [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. In the context of high data volumes, ensuring
data quality becomes increasingly critical to facilitate accurate data-driven decision-making.
When the quality of the data used for decision-making is poor, it often leads to incorrect findings,
erroneous decisions, sub-optimal process executions, revenue losses, and other associated costs
[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>
        Poor data quality can arise from several reasons, such as errors during data entry, using
inappropriate data collection methods, failure to update dynamic data, misapplication of
business rules, presence of duplicate records, and missing or incorrect data values [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. These
mistakes introduce anomalies in data quality, which decreases its suitability for data-driven
decision-making. Low levels of data quality significantly impact the overall efectiveness of
data applications. As data volumes and varieties increase, controlling the quality of each data
entry becomes more challenging. The variety and volume of big data introduce additional
complexities to traditional data quality dimensions, such as accuracy and completeness [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
The real-time nature of data, such as streaming data or IoT (Internet of Things) data, further
complicates data quality assessment [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
      </p>
      <p>
        Recently, data lakes have emerged as a viable solution for establishing a centralized storage
system that can accommodate diverse data types from various IT systems, regardless of their
structured or unstructured nature. In their design, data lakes do not impose any specific data
schemas during the process of data ingestion [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. However, due to the absence of guaranteed
ACID (Atomicity, Consistency, Isolation, Durability) properties, proper monitoring, metadata
management, and comprehensive quality control are crucial to prevent data lakes from
transforming into what is commonly referred to as "data swamps". Modern big data frameworks like
Apache Spark ofer powerful tools for data transformation, validation, and enrichment at scale,
contributing to the overall enhancement of data quality in data lakes.
      </p>
      <sec id="sec-1-1">
        <title>1.1. Objectives and contribution</title>
        <p>The main objective of this paper is to explore strategies for maintaining data quality within data
lake pipelines. Additionally, we aim to assess the feasibility of using contemporary big data
frameworks for this purpose. To accomplish these objectives, our study delves into data quality
within data lakes, investigating the data quality-related challenges practitioners encounter
during diferent stages of data lake pipelines. Subsequently, we examine the capabilities of modern
big data frameworks, specifically Apache Spark, in executing tasks related to data quality within
data lake pipelines. A thorough analysis of Spark’s features is conducted, and a comparative
evaluation against similar frameworks is presented. Our paper not only showcases how Spark
can be eficiently leveraged to ensure data quality within ELT (Extract-Load-Transform) and
data processing tasks, pipeline orchestration, and the execution of data quality tests, but also
emphasizes its practical application in the agri-food domain in achieving these objectives.</p>
        <p>The remainder of the paper is structured as follows: Section 2 presents the contributions of
relevant studies regarding data quality in data lakes. In Section 3 we provide the theoretical
background concerning data lakes, data quality in data lake pipelines and the Apache Spark
framework. Section 4 presents the architecture model for the proposed data lake pipeline design.
The results of the qualitative evaluation of using Apache Spark for maintaining data lake quality
and their interpretation are presented in Section 5. Finally, we summarize our findings with
possible future research directions in Section 6.</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>2. Related work</title>
      <p>
        Data lakes, which serve as central repositories for a wide variety of raw and unstructured data,
are prone to storing data of varying quality levels. Ensuring high data quality within these
lakes is essential to derive accurate analyses, make informed decisions, and drive actionable
insights. Nonetheless, research literature and established practices regarding data quality in
data lake pipelines are somewhat limited. Generally, the challenge of maintaining data quality
in data lakes arises from the diverse range of data sources and formats they accommodate
[
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. These sources can range from structured databases to semi-structured and completely
unstructured data like text, images, and videos. This heterogeneity often leads to issues such as
inconsistencies, incompleteness, duplication, and inaccuracies within the data lake. Hence, a
suitable data preprocessing and integration strategy is vital to ensure data quality and usability
[
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. Furthermore, the implementation of data governance, interoperability, and standardization
mechanisms is also encouraged, particularly in the context of federated data lakes [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
      </p>
      <p>
        Data lake practitioners propose various strategies to uphold data quality in data lakes [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ],
including the versioning of data to ensure data lineage, and testing which encompasses data
validation, metadata testing, and continuous data integration testing. An array of tools for
testing data pipelines has been developed, some of which are based on Apache Spark (e.g.,
Deequ). Ciaccia et al. [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] suggest the formulation and implementation of constraints to
guarantee accurate and dependable data within data lakes. In this context, distinct types of
constraints like schema and semantic constraints can be realized using the SPARQL language
built on an RDF data model, thus preserving data integrity.
      </p>
      <p>
        On a technical level, data lakes are usually implemented using distributed technologies such as
HDFS, MapReduce, Apache Spark, etc., which provide high scalability. Sawadogo and Darmont
[
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] explore the complexities associated with structuring and organizing data within data lakes
and emphasize the pivotal role that metadata plays in addressing these challenges. According to
the authors, building a comprehensive metadata catalog serves to enforce data quality in data
lakes. Mehmod et al. [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] propose a data lake pipeline architecture built on the Hadoop platform,
where Apache Solr and Apache Spark are used for data analysis, and Apache Flume is used for
data ingestion.
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. Preliminaries</title>
      <p>Our proposed solution builds upon several concepts and technologies. This section provides
their definition, description, and their role in the proposed data lake pipeline architecture.</p>
      <sec id="sec-3-1">
        <title>3.1. Data lakes</title>
        <p>
          As a data technology, data lakes appeared with the development of big data technologies from
their early days. The existing data warehouses were quite strict in terms of following pre-defined
data schemas, which required notable amounts of time during the integration of data collected
from diferent data sources before storing it in the centralized data storage. Additionally, once
the data was stored, there was little room to customize dashboards and queries to analyze the
data besides those prepared in advance. The rapid technological development also created
a paradigm shift in the data analysis approach, as business users requested more flexibility
and agility in big data integration and their active inclusion in the data analysis to develop
self-service business intelligence and other services [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ]. As it turns out, this need was fulfilled
with the introduction of data lakes.
        </p>
        <p>
          A data lake can be defined as a "central location where it is possible to store all domain data,
regardless of its source or format" [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ]. Hence, it enables storing structured and unstructured
data, which is an important prerequisite for numerous modern use cases. However, this does
imply that a data lake architecture must be able to store large volumes of data. It also needs to
include eficient data processing tools to handle data stored in its original format appropriately.
A typical data lake architecture generally includes data ingestion from various data sources
into the ELT pipeline, as shown in Fig. 1. As part of the ELT job, data is directly extracted
and loaded in its original form into the data lake. Depending on the data analysis needs (e.g.
machine learning, data analytics, business intelligence), data is then read and processed into
the appropriate data format by following the "schema-on-read" approach. The ELT and
schemaon-read approaches are the most common reasons for building a data lake in domains where
fast data ingestion and eficient and agile processing of (un)structured data are needed.
        </p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Data pipeline testing</title>
        <p>
          The existing body of work on data quality checking in modern data pipelines is quite limited,
even more when it comes to practical examples of implementing data quality tests throughout
the data pipeline. Intuitively, maintaining data quality in data pipelines demands a proper
testing strategy developed upfront. A. Jain [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ] presented a comprehensive list of data quality
tests specifically applicable to modern data pipelines, which includes the following tests ordered
in ascending order based on the required cost and time for their execution:
1. Unit test - used to validate data transformations within individual functions and queries;
2. Component test - used for schema validation of every row and column with regard to
business rules;
3. Contract test - used to validate if the target table contains records present in the source
table (applicable to data warehouses and data marts);
4. Flow test - used to validate the completeness, accuracy and consistency of data migrated
within data flows;
5. Source test - used to ensure that all data extracted from the source systems reach the
target data system without any loss or reduction;
6. Functional test - used to validate if all components within the pipeline properly work
together and, when integrated, produce the expected data results;
7. Data quality matrix - used to validate and measure the accuracy, completeness, timeliness
and consistency of data [
          <xref ref-type="bibr" rid="ref18">18</xref>
          ].
        </p>
      </sec>
      <sec id="sec-3-3">
        <title>3.3. Big data processing frameworks</title>
        <p>Big data processing frameworks are essential tools in modern data analysis and management,
as they enable organizations to handle vast amounts of data eficiently and extract meaningful
insights. These frameworks are designed to address the challenges posed by the ever-increasing
volumes, velocities, and varieties of data generated in the modern digital landscape.</p>
        <p>
          One of the pioneering frameworks in this field is Apache Hadoop. It introduces the concept
of distributed computing, allowing data to be processed across clusters of computers in parallel.
The Hadoop ecosystem comprises the Hadoop Distributed File System (HDFS) for storage and
the MapReduce programming model for processing. Hadoop’s scalability and fault tolerance
make it suitable for handling massive datasets, making it a cornerstone for big data processing.
Nevertheless, its limited support for batch processing only represents a major impediment to
meeting the requirements of modern data platforms. Furthermore, its reliance on disk storage
can lead to slower processing speeds, especially for iterative tasks [
          <xref ref-type="bibr" rid="ref19">19</xref>
          ].
        </p>
        <p>
          Real-time data processing is facilitated by frameworks like Apache Flink and Apache Kafka.
Apache Flink ofers stream processing capabilities with event time processing, enabling
organizations to analyze and act upon data as it is generated. Even though it brings some novel ideas
to data processing, Flink is still considered as a less-matured framework with a more limited set
of supported operations compared to Spark [
          <xref ref-type="bibr" rid="ref19">19</xref>
          ]. Apache Kafka, on the other hand, serves as a
distributed streaming platform for building real-time data pipelines and applications, providing
eficient data ingestion and distribution.
        </p>
        <p>
          Apache Spark, another prominent framework, builds upon the foundations of Hadoop but
ofers enhanced performance and a more versatile processing model leveraging both batch and
stream processing capabilities [
          <xref ref-type="bibr" rid="ref20">20</xref>
          ]. Spark employs in-memory computing, allowing iterative
algorithms and interactive querying to be executed much faster compared to traditional
diskbased systems [
          <xref ref-type="bibr" rid="ref21">21</xref>
          ]. It also supports various programming languages (Python, Java, Scala, and
R [
          <xref ref-type="bibr" rid="ref22">22</xref>
          ]) and provides libraries for machine learning, graph processing, and stream processing,
making it a comprehensive choice for diverse big data tasks. Its concise APIs and high-level
abstractions make it more user-friendly, allowing developers to express complex data processing
tasks in a more intuitive manner. When it comes to performance, Spark has proven to be several
times faster in data access and processing than Hadoop or other disk-based approaches [
          <xref ref-type="bibr" rid="ref23">23</xref>
          ].
These results originate in Spark’s programming model based on Resilient Distributed Datasets
(RDDs), where objects are kept in memory to reduce the reading overhead due to disk operations
between iterative computations [
          <xref ref-type="bibr" rid="ref19">19</xref>
          ]. Furthermore,
        </p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Data lake pipeline architecture design for the agri-food domain</title>
      <p>This paper focuses on evaluating the suitability of Apache Spark for maintaining data quality
within data lakes. To accomplish this objective, we designed a data pipeline architecture for the
agri-food domain. In this context, modern data platforms supporting agri-food value chains are
expected to gather and process data generated throughout various stages of the value chain,
such as food production, processing, packaging, and distribution. The establishment of a data
platform plays a crucial role in creating an ecosystem where data-driven policies and measures
can efectively reduce food loss and waste. The potential input data for such a platform includes
a range of sources, including sensor data from fields, satellite images depicting production
areas, and reports provided by farmers with information about the materials and seeds used and
produced. These data originate from various source systems and exhibit varying data structures,
making a data lake architecture well-suited for this particular business scenario.</p>
      <p>Fig. 2 presents a high-level architecture model for the data lake pipeline in our study. The
data lake implementation is carried out on the Microsoft Azure platform infrastructure, which
enables us to focus on pipeline implementation rather than infrastructure maintenance and
overall security. The design follows a layered approach, dividing the data platform architecture
into distinct layers that correspond to diferent stages of the data pipeline:
• Data ingestion - tools and solutions for continuously collecting raw data from source
systems;
• Data storage - data systems and approaches used to store raw ingested data and/or
aggregated/processed data produced within the later stage of the pipeline;
• Data analysis - tools and frameworks for processing data for analysis purposes;
• Orchestration - tools and frameworks for the automation and monitoring of pipeline
stage execution.</p>
      <p>Considering the specific characteristics of the agri-food domain’s data, we have chosen to
utilize the data lake as the central data repository within the data storage layer. Consequently,
within the data ingestion layer, we adopt an ELT approach. To accomplish this, we developed a
custom source connector designed to extract data from the source systems. Due to the unique
circumstances within the agri-food domain, where data sources mainly consist of farmers and
their manually submitted reports, and the source systems are typically governed by government
agencies with strict access policies, we have chosen to develop a custom connector implemented
as an Azure Function. This custom connector ensures regular data extraction while adhering to
the necessary access policies and security requirements.</p>
      <p>Data collected by the Source connector is stored in the Azure Data Lake Storage Gen2 data
lake solution, where it is divided across diferent zones according to their varying degree of
transformation (from raw to fully processed and aggregated). Additionally, the Ref zone assumes
the role of a data catalog, managing tasks such as assigning internal IDs, mapping these IDs to
input data, and tracking the processing status of each raw data record. It serves as a reference
point for maintaining data lineage and providing essential metadata for the overall data pipeline.</p>
      <p>
        All these complex migrations of data between diferent data lake zones are handled by Apache
Spark. Specifically, each migration (e.g. Landing to Raw migration) is handled by a dedicated
Spark job specified within a Python script. Among the available Spark modules, we are using the
Spark SQL module to clean and aggregate data after it lands in the data lake. The module ofers
several abstractions to work with data: Dataset, DataFrames, SQL Tables and RDD (Resilient
Distributed Dataset). Most of the tasks can be achieved by either of these options, but not all
of the options are available for all programming languages [
        <xref ref-type="bibr" rid="ref24">24</xref>
        ]. When the execution DAG
is created, all named abstractions use the same execution engine, which means they can be
used interchangeably [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ]. The DataFrames abstraction is the easiest to use, as it ofers a lot of
underlining optimizations for running tasks and it is available in various languages (e.g. Python,
R). In essence, a Spark DataFrame is a distributed in-memory table-like structure with named
columns and schema that defines the data type for each column [
        <xref ref-type="bibr" rid="ref24 ref26">26, 24</xref>
        ]. DataFrames can be
created from a large array of sources spanning from structured data files, Hive tables, external
databases or existing RDDs.
      </p>
      <p>Finally, to reduce the system administration eforts for the Spark cluster running these
jobs, we chose to deploy Apache Spark on the Azure Databricks platform, which ofers a fully
managed cloud service for data processing and analytics. The execution of the scripts (Spark
jobs) is monitored and scheduled by the Databricks Workflows orchestration service available
in the Databricks Platform.</p>
    </sec>
    <sec id="sec-5">
      <title>5. Results and discussion</title>
      <p>In this section, we present the results of using Apache Spark in various stages of the data
lake pipeline presented in Section 4. We discuss our empirical findings and remarks about the
suitability of using Spark for maintaining data quality throughout the data processing via ELT
and pipeline orchestration and testing stages.</p>
      <sec id="sec-5-1">
        <title>5.1. Data processing with Spark</title>
        <p>For clarity purposes, we will present the results of using Spark for data processing purposes
only on selected segments within the ELT job pipeline.</p>
        <p>For instance, the data processing for calculating the farmers’ food loss includes processing
their harvest and delivery reports to calculate the diference between the total quantity of a
specific crop harvested and delivered to customers. Here, one Spark job responsible for moving
data from the Raw to the Enriched zone must first process all harvest and delivery reports for
each farmer stored in the Raw zone and group them based on the farmer’s ID, crop, month and
year. This result is used by another Spark notebook (job) run responsible for calculating the
yearly food loss for each farmer in the Curated zone (Fig. 3).</p>
      </sec>
      <sec id="sec-5-2">
        <title>5.2. Data lake pipeline orchestration with Spark</title>
        <p>
          To schedule and execute data processing pipelines at specific times, we used Databricks
Worklfows. This service provides orchestration capabilities for data processing, machine learning,
and analytics pipelines [
          <xref ref-type="bibr" rid="ref27">27</xref>
          ]. By using Workflows, we can create cron jobs that automate the
execution of pipelines according to predefined schedules. Fig. 4 illustrates the ability to specify
dependencies between notebooks responsible for specific pipeline tasks through DAGs, where
multiple tasks (notebooks) can be run in parallel. For instance, in the example showcased, there
is a pipeline for calculating food loss. This pipeline consists of five notebooks that handle three
distinct phases of data transfer and transformation within the data lake zones: landing-raw,
raw-enriched, and enriched-curated. These phases are represented horizontally in the graph,
while the individual tasks are depicted vertically.
        </p>
      </sec>
      <sec id="sec-5-3">
        <title>5.3. Data lake pipeline testing with Spark</title>
        <p>
          Spark provides multiple solutions for testing purposes. When it comes to unit tests, there are
several options for their implementation in Databricks. Unit tests can be implemented within
the Spark notebook itself, in a separate notebook, or outside of the notebook as long as they are
located within the same repository. For Python and R, the recommended approach is to store
functions and their respective unit tests outside of the notebooks [
          <xref ref-type="bibr" rid="ref28">28</xref>
          ]. By doing so, tests can
be executed directly from the notebook, ofering the advantage of running tests easily during
the development process. Alternatively, Databricks also supports running tests through the
Databricks web terminal, providing an additional option for executing tests.
        </p>
        <p>The example code snippet below demonstrates a unit test created for the food loss pipeline,
using the Python testing library called unittest. Since the function being tested involves a
PySpark transformation, there are various aspects that can be tested. This includes checking the
correctness of the schema, data, number of rows in the DataFrame, expected values, nullability of
columns, exceptions, etc. through various assertions. The provided code illustrates an example
of a unit test for the same function described in Section 5.1.
class food_loss_test_case(unittest.TestCase):
def test_schema(self):
delivery_schema = StructType(
[
StructField("_id", StringType(), True),
StructField(
"crop",
StructType(</p>
        <p>[
]
)
harvest_schema = StructType(
[</p>
        <p>StructField("_id", StringType(), True),
StructField(</p>
        <p>]
),</p>
        <p>True,</p>
        <p>StructField("_id", StringType(), True),
StructField("unit", StringType(), True),
StructField("name", StringType(), True),</p>
        <p>StructField("CPA", StringType(), True),
"crop",
StructType(
[
"626436bd93d6ad0321c9f7ff",
("00000", "KOS", "EKO ČAJ DROBNOCVETNI VRBOVEC 20G", "01.22.22"),
"2022",
"07",
1492.0,
)
df_harvest = spark.createDataFrame(harvest_data, harvest_schema)
df_deliveries = spark.createDataFrame(deliveries_data, delivery_schema)
expected_schema = StructType(
[
)
df_food_loss = self.calculate_food_loss(df_deliveries, df_harvest)
self.assertEqual(df_food_loss.schema, expected_schema)</p>
        <p>StructField("_id", StringType(), True),
StructField("unit", StringType(), True),
StructField("name", StringType(), True),</p>
        <p>StructField("CPA", StringType(), True),</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>6. Conclusion</title>
      <p>To summarize, the exponential growth of data in modern IT systems requires the implementation
of robust data quality control mechanisms to ensure the reliability and accuracy of business
decisions. This becomes even more crucial in big data systems, where unique data quality
challenges arise across the entire data processing pipeline. The focus of this paper was to
address the importance of data quality in data lakes, which often lack adequate mechanisms,
resulting in data swamps and inaccurate outcomes. We studied the capabilities of the Apache
Spark framework and, particularly, its features that can be used to implement data lake pipelines
while simultaneously ensuring data quality. The paper showcased a specific agri-food use
case where Spark was successfully employed in various stages of the data pipeline to maintain
the quality of data throughout the pipeline. Specifically, we empirically evaluated Spark’s
suitability for data processing and pipeline orchestration and testing purposes. Overall, our
ifndings confirm the suitability of Apache Spark for addressing data quality concerns in data lake
architectures. As part of our future work, we plan to run a performance analysis of our proposed
data lake pipeline architecture and develop a comprehensive data lake quality framework, which
will include suitable mechanisms to measure relevant data quality dimensions.</p>
    </sec>
    <sec id="sec-7">
      <title>Acknowledgments</title>
      <p>This work was supported by the Slovenian Research Agency (Research Core Funding) under
Grant P2-0057, and also in part by the European Union’s Horizon 2020 Research and Innovation
Programme (Grant Agreements No. 1001036388 and 101059473).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>M.</given-names>
            <surname>Talha</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Abou El Kalam</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Elmarzouqi</surname>
          </string-name>
          ,
          <article-title>Big data: Trade-of between data quality and data security</article-title>
          ,
          <source>Procedia Computer Science</source>
          <volume>151</volume>
          (
          <year>2019</year>
          )
          <fpage>916</fpage>
          -
          <lpage>922</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <source>[2] ISO</source>
          <volume>25012</volume>
          :
          <year>2008</year>
          (E),
          <source>Software Engineering - Software Product Quality Requirements</source>
          And
          <string-name>
            <surname>Evaluation (SQuaRE) - Data Quality</surname>
            <given-names>Model</given-names>
          </string-name>
          , Standard, International Organization for Standardization, Geneva,
          <string-name>
            <surname>CH</surname>
          </string-name>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>P.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Xiong</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Gao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <article-title>Data quality in big data processing: Issues, solutions and open problems</article-title>
          , in: 2017 IEEE SmartWorld,
          <source>Ubiquitous Intelligence &amp; Computing</source>
          ,
          <string-name>
            <given-names>Advanced &amp; Trusted</given-names>
            <surname>Computed</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Scalable</given-names>
            <surname>Computing</surname>
          </string-name>
          &amp;
          <article-title>Communications, Cloud &amp; Big Data Computing, Internet of People and Smart City Innovation (SmartWorld/SCALCOM</article-title>
          /UIC/ATC/CBDCom/IOP/SCI), IEEE,
          <year>2017</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>7</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>A.</given-names>
            <surname>Ramasamy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Chowdhury</surname>
          </string-name>
          ,
          <article-title>Big data quality dimensions: a systematic literature review</article-title>
          ,
          <source>JISTEM-Journal of Information Systems and Technology Management</source>
          <volume>17</volume>
          (
          <year>2020</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>M.</given-names>
            <surname>Abdallah</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Muhairat</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Althunibat</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Abdalla</surname>
          </string-name>
          ,
          <article-title>Big data quality factors, frameworks and challenges</article-title>
          ,
          <source>Compusoft</source>
          <volume>9</volume>
          (
          <year>2020</year>
          )
          <fpage>3785</fpage>
          -
          <lpage>3790</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>L.</given-names>
            <surname>Cai</surname>
          </string-name>
          ,
          <string-name>
            <surname>Y. Zhu,</surname>
          </string-name>
          <article-title>The challenges of data quality and data quality assessment in the big data era</article-title>
          ,
          <source>Data science journal 14</source>
          (
          <year>2015</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>C.</given-names>
            <surname>Mathis</surname>
          </string-name>
          , Data lakes,
          <source>Datenbank-Spektrum</source>
          <volume>17</volume>
          (
          <year>2017</year>
          )
          <fpage>289</fpage>
          -
          <lpage>293</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>C.</given-names>
            <surname>Giebler</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Gröger</surname>
          </string-name>
          , E. Hoos,
          <string-name>
            <given-names>H.</given-names>
            <surname>Schwarz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Mitschang</surname>
          </string-name>
          ,
          <article-title>Leveraging the data lake: Current state and challenges, in: Big Data Analytics and Knowledge Discovery: 21st International Conference</article-title>
          , DaWaK
          <year>2019</year>
          , Linz, Austria,
          <source>August 26-29</source>
          ,
          <year>2019</year>
          , Proceedings 21, Springer,
          <year>2019</year>
          , pp.
          <fpage>179</fpage>
          -
          <lpage>188</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>H.</given-names>
            <surname>Mehmood</surname>
          </string-name>
          , E. Gilman,
          <string-name>
            <given-names>M.</given-names>
            <surname>Cortes</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Kostakos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Byrne</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Valta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Tekes</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Riekki</surname>
          </string-name>
          ,
          <article-title>Implementing big data lake for heterogeneous data sources, in: 2019 ieee 35th international conference on data engineering workshops (icdew)</article-title>
          , IEEE,
          <year>2019</year>
          , pp.
          <fpage>37</fpage>
          -
          <lpage>44</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>J.</given-names>
            <surname>Eder</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V. A.</given-names>
            <surname>Shekhovtsov</surname>
          </string-name>
          ,
          <article-title>Data quality for federated medical data lakes</article-title>
          ,
          <source>International Journal of Web Information Systems</source>
          <volume>17</volume>
          (
          <year>2021</year>
          )
          <fpage>407</fpage>
          -
          <lpage>426</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11] T. lakeFS team,
          <source>How To Maintain Data Quality In Your Data Lake</source>
          ,
          <year>2023</year>
          . URL: https: //lakefs.io/blog/how-to
          <article-title>-maintain-data-quality-in-your-data-lake/.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>P.</given-names>
            <surname>Ciaccia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Martinenghi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Torlone</surname>
          </string-name>
          , et al.,
          <article-title>Conceptual constraints for data quality in data lakes</article-title>
          ,
          <source>in: CEUR WORKSHOP PROCEEDINGS</source>
          , volume
          <volume>3340</volume>
          ,
          <string-name>
            <surname>CEUR-WS</surname>
          </string-name>
          ,
          <year>2022</year>
          , pp.
          <fpage>111</fpage>
          -
          <lpage>122</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>P.</given-names>
            <surname>Sawadogo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Darmont</surname>
          </string-name>
          ,
          <article-title>On data lake architectures and metadata management</article-title>
          ,
          <source>Journal of Intelligent Information Systems</source>
          <volume>56</volume>
          (
          <year>2021</year>
          )
          <fpage>97</fpage>
          -
          <lpage>120</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>A.</given-names>
            <surname>Gorelik</surname>
          </string-name>
          ,
          <article-title>The enterprise big data lake: Delivering the promise of big data and data science,</article-title>
          <string-name>
            <surname>O'Reilly Media</surname>
          </string-name>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <surname>A. LaPlante</surname>
          </string-name>
          ,
          <article-title>Architecting data lakes,</article-title>
          <string-name>
            <surname>O'Reilly Media</surname>
          </string-name>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>M.</given-names>
            <surname>Šestak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Turkanović</surname>
          </string-name>
          ,
          <article-title>Pregled in analiza tehnoloških skladov za implementacijo sodobnih it arhitektur velepodatkov</article-title>
          ,
          <source>Uporabna informatika 31</source>
          (
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>A.</given-names>
            <surname>Jain</surname>
          </string-name>
          ,
          <article-title>Everything you need to know about testing data pipelines</article-title>
          ,
          <year>2023</year>
          . URL: https: //www.thoughtworks.com/insights/blog/testing/testing
          <article-title>-data-pipelines.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>V.</given-names>
            <surname>Duraisamy</surname>
          </string-name>
          ,
          <article-title>ETL testing - How to test your data pipelines the right way</article-title>
          ,
          <year>2023</year>
          . URL: https: //towardsdatascience.com
          <article-title>/forget-about-the-new-data-trends-in-2023-d2756add3317.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>J.</given-names>
            <surname>Veiga</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. R.</given-names>
            <surname>Expósito</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X. C.</given-names>
            <surname>Pardo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. L.</given-names>
            <surname>Taboada</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Tourifio</surname>
          </string-name>
          ,
          <article-title>Performance evaluation of big data frameworks for large-scale data analytics</article-title>
          ,
          <source>in: 2016 IEEE International Conference on Big Data (Big Data)</source>
          , IEEE,
          <year>2016</year>
          , pp.
          <fpage>424</fpage>
          -
          <lpage>431</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>E.</given-names>
            <surname>Shaikh</surname>
          </string-name>
          , I. Mohiuddin,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Alufaisan</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Nahvi</surname>
          </string-name>
          ,
          <article-title>Apache spark: A big data processing engine</article-title>
          ,
          <source>in: 2019 2nd IEEE Middle East and North Africa COMMunications Conference (MENACOMM)</source>
          , IEEE,
          <year>2019</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>6</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>D.</given-names>
            <surname>García-Gil</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Ramírez-Gallego</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>García</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Herrera</surname>
          </string-name>
          ,
          <article-title>A comparison on scalability for batch big data processing on apache spark and apache flink</article-title>
          ,
          <source>Big Data Analytics</source>
          <volume>2</volume>
          (
          <year>2017</year>
          )
          <fpage>1</fpage>
          -
          <lpage>11</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [22]
          <string-name>
            <given-names>H.</given-names>
            <surname>Karau</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Konwinski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Wendell</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Zaharia</surname>
          </string-name>
          ,
          <article-title>Learning spark: lightning-fast big data analysis, "</article-title>
          <string-name>
            <surname>O'Reilly Media</surname>
          </string-name>
          ,
          <source>Inc."</source>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [23]
          <string-name>
            <given-names>V. S.</given-names>
            <surname>Jonnalagadda</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Srikanth</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Thumati</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. H.</given-names>
            <surname>Nallamala</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Dist</surname>
          </string-name>
          ,
          <article-title>A review study of apache spark in big data processing</article-title>
          ,
          <source>International Journal of Computer Science Trends and Technology (IJCST) 4</source>
          (
          <year>2016</year>
          )
          <fpage>93</fpage>
          -
          <lpage>98</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          [24]
          <string-name>
            <given-names>B.</given-names>
            <surname>Chambers</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Zaharia</surname>
          </string-name>
          ,
          <article-title>Spark - the definitive guide,</article-title>
          <string-name>
            <surname>O'Reilly Media</surname>
          </string-name>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          [25]
          <string-name>
            <surname>Spark</surname>
            <given-names>SQL</given-names>
          </string-name>
          ,
          <article-title>DataFrames and datasets guide</article-title>
          , n.d. URL: https://spark.apache.org/docs/latest/ sql
          <article-title>-programming-guide</article-title>
          .html.
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          [26]
          <string-name>
            <given-names>J.</given-names>
            <surname>Damji</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Wenig</surname>
          </string-name>
          ,
          <string-name>
            <surname>T. Das</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Lee</surname>
          </string-name>
          , Learning Spark,
          <volume>2</volume>
          <fpage>ed</fpage>
          .,
          <string-name>
            <surname>O'Reilly Media</surname>
          </string-name>
          , Sebastopol, CA,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref27">
        <mixed-citation>
          [27]
          <article-title>What is Databricks Workflows?</article-title>
          , n.d. URL: https://docs.databricks.com/workflows/index. html.
        </mixed-citation>
      </ref>
      <ref id="ref28">
        <mixed-citation>
          [28]
          <article-title>Unit testing for Notebooks, n</article-title>
          .d. URL: https://docs.databricks.com/notebooks/testing.html.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>