@@ -18,7 +18,12 @@ import kotlin.reflect.typeOf
1818 * Assert that we have got the same data that was originally saved on example creation.
1919 * Example generation project is currently located at https://github.com/Kopilov/arrow_example
2020 */
21- internal fun assertEstimations (exampleFrame : AnyFrame , expectedNullable : Boolean , hasNulls : Boolean ) {
21+ internal fun assertEstimations (
22+ exampleFrame : AnyFrame ,
23+ expectedNullable : Boolean ,
24+ hasNulls : Boolean ,
25+ fromParquet : Boolean = false
26+ ) {
2227 /* *
2328 * In [exampleFrame] we get two concatenated batches. To assert the estimations, we should transform frame row number to batch row number
2429 */
@@ -129,10 +134,19 @@ internal fun assertEstimations(exampleFrame: AnyFrame, expectedNullable: Boolean
129134 assertValueOrNull(iBatch(i), element, LocalDate .ofEpochDay(iBatch(i).toLong() * 30 ))
130135 }
131136
132- val datetimeCol = exampleFrame[" date64" ] as DataColumn <LocalDateTime ?>
133- datetimeCol.type() shouldBe typeOf<LocalDateTime >().withNullability(expectedNullable)
134- datetimeCol.forEachIndexed { i, element ->
135- assertValueOrNull(iBatch(i), element, LocalDateTime .ofEpochSecond(iBatch(i).toLong() * 60 * 60 * 24 * 30 , 0 , ZoneOffset .UTC ))
137+ if (fromParquet){
138+ // parquet format have only one type of date: https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#date without time
139+ val datetimeCol = exampleFrame[" date64" ] as DataColumn <LocalDate ?>
140+ datetimeCol.type() shouldBe typeOf<LocalDate >().withNullability(expectedNullable)
141+ datetimeCol.forEachIndexed { i, element ->
142+ assertValueOrNull(iBatch(i), element, LocalDate .ofEpochDay(iBatch(i).toLong() * 30 ))
143+ }
144+ }else {
145+ val datetimeCol = exampleFrame[" date64" ] as DataColumn <LocalDateTime ?>
146+ datetimeCol.type() shouldBe typeOf<LocalDateTime >().withNullability(expectedNullable)
147+ datetimeCol.forEachIndexed { i, element ->
148+ assertValueOrNull(iBatch(i), element, LocalDateTime .ofEpochSecond(iBatch(i).toLong() * 60 * 60 * 24 * 30 , 0 , ZoneOffset .UTC ))
149+ }
136150 }
137151
138152 val timeSecCol = exampleFrame[" time32_seconds" ] as DataColumn <LocalTime ?>
0 commit comments