Skip to content

bug: LIKE with custom escape char produces incorrect results #462

@andygrove

Description

@andygrove

Describe the bug

Repro test case for CometExpressionSuite:

  test("like with custom escape") {
    val names = Seq("", "a_b", "d_e_f")
    withTempDir { dir =>
      val filename = "/tmp/percent.parquet"
      names.toDF("a").write.mode(SaveMode.Overwrite).parquet(filename)
      spark.read.parquet(filename).coalesce(1).createOrReplaceTempView("t")
      val query = sql("select a from t where a like '%$_%' escape '$'")
      checkSparkAnswerAndOperator(query)
    }
  }

Output:

== Results ==
!== Correct Answer - 2 ==   == Spark Answer - 0 ==
!struct<a:string>           struct<>
![a_b]                      
![d_e_f]   

Steps to reproduce

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions