@@ -3,22 +3,23 @@ const chai = require('chai');
3
3
const assert = chai . assert ;
4
4
const { ParquetReader } = require ( '../lib/reader' ) ;
5
5
6
- describe ( 'INT96 timestamp handling' , function ( ) {
6
+ describe ( 'INT96 timestamp handling' , function ( ) {
7
7
this . timeout ( 30000 ) ; // Increase timeout for URL fetching
8
-
9
- const testUrl = 'https://aws-public-blockchain.s3.us-east-2.amazonaws.com/v1.0/eth/traces/date%3D2016-05-22/part-00000-54f4b70c-db10-479c-a117-e3cc760a7e26-c000.snappy.parquet' ;
10
-
11
- it ( 'should handle INT96 values as numbers by default' , async function ( ) {
8
+
9
+ const testUrl =
10
+ 'https://aws-public-blockchain.s3.us-east-2.amazonaws.com/v1.0/eth/traces/date%3D2016-05-22/part-00000-54f4b70c-db10-479c-a117-e3cc760a7e26-c000.snappy.parquet' ;
11
+
12
+ it ( 'should handle INT96 values as numbers by default' , async function ( ) {
12
13
const reader = await ParquetReader . openUrl ( testUrl ) ;
13
14
const cursor = reader . getCursor ( ) ;
14
-
15
+
15
16
// Read the first row
16
17
const row = await cursor . next ( ) ;
17
-
18
+
18
19
// Find INT96 columns (if any)
19
20
const schema = reader . getSchema ( ) ;
20
21
const fields = schema . fields ;
21
-
22
+
22
23
// Check if there are any INT96 columns and verify they're numbers
23
24
let foundInt96 = false ;
24
25
for ( const fieldName in fields ) {
@@ -28,26 +29,26 @@ describe('INT96 timestamp handling', function() {
28
29
assert . isNumber ( row [ fieldName ] , `Expected ${ fieldName } to be a number` ) ;
29
30
}
30
31
}
31
-
32
+
32
33
// If no INT96 columns were found, log a message
33
34
if ( ! foundInt96 ) {
34
35
console . log ( 'No INT96 columns found in the test file' ) ;
35
36
}
36
-
37
+
37
38
await reader . close ( ) ;
38
39
} ) ;
39
-
40
- it ( 'should convert INT96 values to timestamps when option is enabled' , async function ( ) {
40
+
41
+ it ( 'should convert INT96 values to timestamps when option is enabled' , async function ( ) {
41
42
const reader = await ParquetReader . openUrl ( testUrl , { treatInt96AsTimestamp : true } ) ;
42
43
const cursor = reader . getCursor ( ) ;
43
-
44
+
44
45
// Read the first row
45
46
const row = await cursor . next ( ) ;
46
-
47
+
47
48
// Find INT96 columns (if any)
48
49
const schema = reader . getSchema ( ) ;
49
50
const fields = schema . fields ;
50
-
51
+
51
52
// Check if there are any INT96 columns and verify they're Date objects
52
53
let foundInt96 = false ;
53
54
for ( const fieldName in fields ) {
@@ -58,12 +59,12 @@ describe('INT96 timestamp handling', function() {
58
59
console . log ( `${ fieldName } timestamp:` , row [ fieldName ] ) ;
59
60
}
60
61
}
61
-
62
+
62
63
// If no INT96 columns were found, log a message
63
64
if ( ! foundInt96 ) {
64
65
console . log ( 'No INT96 columns found in the test file' ) ;
65
66
}
66
-
67
+
67
68
await reader . close ( ) ;
68
69
} ) ;
69
70
} ) ;
0 commit comments