Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-45895

Combine multiple like to like all

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.0.0
    • None
    • SQL
    • None

    Description

         spark.sql("create table t(a string, b string, c string) using parquet")
          spark.sql(
            """
              |select * from t where
              |substr(a, 1, 5) like '%a%' and
              |substr(a, 1, 5) like '%b%'
              |""".stripMargin).explain(true)
      

      We can optimize the query to:

          spark.sql(
            """
              |select * from t where
              |substr(a, 1, 5) like all('%a%', '%b%')
              |""".stripMargin).explain(true)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            yumwang Yuming Wang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: