Support java.sql.Date and java.sql.Timestamp so they work just as in plain Spark datasets.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- data-engineering
Research direction
Start by reproducing the reported TypedDataset filter failure with java.sql.Date, then inspect how TypedDataset handles literals and type conversions. Check the corresponding handling for java.sql.Timestamp as well. Done means both types can be compared in TypedDataset expressions like their plain Spark Dataset equivalents without a date/int mismatch.
Written by the indexing model from the issue text.
Description
Given the following snippet:
import frameless._
import org.apache.spark.sql.catalyst.util.DateTimeUtils
implicit val dateAsInt: Injection[java.sql.Date, Int] = Injection(DateTimeUtils.fromJavaDate, DateTimeUtils.toJavaDate)
// create some df (typically read from an orc or parquet file)
val today = new java.sql.Date(System.currentTimeMillis)
val df = Seq((42, today)).toDF("i", "d")
// and turn it into a TypedDataset
case class P(i: Int, d: java.sql.Date)
val ds = df.as[P]
val tds = TypedDataset.create(ds)
in plain Dataset you can use:
ds.filter(ds("d") === today).show
+---+----------+
| i| d|
+---+----------+
| 42|2017-11-10|
+---+----------+
but in TypedDataset this results in an AnalysisException
tds.filter(tds('d) === today).show().run
org.apache.spark.sql.AnalysisException: cannot resolve '(`d` = FramelessLit(2017-11-10))' due to data type mismatch: differing types in '(`d` = FramelessLit(2017-11-10))' (date and int).;;
'Filter (d#82 = FramelessLit(2017-11-10))
+- Project [_1#78 AS i#81, _2#79 AS d#82]
+- LocalRelation [_1#78, _2#79]
- Dominant language
- Scala
- Stars
- 895
- Forks
- 135
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from typelevel/frameless
-
Scala 3 builds Openenhancement feature help wanted
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
enhancement feature
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
All issues in typelevel/frameless
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Area: Excel support
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
orbeon/orbeon-forms#7893 ·
-
x:action/fix x:module/practice-exercise x:size/small
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
lichess-org/lila#21788 · 2 comments ·
-
area:Iceberg area:writer documentation requires-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/datafusion-comet#6147 ·