|
19 | 19 | import static org.apache.arrow.driver.jdbc.utils.SqlTypes.getSqlTypeIdFromArrowType; |
20 | 20 | import static org.apache.arrow.driver.jdbc.utils.SqlTypes.getSqlTypeNameFromArrowType; |
21 | 21 | import static org.junit.jupiter.api.Assertions.assertEquals; |
22 | | -import static org.junit.jupiter.api.Assertions.assertFalse; |
23 | | -import static org.junit.jupiter.api.Assertions.assertTrue; |
24 | 22 |
|
25 | 23 | import java.sql.Types; |
26 | 24 | import org.apache.arrow.vector.extension.UuidType; |
|
30 | 28 | import org.apache.arrow.vector.types.TimeUnit; |
31 | 29 | import org.apache.arrow.vector.types.UnionMode; |
32 | 30 | import org.apache.arrow.vector.types.pojo.ArrowType; |
33 | | -import org.apache.arrow.vector.types.pojo.Field; |
34 | | -import org.apache.arrow.vector.types.pojo.FieldType; |
35 | 31 | import org.junit.jupiter.api.Test; |
36 | 32 |
|
37 | 33 | public class SqlTypesTest { |
@@ -88,6 +84,8 @@ public void testGetSqlTypeIdFromArrowType() { |
88 | 84 | assertEquals(Types.JAVA_OBJECT, getSqlTypeIdFromArrowType(new ArrowType.Map(true))); |
89 | 85 |
|
90 | 86 | assertEquals(Types.NULL, getSqlTypeIdFromArrowType(new ArrowType.Null())); |
| 87 | + |
| 88 | + assertEquals(Types.OTHER, getSqlTypeIdFromArrowType(new UuidType())); |
91 | 89 | } |
92 | 90 |
|
93 | 91 | @Test |
@@ -141,49 +139,7 @@ public void testGetSqlTypeNameFromArrowType() { |
141 | 139 | assertEquals("JAVA_OBJECT", getSqlTypeNameFromArrowType(new ArrowType.Map(true))); |
142 | 140 |
|
143 | 141 | assertEquals("NULL", getSqlTypeNameFromArrowType(new ArrowType.Null())); |
144 | | - } |
145 | | - |
146 | | - @Test |
147 | | - public void testGetSqlTypeIdFromFieldForUuid() { |
148 | | - Field uuidField = new Field("uuid_col", new FieldType(true, UuidType.INSTANCE, null), null); |
149 | | - assertEquals(Types.OTHER, getSqlTypeIdFromArrowType(uuidField.getType())); |
150 | | - } |
151 | | - |
152 | | - @Test |
153 | | - public void testGetSqlTypeNameFromFieldForUuid() { |
154 | | - Field uuidField = new Field("uuid_col", new FieldType(true, UuidType.INSTANCE, null), null); |
155 | | - assertEquals("OTHER", getSqlTypeNameFromArrowType(uuidField.getType())); |
156 | | - } |
157 | | - |
158 | | - @Test |
159 | | - public void testIsUuidFieldReturnsTrue() { |
160 | | - Field uuidField = new Field("uuid_col", new FieldType(true, UuidType.INSTANCE, null), null); |
161 | | - assertTrue(isUuidField(uuidField)); |
162 | | - } |
163 | | - |
164 | | - @Test |
165 | | - public void testIsUuidFieldReturnsFalseForNonUuid() { |
166 | | - Field intField = new Field("int_col", FieldType.nullable(new ArrowType.Int(32, true)), null); |
167 | | - assertFalse(isUuidField(intField)); |
168 | | - |
169 | | - Field binaryField = |
170 | | - new Field("binary_col", FieldType.nullable(new ArrowType.FixedSizeBinary(16)), null); |
171 | | - assertFalse(isUuidField(binaryField)); |
172 | | - } |
173 | | - |
174 | | - @Test |
175 | | - public void testGetSqlTypeIdFromFieldForNonUuid() { |
176 | | - Field intField = new Field("int_col", FieldType.nullable(new ArrowType.Int(32, true)), null); |
177 | | - assertEquals(Types.INTEGER, getSqlTypeIdFromArrowType(intField.getType())); |
178 | | - } |
179 | | - |
180 | | - @Test |
181 | | - public void testGetSqlTypeNameFromFieldForNonUuid() { |
182 | | - Field intField = new Field("int_col", FieldType.nullable(new ArrowType.Int(32, true)), null); |
183 | | - assertEquals("INTEGER", getSqlTypeNameFromArrowType(intField.getType())); |
184 | | - } |
185 | 142 |
|
186 | | - static boolean isUuidField(Field field) { |
187 | | - return field.getType() instanceof UuidType; |
| 143 | + assertEquals("OTHER", getSqlTypeNameFromArrowType(new UuidType())); |
188 | 144 | } |
189 | 145 | } |
0 commit comments