@Test public void testTypesIsSameFamilyWithCharTypes() { assertThat(areSameFamily(ImmutableList.of(f.sqlVarchar, f.sqlVarchar)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlVarchar, f.sqlChar)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlVarchar, f.sqlVarcharNullable)), is(true)); }
@Test public void testTypesIsSameFamilyWithInconvertibleTypes() { assertThat(areSameFamily(ImmutableList.of(f.sqlBoolean, f.sqlBigInt)), is(false)); assertThat(areSameFamily(ImmutableList.of(f.sqlFloat, f.sqlBoolean)), is(false)); assertThat(areSameFamily(ImmutableList.of(f.sqlInt, f.sqlDate)), is(false)); }
@Test public void testTypesIsSameFamilyWithCharTypes() { assertThat(areSameFamily(ImmutableList.of(f.sqlVarchar, f.sqlVarchar)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlVarchar, f.sqlChar)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlVarchar, f.sqlVarcharNullable)), is(true)); }
@Test public void testTypesIsSameFamilyWithNumberTypes() { assertThat(areSameFamily(ImmutableList.of(f.sqlBigInt, f.sqlBigInt)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlInt, f.sqlBigInt)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlFloat, f.sqlBigInt)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlInt, f.sqlBigIntNullable)), is(true)); }
@Test public void testTypesIsSameFamilyWithNumberTypes() { assertThat(areSameFamily(ImmutableList.of(f.sqlBigInt, f.sqlBigInt)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlInt, f.sqlBigInt)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlFloat, f.sqlBigInt)), is(true)); assertThat(areSameFamily(ImmutableList.of(f.sqlInt, f.sqlBigIntNullable)), is(true)); }
@Test public void testTypesIsSameFamilyWithInconvertibleTypes() { assertThat(areSameFamily(ImmutableList.of(f.sqlBoolean, f.sqlBigInt)), is(false)); assertThat(areSameFamily(ImmutableList.of(f.sqlFloat, f.sqlBoolean)), is(false)); assertThat(areSameFamily(ImmutableList.of(f.sqlInt, f.sqlDate)), is(false)); }
@Test public void testTypesIsSameFamilyWithCharStructTypes() { final RelDataType varCharStruct = struct(f.sqlVarchar); final RelDataType charStruct = struct(f.sqlChar); assertThat(areSameFamily(ImmutableList.of(varCharStruct, charStruct)), is(true)); assertThat(areSameFamily(ImmutableList.of(charStruct, varCharStruct)), is(true)); assertThat(areSameFamily(ImmutableList.of(varCharStruct, varCharStruct)), is(true)); assertThat(areSameFamily(ImmutableList.of(charStruct, charStruct)), is(true)); }
switch (consistency) { case COMPARE: if (SqlTypeUtil.areSameFamily(types)) {
@Test public void testTypesIsSameFamilyWithNumberStructTypes() { final RelDataType bigIntAndFloat = struct(f.sqlBigInt, f.sqlFloat); final RelDataType floatAndBigInt = struct(f.sqlFloat, f.sqlBigInt); assertThat(areSameFamily(ImmutableList.of(bigIntAndFloat, floatAndBigInt)), is(true)); assertThat(areSameFamily(ImmutableList.of(bigIntAndFloat, bigIntAndFloat)), is(true)); assertThat(areSameFamily(ImmutableList.of(bigIntAndFloat, bigIntAndFloat)), is(true)); assertThat(areSameFamily(ImmutableList.of(floatAndBigInt, floatAndBigInt)), is(true)); }
@Test public void testTypesIsSameFamilyWithCharStructTypes() { final RelDataType varCharStruct = struct(f.sqlVarchar); final RelDataType charStruct = struct(f.sqlChar); assertThat(areSameFamily(ImmutableList.of(varCharStruct, charStruct)), is(true)); assertThat(areSameFamily(ImmutableList.of(charStruct, varCharStruct)), is(true)); assertThat(areSameFamily(ImmutableList.of(varCharStruct, varCharStruct)), is(true)); assertThat(areSameFamily(ImmutableList.of(charStruct, charStruct)), is(true)); }
switch (consistency) { case COMPARE: if (SqlTypeUtil.areSameFamily(types)) {
@Test public void testTypesIsSameFamilyWithNumberStructTypes() { final RelDataType bigIntAndFloat = struct(f.sqlBigInt, f.sqlFloat); final RelDataType floatAndBigInt = struct(f.sqlFloat, f.sqlBigInt); assertThat(areSameFamily(ImmutableList.of(bigIntAndFloat, floatAndBigInt)), is(true)); assertThat(areSameFamily(ImmutableList.of(bigIntAndFloat, bigIntAndFloat)), is(true)); assertThat(areSameFamily(ImmutableList.of(bigIntAndFloat, bigIntAndFloat)), is(true)); assertThat(areSameFamily(ImmutableList.of(floatAndBigInt, floatAndBigInt)), is(true)); }
@Test public void testTypesIsSameFamilyWithInconvertibleStructTypes() { final RelDataType dateStruct = struct(f.sqlDate); final RelDataType boolStruct = struct(f.sqlBoolean); assertThat(areSameFamily(ImmutableList.of(dateStruct, boolStruct)), is(false)); final RelDataType charIntStruct = struct(f.sqlChar, f.sqlInt); final RelDataType charDateStruct = struct(f.sqlChar, f.sqlDate); assertThat(areSameFamily(ImmutableList.of(charIntStruct, charDateStruct)), is(false)); final RelDataType boolDateStruct = struct(f.sqlBoolean, f.sqlDate); final RelDataType floatIntStruct = struct(f.sqlInt, f.sqlFloat); assertThat(areSameFamily(ImmutableList.of(boolDateStruct, floatIntStruct)), is(false)); }
@Test public void testTypesIsSameFamilyWithInconvertibleStructTypes() { final RelDataType dateStruct = struct(f.sqlDate); final RelDataType boolStruct = struct(f.sqlBoolean); assertThat(areSameFamily(ImmutableList.of(dateStruct, boolStruct)), is(false)); final RelDataType charIntStruct = struct(f.sqlChar, f.sqlInt); final RelDataType charDateStruct = struct(f.sqlChar, f.sqlDate); assertThat(areSameFamily(ImmutableList.of(charIntStruct, charDateStruct)), is(false)); final RelDataType boolDateStruct = struct(f.sqlBoolean, f.sqlDate); final RelDataType floatIntStruct = struct(f.sqlInt, f.sqlFloat); assertThat(areSameFamily(ImmutableList.of(boolDateStruct, floatIntStruct)), is(false)); }