[#1184] Add DataType.isArray()
This commit is contained in:
parent
6ab797d87b
commit
2da4878ff5
@ -881,6 +881,10 @@ extends BaseTest<A, B, S, B2S, BS, L, X, DATE, D, T, U, I, IPK, T658, T725, T639
|
||||
if (TArrays_NUMBER_R() != null) {
|
||||
Result<Record> result;
|
||||
|
||||
// [#1184] Test data type
|
||||
assertTrue(TArrays_NUMBER_R().getDataType().isArray());
|
||||
assertFalse(TBook_ID().getDataType().isArray());
|
||||
|
||||
// An empty array
|
||||
// --------------
|
||||
ArrayRecord<Integer> array = newNUMBER_R();
|
||||
@ -990,6 +994,10 @@ extends BaseTest<A, B, S, B2S, BS, L, X, DATE, D, T, U, I, IPK, T658, T725, T639
|
||||
Table<?> table;
|
||||
Integer[] array;
|
||||
|
||||
// [#1184] Test data type
|
||||
assertTrue(TArrays_NUMBER().getDataType().isArray());
|
||||
assertFalse(TBook_ID().getDataType().isArray());
|
||||
|
||||
// Cross join the array table with the unnested string array value
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
|
||||
@ -210,4 +210,9 @@ public interface DataType<T> extends Serializable {
|
||||
* </ul>
|
||||
*/
|
||||
boolean isBinary();
|
||||
|
||||
/**
|
||||
* Whether this data type is an array type.
|
||||
*/
|
||||
boolean isArray();
|
||||
}
|
||||
|
||||
@ -454,6 +454,12 @@ public abstract class AbstractDataType<T> implements DataType<T> {
|
||||
return type == byte[].class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isArray() {
|
||||
return ArrayRecord.class.isAssignableFrom(type)
|
||||
|| (!isBinary() && type.isArray());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The Object API
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user