|
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 { |
@@ -90,6 +86,8 @@ public void testGetSqlTypeIdFromArrowType() { |
90 | 86 | assertEquals(Types.JAVA_OBJECT, getSqlTypeIdFromArrowType(new ArrowType.Map(true))); |
91 | 87 |
|
92 | 88 | assertEquals(Types.NULL, getSqlTypeIdFromArrowType(new ArrowType.Null())); |
| 89 | + |
| 90 | + assertEquals(Types.OTHER, getSqlTypeIdFromArrowType(new UuidType())); |
93 | 91 | } |
94 | 92 |
|
95 | 93 | @Test |
@@ -145,49 +143,7 @@ public void testGetSqlTypeNameFromArrowType() { |
145 | 143 | assertEquals("JAVA_OBJECT", getSqlTypeNameFromArrowType(new ArrowType.Map(true))); |
146 | 144 |
|
147 | 145 | assertEquals("NULL", getSqlTypeNameFromArrowType(new ArrowType.Null())); |
148 | | - } |
149 | | - |
150 | | - @Test |
151 | | - public void testGetSqlTypeIdFromFieldForUuid() { |
152 | | - Field uuidField = new Field("uuid_col", new FieldType(true, UuidType.INSTANCE, null), null); |
153 | | - assertEquals(Types.OTHER, getSqlTypeIdFromArrowType(uuidField.getType())); |
154 | | - } |
155 | | - |
156 | | - @Test |
157 | | - public void testGetSqlTypeNameFromFieldForUuid() { |
158 | | - Field uuidField = new Field("uuid_col", new FieldType(true, UuidType.INSTANCE, null), null); |
159 | | - assertEquals("OTHER", getSqlTypeNameFromArrowType(uuidField.getType())); |
160 | | - } |
161 | | - |
162 | | - @Test |
163 | | - public void testIsUuidFieldReturnsTrue() { |
164 | | - Field uuidField = new Field("uuid_col", new FieldType(true, UuidType.INSTANCE, null), null); |
165 | | - assertTrue(isUuidField(uuidField)); |
166 | | - } |
167 | | - |
168 | | - @Test |
169 | | - public void testIsUuidFieldReturnsFalseForNonUuid() { |
170 | | - Field intField = new Field("int_col", FieldType.nullable(new ArrowType.Int(32, true)), null); |
171 | | - assertFalse(isUuidField(intField)); |
172 | | - |
173 | | - Field binaryField = |
174 | | - new Field("binary_col", FieldType.nullable(new ArrowType.FixedSizeBinary(16)), null); |
175 | | - assertFalse(isUuidField(binaryField)); |
176 | | - } |
177 | | - |
178 | | - @Test |
179 | | - public void testGetSqlTypeIdFromFieldForNonUuid() { |
180 | | - Field intField = new Field("int_col", FieldType.nullable(new ArrowType.Int(32, true)), null); |
181 | | - assertEquals(Types.INTEGER, getSqlTypeIdFromArrowType(intField.getType())); |
182 | | - } |
183 | | - |
184 | | - @Test |
185 | | - public void testGetSqlTypeNameFromFieldForNonUuid() { |
186 | | - Field intField = new Field("int_col", FieldType.nullable(new ArrowType.Int(32, true)), null); |
187 | | - assertEquals("INTEGER", getSqlTypeNameFromArrowType(intField.getType())); |
188 | | - } |
189 | 146 |
|
190 | | - static boolean isUuidField(Field field) { |
191 | | - return field.getType() instanceof UuidType; |
| 147 | + assertEquals("OTHER", getSqlTypeNameFromArrowType(new UuidType())); |
192 | 148 | } |
193 | 149 | } |
0 commit comments