Map and FlatMap

#sparkday20of30

What is the difference between map and flatmap in Spark?

Visual Example:

Using?map:

Input RDD:?[1, 2, 3]

Transformation:?x => [x, x+1]

Output RDD:?[[1, 2], [2, 3], [3, 4]]

Using?flatMap:

Input RDD:?[1, 2, 3]

Transformation:?x => [x, x+1]

Output RDD:?[1, 2, 2, 3, 3, 4]

要查看或添加评论,请登录

Shruti Dhage的更多文章

  • How to design a Datawarehouse

    How to design a Datawarehouse

    #SQLchallengeDay16of30 #1percentbetter How do you implement data warehousing and business intelligence (BI) solutions…

  • Materialized view and a Non-materialized view

    Materialized view and a Non-materialized view

    #SQLchallengeDay12of30 #1percentbetter Explain the difference between a materialized view and a non-materialized view…

  • RLS in DBMS

    RLS in DBMS

    #SQLchallengeDay11of30 #1percentbetter #hackerRank How do you implement row-level security (RLS) in SQL, and what are…

    1 条评论
  • reducebykey and groupbykey

    reducebykey and groupbykey

    #sparkday21of30 What is the difference between reducebykey and groupbykey? reduceByKey and groupByKey are both…

  • Normalization in DBMS

    Normalization in DBMS

    #SQLchallengeDay8of30 #1percentbetter What are the various forms of Normalization? Normal Forms are used to eliminate…

  • Unity Catalog

    Unity Catalog

    #sparkday18of30 18)what is unity catalog in databricks? Unity Catalog provides centralized access control, auditing…

  • Difference between clustered and non-clustered indexes in RDBMS

    Difference between clustered and non-clustered indexes in RDBMS

    #SQLchallengeDay7of30 #1percentbetter

  • Storage levels in RDD

    Storage levels in RDD

    #sparkday17of30 Storagelevels in RDD: StorageLevel decides how RDD should be stored. In Apache Spark, StorageLevel…

  • Natural Join in SQL

    Natural Join in SQL

    Key Features of Natural Join: Automatic Matching: It automatically matches columns between the two tables based on…

  • what is cross join, how it is different from Full outer join?

    what is cross join, how it is different from Full outer join?

    #SQLchallengeDay5of30 #1percentbetter #hackerRank what is cross join, how it is different from Full outer join? Cross…

社区洞察

其他会员也浏览了