Closed sfc-gh-fgonzalezmendez closed 2 days ago
I see this PR missed structured types and timestamp types, what is the plan to support them?
@sfc-gh-bli Can you explain in more detail which scenarios are not covered yet with this implementation, please?
For example, calling the function row.getAs[Timestamp](0)
will have the same behaviour as calling the function row.getTimestamp(0)
. Inside, those two functions will just call get(index).asInstanceOf[T]
val schema = StructType(StructField("c1", TimestampType))
val data = Seq(Row(new Timestamp(System.currentTimeMillis())))
val row = session.createDataFrame(data, schema).collect()(0)
row.getAs[Timestamp](0) == row.getTimestamp(0) // true
Regarding the structured types, I think it is similar to the above scenario. Those types will fall in the default case: get(index).asInstanceOf[T]
.
Please answer these questions before submitting your pull requests. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SIT-2037
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
It adds a new function to the
Row
class that returns the value at the specified column index and casts it to the desired type.Pre-review checklist
(For Snowflake employees)