@Override public Column apply(@javax.annotation.Nullable SortSpec s) { return s.getSortKey(); } }).build();
@Override public Column apply(@Nullable SortSpec input) { return input.getSortKey(); } }).build();
@Override public Column apply(@Nullable SimplePredicate p) { return p.getKeySortSpec().getSortKey(); } }).build();
private static SimplePredicate[] getSimplePredicates(IndexDesc desc, Set<Predicate> predicates) { SimplePredicate[] simplePredicates = new SimplePredicate[predicates.size()]; Map<Column, Datum> colToValue = new HashMap<>(); for (Predicate predicate : predicates) { colToValue.put(predicate.column, predicate.value); } SortSpec [] keySortSpecs = desc.getKeySortSpecs(); for (int i = 0; i < keySortSpecs.length; i++) { simplePredicates[i] = new SimplePredicate(keySortSpecs[i], colToValue.get(keySortSpecs[i].getSortKey())); } return simplePredicates; }
private static SimplePredicate[] getSimplePredicates(IndexDesc desc, Set<Predicate> predicates) { SimplePredicate[] simplePredicates = new SimplePredicate[predicates.size()]; Map<Column, Datum> colToValue = new HashMap<>(); for (Predicate predicate : predicates) { colToValue.put(predicate.column, predicate.value); } SortSpec [] keySortSpecs = desc.getKeySortSpecs(); for (int i = 0; i < keySortSpecs.length; i++) { simplePredicates[i] = new SimplePredicate(keySortSpecs[i], colToValue.get(keySortSpecs[i].getSortKey())); } return simplePredicates; }
private String getSortSpecString() { StringBuilder sb = new StringBuilder("Column [key= "); SortSpec[] sortSpecs = indexMeta.getKeySortSpecs(); for (int i = 0; i < sortSpecs.length; i++) { sb.append(sortSpecs[i].getSortKey().getQualifiedName()).append(" ") .append(sortSpecs[i].isAscending() ? "asc" : "desc"); if(i < sortSpecs.length - 1) { sb.append(","); } } sb.append("]"); return sb.toString(); }
private String getSortSpecString() { StringBuilder sb = new StringBuilder("Column [key= "); SortSpec[] sortSpecs = indexMeta.getKeySortSpecs(); for (int i = 0; i < sortSpecs.length; i++) { sb.append(sortSpecs[i].getSortKey().getQualifiedName()).append(" ") .append(sortSpecs[i].isAscending() ? "asc" : "desc"); if(i < sortSpecs.length - 1) { sb.append(","); } } sb.append("]"); return sb.toString(); }
public JoinTupleComparator(Schema leftschema, Schema rightschema, SortSpec[][] sortKeys) { Preconditions.checkArgument(sortKeys.length == 2, "The two of the sortspecs must be given, but " + sortKeys.length + " sortkeys are given."); Preconditions.checkArgument(sortKeys[0].length == sortKeys[1].length, "The number of both side sortkeys must be equals, but they are different: " + sortKeys[0].length + " and " + sortKeys[1].length); this.numSortKey = sortKeys[0].length; // because it is guaranteed that the number of sortspecs are equals this.outerSortKeyIds = new int[numSortKey]; this.innerSortKeyIds = new int[numSortKey]; for (int i = 0; i < numSortKey; i++) { this.outerSortKeyIds[i] = leftschema.getColumnId(sortKeys[0][i].getSortKey().getQualifiedName()); this.innerSortKeyIds[i] = rightschema.getColumnId(sortKeys[1][i].getSortKey().getQualifiedName()); } }
public JoinTupleComparator(Schema leftschema, Schema rightschema, SortSpec[][] sortKeys) { Preconditions.checkArgument(sortKeys.length == 2, "The two of the sortspecs must be given, but " + sortKeys.length + " sortkeys are given."); Preconditions.checkArgument(sortKeys[0].length == sortKeys[1].length, "The number of both side sortkeys must be equals, but they are different: " + sortKeys[0].length + " and " + sortKeys[1].length); this.numSortKey = sortKeys[0].length; // because it is guaranteed that the number of sortspecs are equals this.outerSortKeyIds = new int[numSortKey]; this.innerSortKeyIds = new int[numSortKey]; for (int i = 0; i < numSortKey; i++) { this.outerSortKeyIds[i] = leftschema.getColumnId(sortKeys[0][i].getSortKey().getQualifiedName()); this.innerSortKeyIds[i] = rightschema.getColumnId(sortKeys[1][i].getSortKey().getQualifiedName()); } }
public static Schema sortSpecsToSchema(SortSpec[] sortSpecs) { Schema schema = new Schema(); for (SortSpec spec : sortSpecs) { schema.addColumn(spec.getSortKey()); } return schema; }
public static Schema sortSpecsToSchema(SortSpec[] sortSpecs) { Schema schema = new Schema(); for (SortSpec spec : sortSpecs) { schema.addColumn(spec.getSortKey()); } return schema; }
@Override public int compare(SortSpec o1, SortSpec o2) { return targetRelationSchema.getColumnId(o1.getSortKey().getSimpleName()) - targetRelationSchema.getColumnId(o2.getSortKey().getSimpleName()); } });
@Override public int compare(SortSpec o1, SortSpec o2) { return targetRelationSchema.getColumnId(o1.getSortKey().getSimpleName()) - targetRelationSchema.getColumnId(o2.getSortKey().getSimpleName()); } });
public static Schema sortSpecsToSchema(SortSpec[] sortSpecs) { Schema schema = new Schema(); for (SortSpec spec : sortSpecs) { schema.addColumn(spec.getSortKey()); } return schema; }
private void initKeySortSpecs(final Schema targetRelationSchema, final SortSpec[] keySortSpecs) { this.targetRelationSchema = targetRelationSchema; this.keySortSpecs = new SortSpec[keySortSpecs.length]; for (int i = 0; i < keySortSpecs.length; i++) { this.keySortSpecs[i] = new SortSpec(keySortSpecs[i].getSortKey(), keySortSpecs[i].isAscending(), keySortSpecs[i].isNullsFirst()); } Arrays.sort(this.keySortSpecs, new Comparator<SortSpec>() { @Override public int compare(SortSpec o1, SortSpec o2) { return targetRelationSchema.getColumnId(o1.getSortKey().getSimpleName()) - targetRelationSchema.getColumnId(o2.getSortKey().getSimpleName()); } }); }
public static boolean isVectorizable(SortSpec[] sortKeys) { if (sortKeys.length == 0) { return false; } for (SortSpec spec : sortKeys) { try { vectorType(spec.getSortKey().getDataType().getType()); } catch (Exception e) { return false; } } return true; }
public static boolean isVectorizable(SortSpec[] sortKeys) { if (sortKeys.length == 0) { return false; } for (SortSpec spec : sortKeys) { try { vectorType(spec.getSortKey().getDataType().getType()); } catch (Exception e) { return false; } } return true; }
public IndexScanInfo(TableStats tableStats, IndexDesc indexDesc, SimplePredicate[] predicates) { super(ScanTypeControl.INDEX_SCAN, tableStats); this.indexPath = indexDesc.getIndexPath(); keySchema = new Schema(); this.predicates = predicates; for (SimplePredicate predicate : predicates) { keySchema.addColumn(predicate.getKeySortSpec().getSortKey()); } }
public ComparableVector(int length, SortSpec[] sortKeys, int[] keyIndex) { tuples = new Tuple[length]; vectors = new TupleVector[sortKeys.length]; for (int i = 0; i < vectors.length; i++) { TajoDataTypes.Type type = sortKeys[i].getSortKey().getDataType().getType(); vectors[i] = new TupleVector(vectorType(type), tuples.length, sortKeys[i].isNullsFirst(), sortKeys[i].isAscending()); } this.keyIndex = keyIndex; }
public ComparableVector(int length, SortSpec[] sortKeys, int[] keyIndex) { tuples = new Tuple[length]; vectors = new TupleVector[sortKeys.length]; for (int i = 0; i < vectors.length; i++) { TajoDataTypes.Type type = sortKeys[i].getSortKey().getDataType().getType(); vectors[i] = new TupleVector(vectorType(type), tuples.length, sortKeys[i].isNullsFirst(), sortKeys[i].isAscending()); } this.keyIndex = keyIndex; }