public Exception call() throws Exception { return ex(new NullPointerException("test")); } });
public Exception call() throws Exception { return ex(new NullPointerException("test")); } });
/** * Implements the {@code .} (field access) operator on an object * whose type is not known until runtime. * * <p>A struct object can be represented in various ways by the * runtime and depends on the * {@link org.apache.calcite.adapter.enumerable.JavaRowFormat}. */ @Experimental public static Object structAccess(Object structObject, int index, String fieldName) { if (structObject == null) { return null; } if (structObject instanceof Object[]) { return ((Object[]) structObject)[index]; } else if (structObject instanceof List) { return ((List) structObject).get(index); } else if (structObject instanceof Row) { return ((Row) structObject).getObject(index); } else { Class<?> beanClass = structObject.getClass(); try { Field structField = beanClass.getDeclaredField(fieldName); return structField.get(structObject); } catch (NoSuchFieldException | IllegalAccessException ex) { throw RESOURCE.failedToAccessField(fieldName, beanClass.getName()).ex(ex); } } }
/** * Wraps an exception with context. */ public static CalciteContextException newContextException( int line, int col, int endLine, int endCol, Resources.ExInst<?> e) { CalciteContextException contextExcn = (line == endLine && col == endCol ? RESOURCE.validatorContextPoint(line, col) : RESOURCE.validatorContext(line, col, endLine, endCol)).ex(e.ex()); contextExcn.setPosition(line, col, endLine, endCol); return contextExcn; }
/** * Wraps an exception with context. */ public static CalciteContextException newContextException( int line, int col, int endLine, int endCol, Resources.ExInst<?> e) { CalciteContextException contextExcn = (line == endLine && col == endCol ? RESOURCE.validatorContextPoint(line, col) : RESOURCE.validatorContext(line, col, endLine, endCol)).ex(e.ex()); contextExcn.setPosition(line, col, endLine, endCol); return contextExcn; }
@Override public void validateAggregateParams(SqlCall aggCall, SqlNode filter, SqlValidatorScope scope) { if (filter != null) { Exception e = new SqlValidatorException("Dremio does not currently support aggregate functions with a filter clause", null); SqlParserPos pos = filter.getParserPosition(); CalciteContextException ex = RESOURCE.validatorContextPoint(pos.getLineNum(), pos.getColumnNum()).ex(e); ex.setPosition(pos.getLineNum(), pos.getColumnNum()); throw ex; } super.validateAggregateParams(aggCall, filter, scope); } }