/** * Create a {@link TimestampedHiveDatasetVersion} from a {@link Partition} based on the Modified time of underlying * hdfs data location * @throws IllegalArgumentException when argument is null * @throws IllegalArgumentException when data location of partition is null * @throws IllegalArgumentException when data location of partition doesn't exist * {@inheritDoc} */ @Override protected TimestampedHiveDatasetVersion getDatasetVersion(Partition partition) { try { Preconditions.checkArgument(partition != null, "Argument to method "); Path dataLocation = partition.getDataLocation(); Preconditions .checkArgument(dataLocation != null, "Data location is null for partition " + partition.getCompleteName()); boolean exists = this.fs.exists(dataLocation); Preconditions.checkArgument(exists, "Data location doesn't exist for partition " + partition.getCompleteName()); long modificationTS = this.fs.getFileStatus(dataLocation).getModificationTime(); return new TimestampedHiveDatasetVersion(new DateTime(modificationTS), partition); } catch (IOException e) { throw new RuntimeException(e); } } }
aspect LogAllMethods { Log log = new Log(); // pseudocode -- replace with whatever logging mechanism you like before(): call(public * com.mycompany.*.*(..)) { log.log("Entered method: " + thisJoinPoint); } after(): call(public * com.mycomapny.*.*(..)) { log.log("Leaving method: " + thisJoinPoint); } }
/** * @param readSupport Object which helps reads files of the given type, e.g. Thrift, Avro. * @param filter for filtering individual records */ public InternalParquetRecordReader(ReadSupport<T> readSupport, Filter filter) { this.readSupport = readSupport; this.filter = checkNotNull(filter, "filter"); }
private void log(Object m) { String indent = ""; for (int i = 0; i<currentLevel; ++i) { indent += " "; } logger.debug(indent + m); }
public static void validateBuffer(byte[] buffer, int off, int len) { Preconditions.checkNotNull(buffer, "buffer"); Preconditions.checkArgument(off >= 0 && len >= 0 && off <= buffer.length - len, "Invalid buffer offset or length: buffer.length=%s off=%s len=%s", buffer.length, off, len); } }
@Override public void initFromPage(int valueCount, byte[] in, int offset) throws IOException { if (DEBUG) LOG.debug("init from page at offset "+ offset + " for length " + (in.length - offset)); this.in = in; this.offset = offset; } }
/** * If this is called, the thrift class is used. * If not, will use the thrift class based on the file * metadata if a thrift class information is present. */ public Builder<T> withThriftClass(Class<T> thriftClass) { this.thriftClass = checkNotNull(thriftClass, "thriftClass"); return this; }
/** * @return the index of the last value written to this stream, which * can be passed to {@link #setByte(long, byte)} in order to change it */ public long getCurrentIndex() { checkArgument(bytesUsed > 0, "This is an empty stream"); return bytesUsed - 1; }
/** * * @param c the current class * @return the corresponding logger */ public static Log getLog(Class<?> c) { return new Log(c); }
@SuppressWarnings("unchecked") @Override public void prepareToRead(@SuppressWarnings("rawtypes") RecordReader reader, PigSplit split) throws IOException { if (DEBUG) LOG.debug("LoadFunc.prepareToRead(" + reader + ", " + split + ")"); this.reader = reader; }
public FilteringGroupConverter( GroupConverter delegate, List<Integer> indexFieldPath, Map<ColumnPath, List<ValueInspector>> valueInspectorsByColumn, Map<List<Integer>, PrimitiveColumnIO> columnIOsByIndexFieldPath) { this.delegate = checkNotNull(delegate, "delegate"); this.indexFieldPath = checkNotNull(indexFieldPath, "indexFieldPath"); this.columnIOsByIndexFieldPath = checkNotNull(columnIOsByIndexFieldPath, "columnIOsByIndexFieldPath"); this.valueInspectorsByColumn = checkNotNull(valueInspectorsByColumn, "valueInspectorsByColumn"); }
/** * @return the index of the last value written to this stream, which * can be passed to {@link #setByte(long, byte)} in order to change it */ public long getCurrentIndex() { checkArgument(bytesUsed > 0, "This is an empty stream"); return bytesUsed - 1; }
var logger1 = new Log(); logger1.log(0, "should print"); logger1.log(1, "should print"); logger1.log(2, "should print"); Log.SetLevel(1); //global level logger1.log(0, "should print"); logger1.log(1, "should print"); logger1.log(2, "should not print");
@Override public void initFromPage(int valueCount, byte[] in, int offset) throws IOException { if (DEBUG) LOG.debug("init from page at offset "+ offset + " for length " + (in.length - offset)); this.in = in; this.offset = offset; }
protected Column(ColumnPath columnPath, Class<T> columnType) { checkNotNull(columnPath, "columnPath"); checkNotNull(columnType, "columnType"); this.columnPath = columnPath; this.columnType = columnType; }
public Boundary(MarkerComparator comparator, Marker bound, boolean isInclusive) { parquet.Preconditions.checkArgument(comparator != null, "Comparator cannot be null"); parquet.Preconditions.checkArgument(bound != null, "Bound cannot be null"); this.comparator = comparator; this.bound = bound; this.isInclusive = isInclusive; }
/** * * @param c the current class * @return the corresponding logger */ public static Log getLog(Class<?> c) { return new Log(c); }
/** * Construct a type builder that returns a "parent" object when the builder * is finished. The {@code parent} will be returned by * {@link #named(String)} so that builders can be chained. * * @param parent a non-null object to return from {@link #named(String)} */ protected Builder(P parent) { Preconditions.checkNotNull(parent, "Parent cannot be null"); this.parent = parent; this.returnClass = null; }
public DeltaBinaryPackingConfig(int blockSizeInValues, int miniBlockNumInABlock) { this.blockSizeInValues = blockSizeInValues; this.miniBlockNumInABlock = miniBlockNumInABlock; double miniSize = (double) blockSizeInValues / miniBlockNumInABlock; Preconditions.checkArgument(miniSize % 8 == 0, "miniBlockSize must be multiple of 8, but it's " + miniSize); this.miniBlockSizeInValues = (int) miniSize; }
public static Predicate equalTo(final String target) { Preconditions.checkNotNull(target,"target"); return new Predicate() { @Override public boolean apply(ColumnReader input) { return target.equals(input.getBinary().toStringUsingUTF8()); } }; }