default void check(TestCase testCase) { assertFunctionCall(getSqlFunctionCallGenerator().getSqlFunctionCallString(testCase.getFunctionCall()), getToPlatformTestOutputConverter().convertToTestOutput(testCase.getExpectedOutput(), testCase.getInferredOutputType()), getPlatformType(testCase.getExpectedOutputType())); }
default void check(TestCase testCase) { assertFunctionCall(getSqlFunctionCallGenerator().getSqlFunctionCallString(testCase.getFunctionCall()), getToPlatformTestOutputConverter().convertToTestOutput(testCase.getExpectedOutput(), testCase.getInferredOutputType()), getPlatformType(testCase.getExpectedOutputType())); }
/** * Returns a SQL string representing the provided argument */ default String getFunctionCallArgumentString(Object argument, TestType argumentType) { if (argument == null) { return getNullLiteralString(); } else if (argument instanceof FunctionCall) { return getSqlFunctionCallString((FunctionCall) argument); } else if (argumentType instanceof UnknownTestType) { return getNullLiteralString(); } else if (argumentType instanceof IntegerTestType) { return getIntegerArgumentString((Integer) argument); } else if (argumentType instanceof LongTestType) { return getLongArgumentString((Long) argument); } else if (argumentType instanceof BooleanTestType) { return getBooleanArgumentString((Boolean) argument); } else if (argumentType instanceof StringTestType) { return getStringArgumentString((String) argument); } else if (argumentType instanceof ArrayTestType) { return getArrayArgumentString((List<Object>) argument, ((ArrayTestType) argumentType).getElementType()); } else if (argumentType instanceof MapTestType) { return getMapArgumentString((Map<Object, Object>) argument, ((MapTestType) argumentType).getKeyType(), ((MapTestType) argumentType).getValueType()); } else if (argumentType instanceof StructTestType) { return getStructArgumentString((Row) argument, ((StructTestType) argumentType).getFieldTypes()); } else { throw new UnsupportedOperationException("Unsupported data type: " + argumentType.getClass()); } }
/** * Returns a SQL string representing the provided argument */ default String getFunctionCallArgumentString(Object argument, TestType argumentType) { if (argument == null) { return getNullLiteralString(); } else if (argument instanceof FunctionCall) { return getSqlFunctionCallString((FunctionCall) argument); } else if (argumentType instanceof UnknownTestType) { return getNullLiteralString(); } else if (argumentType instanceof IntegerTestType) { return getIntegerArgumentString((Integer) argument); } else if (argumentType instanceof LongTestType) { return getLongArgumentString((Long) argument); } else if (argumentType instanceof BooleanTestType) { return getBooleanArgumentString((Boolean) argument); } else if (argumentType instanceof StringTestType) { return getStringArgumentString((String) argument); } else if (argumentType instanceof ArrayTestType) { return getArrayArgumentString((List<Object>) argument, ((ArrayTestType) argumentType).getElementType()); } else if (argumentType instanceof MapTestType) { return getMapArgumentString((Map<Object, Object>) argument, ((MapTestType) argumentType).getKeyType(), ((MapTestType) argumentType).getValueType()); } else if (argumentType instanceof StructTestType) { return getStructArgumentString((Row) argument, ((StructTestType) argumentType).getFieldTypes()); } else { throw new UnsupportedOperationException("Unsupported data type: " + argumentType.getClass()); } }