Yuming Wang created SPARK-45895:
-----------------------------------

             Summary: Combine multiple like to like all
                 Key: SPARK-45895
                 URL: https://issues.apache.org/jira/browse/SPARK-45895
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 4.0.0
            Reporter: Yuming Wang



{code:scala}
   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)
{code}

We can optimize the query to:
{code:scala}
    spark.sql(
      """
        |select * from t where
        |substr(a, 1, 5) like all('%a%', '%b%')
        |""".stripMargin).explain(true)
{code}





--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to