private void startRowGroup() { try { this.nextRowGroupSize = min(writer.getNextRowGroupSize(), targetRowGroupSize); } catch (IOException e) { throw new RuntimeIOException(e); } this.nextCheckRecordCount = min(max(recordCount / 2, 100), 10000); this.recordCount = 0; PageWriteStore pageStore = pageStoreCtor.newInstance( compressor, parquetSchema, props.getAllocator()); this.flushPageStoreToWriter = flushToWriter.bind(pageStore); this.writeStore = props.newColumnWriteStore(parquetSchema, pageStore); model.setColumnStore(writeStore); }
/** * Checks for a method implementation. * * @param targetClass a class instance * @param methodName name of a method (different from constructor) * @param argClasses argument classes for the method * @return this Builder for method chaining * @see java.lang.Class#forName(String) * @see java.lang.Class#getMethod(String, Class[]) */ public Builder hiddenImpl(Class<?> targetClass, String methodName, Class<?>... argClasses) { // don't do any work if an implementation has been found if (method != null) { return this; } try { Method hidden = targetClass.getDeclaredMethod(methodName, argClasses); AccessController.doPrivileged(new MakeAccessible(hidden)); this.method = new UnboundMethod(hidden, name); } catch (SecurityException | NoSuchMethodException e) { // unusable or not the right implementation } return this; }
public <R> R invoke(Object target, Object... args) { try { return this.invokeChecked(target, args); } catch (Exception e) { Throwables.propagateIfInstanceOf(e, RuntimeException.class); throw Throwables.propagate(e); } }
APPLY_PROJECTION.bind(projection(finalSchema, iterSchema))::invoke);
/** * Checks for a method implementation. * * @param targetClass a class instance * @param methodName name of a method (different from constructor) * @param argClasses argument classes for the method * @return this Builder for method chaining * @see java.lang.Class#forName(String) * @see java.lang.Class#getMethod(String, Class[]) */ public Builder impl(Class<?> targetClass, String methodName, Class<?>... argClasses) { // don't do any work if an implementation has been found if (method != null) { return this; } try { this.method = new UnboundMethod( targetClass.getMethod(methodName, argClasses), name); } catch (NoSuchMethodException e) { // not the right implementation } return this; }
/** * Returns this method as a BoundMethod for the given receiver. * * @param receiver an Object to receive the method invocation * @return a {@link BoundMethod} for this method and the receiver * @throws IllegalStateException if the method is static * @throws IllegalArgumentException if the receiver's class is incompatible */ public BoundMethod bind(Object receiver) { Preconditions.checkState(!isStatic(), "Cannot bind static method " + method.toGenericString()); Preconditions.checkArgument( method.getDeclaringClass().isAssignableFrom(receiver.getClass()), "Cannot bind " + method.toGenericString() + " to instance of " + receiver.getClass()); return new BoundMethod(this, receiver); }
public <R> R invokeChecked(Object... args) throws Exception { return method.invokeChecked(receiver, args); }
public <R> R invokeChecked(Object... args) throws Exception { return method.invokeChecked(null, args); }
public <R> R invoke(Object... args) { return method.invoke(receiver, args); } }
/** * Returns the first valid implementation as a BoundMethod or throws a * RuntimeError if there is none. * * @param receiver an Object to receive the method invocation * @return a {@link BoundMethod} with a valid implementation and receiver * @throws IllegalStateException if the method is static * @throws IllegalArgumentException if the receiver's class is incompatible * @throws RuntimeException if no implementation was found */ public BoundMethod build(Object receiver) { return build().bind(receiver); }
public <R> R invoke(Object... args) { return method.invoke(null, args); } }
/** * Returns the first valid implementation as a BoundMethod or throws a * NoSuchMethodException if there is none. * * @param receiver an Object to receive the method invocation * @return a {@link BoundMethod} with a valid implementation and receiver * @throws IllegalStateException if the method is static * @throws IllegalArgumentException if the receiver's class is incompatible * @throws NoSuchMethodException if no implementation was found */ public BoundMethod buildChecked(Object receiver) throws NoSuchMethodException { return buildChecked().bind(receiver); }
/** * Returns the first valid implementation as a StaticMethod or throws a * RuntimeException if there is none. * * @return a {@link StaticMethod} with a valid implementation * @throws IllegalStateException if the method is not static * @throws RuntimeException if no implementation was found */ public StaticMethod buildStatic() { return build().asStatic(); }
/** * Returns the first valid implementation as a StaticMethod or throws a * NoSuchMethodException if there is none. * * @return a {@link StaticMethod} with a valid implementation * @throws IllegalStateException if the method is not static * @throws NoSuchMethodException if no implementation was found */ public StaticMethod buildStaticChecked() throws NoSuchMethodException { return buildChecked().asStatic(); }
/** * Returns this method as a StaticMethod. * * @return a {@link StaticMethod} for this method * @throws IllegalStateException if the method is not static */ public StaticMethod asStatic() { Preconditions.checkState(isStatic(), "Method is not static"); return new StaticMethod(this); }