Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.spark.sql.connector.expressions;

import org.apache.spark.annotation.Evolving;
import org.apache.spark.sql.internal.connector.ToStringSQLBuilder;

import java.io.Serializable;

Expand Down Expand Up @@ -59,4 +60,10 @@ public Extract(String field, Expression source) {

@Override
public Expression[] children() { return new Expression[]{ source() }; }

@Override
public String toString() {
ToStringSQLBuilder builder = new ToStringSQLBuilder();
return builder.build(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,15 @@ class JDBCV2Suite extends QueryTest with SharedSparkSession with ExplainSuiteHel
"PushedFilters: [DATE1 IS NOT NULL, ((EXTRACT(DAY_OF_WEEK FROM DATE1) % 7) + 1) = 4]"
checkPushedInfo(df8, expectedPlanFragment8)
checkAnswer(df8, Seq(Row("alex")))

val df9 = sql("SELECT name FROM h2.test.datetime WHERE " +
"dayofyear(date1) > 100 order by dayofyear(date1) limit 1")
checkFiltersRemoved(df9)
val expectedPlanFragment9 =
"PushedFilters: [DATE1 IS NOT NULL, EXTRACT(DAY_OF_YEAR FROM DATE1) > 100], " +
"PushedTopN: ORDER BY [EXTRACT(DAY_OF_YEAR FROM DATE1) ASC NULLS FIRST] LIMIT 1,"
checkPushedInfo(df9, expectedPlanFragment9)
checkAnswer(df9, Seq(Row("alex")))
}

test("scan with filter push-down with misc functions") {
Expand Down