From c10f153a05c1dc3d3912e4188f2eb75b18fba6f3 Mon Sep 17 00:00:00 2001 From: Simon Ismair Date: Wed, 5 Sep 2018 22:24:07 +0200 Subject: [PATCH 1/2] Added ENUM to types --- lib/types.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/types.js b/lib/types.js index 13292686..d801dacf 100644 --- a/lib/types.js +++ b/lib/types.js @@ -41,6 +41,12 @@ const PARQUET_LOGICAL_TYPES = { toPrimitive: toPrimitive_UTF8, fromPrimitive: fromPrimitive_UTF8 }, + 'ENUM': { + primitiveType: 'BYTE_ARRAY', + originalType: 'UTF8', + toPrimitive: toPrimitive_UTF8, + fromPrimitive: fromPrimitive_UTF8 + }, 'TIME_MILLIS': { primitiveType: 'INT32', originalType: 'TIME_MILLIS', From 4c4f179ea300f8a84bbf9242257ade6d0876655f Mon Sep 17 00:00:00 2001 From: SimonI Date: Fri, 7 Sep 2018 16:45:03 +0200 Subject: [PATCH 2/2] Added test for ENUM type --- test/test-files.js | 5 +++++ test/test-files/test-enum-type.parquet | Bin 0 -> 254 bytes 2 files changed, 5 insertions(+) create mode 100644 test/test-files/test-enum-type.parquet diff --git a/test/test-files.js b/test/test-files.js index 02ad74ba..236eb9d1 100644 --- a/test/test-files.js +++ b/test/test-files.js @@ -108,6 +108,11 @@ describe('test-files', function() { assert.deepEqual(data,[{foo: 'bar'},{}]); }); + it('test-enum-type.parquet loads', async function() { + const data = await readData('test-enum-type.parquet'); + assert.deepEqual(data,[{foo: 'bar'}]); + }); + it('test-null-dictionary.parquet loads', async function() { const data = await readData('test-null-dictionary.parquet'); assert.deepEqual(data,[].concat.apply([{}],[...Array(3)].map( () => ([{foo: 'bar'}, {foo: 'baz'}])))); diff --git a/test/test-files/test-enum-type.parquet b/test/test-files/test-enum-type.parquet new file mode 100644 index 0000000000000000000000000000000000000000..93a106b3b6703a8973680339f4caaf4e9afd0a68 GIT binary patch literal 254 zcmb79y9&ZU5S&~j1PLj`S#ol10)hzkHg=Z5+9rY)7CB9#-)ZT0_ysQ41newkVVM_G z?+zO#%$Xl)hyV~XSH!2L3r8Sk`~buXC7IbWfi2>T_f(Cv(pKqql>Qo*fl`B-VV$IG zMWbl!YCq|`A85d=L`W=CjkM0X>goP&l263Bydy3kuSg7RR!nbAcYmCR^|eQ@wY4t) E0u#h7g8%>k literal 0 HcmV?d00001