1616 */
1717package org .apache .arrow .vector .types .pojo ;
1818
19+ import static org .apache .arrow .vector .TestUtils .ensureRegistered ;
1920import static org .junit .jupiter .api .Assertions .assertArrayEquals ;
2021import static org .junit .jupiter .api .Assertions .assertEquals ;
2122import static org .junit .jupiter .api .Assertions .assertFalse ;
@@ -60,9 +61,9 @@ public class TestExtensionType {
6061 /** Test that a custom UUID type can be round-tripped through a temporary file. */
6162 @ Test
6263 public void roundtripUuid () throws IOException {
63- ExtensionTypeRegistry . register ( new UuidType () );
64+ ensureRegistered ( UuidType . INSTANCE );
6465 final Schema schema =
65- new Schema (Collections .singletonList (Field .nullable ("a" , new UuidType () )));
66+ new Schema (Collections .singletonList (Field .nullable ("a" , UuidType . INSTANCE )));
6667 try (final BufferAllocator allocator = new RootAllocator (Integer .MAX_VALUE );
6768 final VectorSchemaRoot root = VectorSchemaRoot .create (schema , allocator )) {
6869 UUID u1 = UUID .randomUUID ();
@@ -90,7 +91,7 @@ public void roundtripUuid() throws IOException {
9091 assertEquals (root .getSchema (), readerRoot .getSchema ());
9192
9293 final Field field = readerRoot .getSchema ().getFields ().get (0 );
93- final UuidType expectedType = new UuidType () ;
94+ final UuidType expectedType = UuidType . INSTANCE ;
9495 assertEquals (
9596 field .getMetadata ().get (ExtensionType .EXTENSION_METADATA_KEY_NAME ),
9697 expectedType .extensionName ());
@@ -114,9 +115,9 @@ public void roundtripUuid() throws IOException {
114115 /** Test that a custom UUID type can be read as its underlying type. */
115116 @ Test
116117 public void readUnderlyingType () throws IOException {
117- ExtensionTypeRegistry . register ( new UuidType () );
118+ ensureRegistered ( UuidType . INSTANCE );
118119 final Schema schema =
119- new Schema (Collections .singletonList (Field .nullable ("a" , new UuidType () )));
120+ new Schema (Collections .singletonList (Field .nullable ("a" , UuidType . INSTANCE )));
120121 try (final BufferAllocator allocator = new RootAllocator (Integer .MAX_VALUE );
121122 final VectorSchemaRoot root = VectorSchemaRoot .create (schema , allocator )) {
122123 UUID u1 = UUID .randomUUID ();
@@ -136,7 +137,7 @@ public void readUnderlyingType() throws IOException {
136137 writer .end ();
137138 }
138139
139- ExtensionTypeRegistry .unregister (new UuidType () );
140+ ExtensionTypeRegistry .unregister (UuidType . INSTANCE );
140141
141142 try (final SeekableByteChannel channel =
142143 Files .newByteChannel (Paths .get (file .getAbsolutePath ()));
@@ -154,7 +155,7 @@ public void readUnderlyingType() throws IOException {
154155 .getByteWidth ());
155156
156157 final Field field = readerRoot .getSchema ().getFields ().get (0 );
157- final UuidType expectedType = new UuidType () ;
158+ final UuidType expectedType = UuidType . INSTANCE ;
158159 assertEquals (
159160 field .getMetadata ().get (ExtensionType .EXTENSION_METADATA_KEY_NAME ),
160161 expectedType .extensionName ());
@@ -255,7 +256,7 @@ public void roundtripLocation() throws IOException {
255256
256257 @ Test
257258 public void testVectorCompare () {
258- UuidType uuidType = new UuidType () ;
259+ UuidType uuidType = UuidType . INSTANCE ;
259260 ExtensionTypeRegistry .register (uuidType );
260261 try (final BufferAllocator allocator = new RootAllocator (Integer .MAX_VALUE );
261262 UuidVector a1 =
0 commit comments