Search in sources :

Example 16 with PinotException

use of com.facebook.presto.pinot.PinotException in project presto by prestodb.

the class PinotProjectExpressionConverter method handleCast.

private PinotExpression handleCast(CallExpression cast, Map<VariableReferenceExpression, Selection> context) {
    if (cast.getArguments().size() == 1) {
        RowExpression input = cast.getArguments().get(0);
        Type expectedType = cast.getType();
        if (isImplicitCast(input.getType(), expectedType)) {
            return input.accept(this, context);
        }
        throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), "Non implicit casts not supported: " + cast);
    }
    throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("This type of CAST operator not supported. Received: %s", cast));
}
Also used : PinotException(com.facebook.presto.pinot.PinotException) Type(com.facebook.presto.common.type.Type) RowExpression(com.facebook.presto.spi.relation.RowExpression)

Example 17 with PinotException

use of com.facebook.presto.pinot.PinotException in project presto by prestodb.

the class TestPinotExpressionConverters method testFilterUnsupported.

private void testFilterUnsupported(String sqlExpression, SessionHolder sessionHolder) {
    try {
        RowExpression pushDownExpression = getRowExpression(sqlExpression, sessionHolder);
        String actualPinotExpression = pushDownExpression.accept(new PinotFilterExpressionConverter(functionAndTypeManager, functionAndTypeManager, standardFunctionResolution), testInputFunction).getDefinition();
        fail("expected to not reach here: Generated " + actualPinotExpression);
    } catch (PinotException e) {
        assertEquals(e.getErrorCode(), PINOT_UNSUPPORTED_EXPRESSION.toErrorCode());
    }
}
Also used : PinotException(com.facebook.presto.pinot.PinotException) RowExpression(com.facebook.presto.spi.relation.RowExpression)

Aggregations

PinotException (com.facebook.presto.pinot.PinotException)17 RowExpression (com.facebook.presto.spi.relation.RowExpression)10 OperatorType (com.facebook.presto.common.function.OperatorType)5 PinotPushdownUtils.getLiteralAsString (com.facebook.presto.pinot.PinotPushdownUtils.getLiteralAsString)5 Type (com.facebook.presto.common.type.Type)4 ConstantExpression (com.facebook.presto.spi.relation.ConstantExpression)4 VariableReferenceExpression (com.facebook.presto.spi.relation.VariableReferenceExpression)4 SortOrder (com.facebook.presto.common.block.SortOrder)3 BigintType (com.facebook.presto.common.type.BigintType)3 DateType (com.facebook.presto.common.type.DateType)3 IntegerType (com.facebook.presto.common.type.IntegerType)3 PinotColumnHandle (com.facebook.presto.pinot.PinotColumnHandle)3 PinotConfig (com.facebook.presto.pinot.PinotConfig)3 PINOT_QUERY_GENERATOR_FAILURE (com.facebook.presto.pinot.PinotErrorCode.PINOT_QUERY_GENERATOR_FAILURE)3 PINOT_UNSUPPORTED_EXPRESSION (com.facebook.presto.pinot.PinotErrorCode.PINOT_UNSUPPORTED_EXPRESSION)3 PINOT_DISTINCT_COUNT_FUNCTION_NAME (com.facebook.presto.pinot.PinotPushdownUtils.PINOT_DISTINCT_COUNT_FUNCTION_NAME)3 PinotPushdownUtils.checkSupported (com.facebook.presto.pinot.PinotPushdownUtils.checkSupported)3 PinotSessionProperties (com.facebook.presto.pinot.PinotSessionProperties)3 ConnectorSession (com.facebook.presto.spi.ConnectorSession)3 CallExpression (com.facebook.presto.spi.relation.CallExpression)3