org.apache.kylin.common.util.Array类的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.apache.kylin.common.util.Array类的一些代码示例,展示了Array类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Array类的具体详情如下:
包路径:org.apache.kylin.common.util.Array
类名称:Array

Array介绍

暂无

代码示例

代码示例来源:origin: apache/kylin

private static void collect(String[] row, int[] pi, Set<Array<String>> satisfyingHostRecords) {
  // TODO when go beyond IN_THRESHOLD, only keep min/max is enough
  String[] rec = new String[pi.length];
  for (int i = 0; i < pi.length; i++) {
    rec[i] = row[pi[i]];
  }
  satisfyingHostRecords.add(new Array<String>(rec));
}

代码示例来源:origin: apache/kylin

@Override
public int compareTo(Array<T> other) {
  return compare(this.data, other.data, null);
}

代码示例来源:origin: org.apache.kylin/kylin-invertedindex

private static TableRecordInfoDigest createDigest(int nColumns, boolean[] isMetric, String[] dataTypes, Dictionary<?>[] dictionaries) {
  int[] dictMaxIds = new int[nColumns];
  int[] lengths = new int[nColumns];
  final boolean emptyDictionary = Array.isEmpty(dictionaries);
  for (int i = 0; i < nColumns; ++i) {
    if (isMetric[i]) {

代码示例来源:origin: org.apache.kylin/kylin-invertedindex

lengths[i] = FixedLenMeasureCodec.get(DataType.getType(tblColRef.getColumnDesc().getDatatype())).getLength();
} else {
  if (Array.isEmpty(dictionaryMap)) {
    final DataType dataType = DataType.getType(tblColRef.getColumnDesc().getDatatype());
    if (dataType.isNumberFamily()) {

代码示例来源:origin: apache/kylin

@SuppressWarnings("unchecked")
private void initRow(String[] cols, int[] keyIndex) {
  T[] value = convertRow(cols);
  T[] keyCols = (T[]) java.lang.reflect.Array.newInstance(getType(), keyIndex.length);
  for (int i = 0; i < keyCols.length; i++)
    keyCols[i] = value[keyIndex[i]];
  Array<T> key = new Array<T>(keyCols);
  if (data.containsKey(key))
    throw new IllegalStateException("The table: " + tableDesc.getName() + " Dup key found, key=" + toString(keyCols) + ", value1=" + toString(data.get(key)) + ", value2=" + toString(value));
  data.put(key, value);
}

代码示例来源:origin: KylinOLAP/Kylin

@Override
public int compareTo(Array<T> other) {
  return compare(this.data, other.data, null);
}

代码示例来源:origin: apache/kylin

Array<TblColRef> hostColArray = new Array<TblColRef>(hostCols);
List<DeriveInfo> infoList = hostToDerivedMap.get(hostColArray);
if (infoList == null) {

代码示例来源:origin: org.apache.kylin/kylin-common

@Override
public int compareTo(Array<T> other) {
  return compare(this.data, other.data, null);
}

代码示例来源:origin: apache/kylin

@Test
public void testGet() throws Exception {
  int getNum = 3000;
  List<String[]> keys = Lists.newArrayList();
  for (int i = 0; i < getNum; i++) {
    String[] keyi = new String[] { "keyyyyy" + random.nextInt(sourceRowNum) };
    keys.add(keyi);
  }
  long start = System.currentTimeMillis();
  for (int i = 0; i < getNum; i++) {
    String[] row = lookupTable.getRow(new Array<>(keys.get(i)));
    if (row == null) {
      System.out.println("null value for key:" + Arrays.toString(keys.get(i)));
    }
  }
  long take = System.currentTimeMillis() - start;
  System.out.println("muliti get " + getNum + " rows, take " + take + " ms");
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

@Override
public int compareTo(Array<T> other) {
  return compare(this.data, other.data, null);
}

代码示例来源:origin: apache/kylin

ILookupTable lookupTable = getAndAddLookupTable(cubeSeg, deriveInfo.join);
int[] derivedColIdx = initDerivedColIdx();
Array<String> lookupKey = new Array<String>(new String[hostTmpIdx.length]);

代码示例来源:origin: KylinOLAP/Kylin

private static void collect(String[] row, int[] pi, Set<Array<String>> satisfyingHostRecords) {
  // TODO when go beyond IN_THRESHOLD, only keep min/max is enough
  String[] rec = new String[pi.length];
  for (int i = 0; i < pi.length; i++) {
    rec[i] = row[pi[i]];
  }
  satisfyingHostRecords.add(new Array<String>(rec));
}

代码示例来源:origin: KylinOLAP/Kylin

private void initDerivedMap(TblColRef[] hostCols, DeriveType type, DimensionDesc dimension, TblColRef[] derivedCols, String[] extra) {
  if (hostCols.length == 0 || derivedCols.length == 0)
    throw new IllegalStateException("host/derived columns must not be empty");
  Array<TblColRef> hostColArray = new Array<TblColRef>(hostCols);
  List<DeriveInfo> infoList = hostToDerivedMap.get(hostColArray);
  if (infoList == null) {
    hostToDerivedMap.put(hostColArray, infoList = new ArrayList<DeriveInfo>());
  }
  infoList.add(new DeriveInfo(type, dimension, derivedCols, false));
  for (int i = 0; i < derivedCols.length; i++) {
    TblColRef derivedCol = derivedCols[i];
    boolean isOneToOne = type == DeriveType.PK_FK || ArrayUtils.contains(hostCols, derivedCol) || (extra != null && extra[i].contains("1-1"));
    derivedToHostMap.put(derivedCol, new DeriveInfo(type, dimension, hostCols, isOneToOne));
  }
}

代码示例来源:origin: KylinOLAP/Kylin

private void initDerivedMap(TblColRef[] hostCols, DeriveType type, DimensionDesc dimension, TblColRef[] derivedCols, String[] extra) {
  if (hostCols.length == 0 || derivedCols.length == 0)
    throw new IllegalStateException("host/derived columns must not be empty");
  Array<TblColRef> hostColArray = new Array<TblColRef>(hostCols);
  List<DeriveInfo> infoList = hostToDerivedMap.get(hostColArray);
  if (infoList == null) {
    hostToDerivedMap.put(hostColArray, infoList = new ArrayList<DeriveInfo>());
  }
  infoList.add(new DeriveInfo(type, dimension, derivedCols, false));
  for (int i = 0; i < derivedCols.length; i++) {
    TblColRef derivedCol = derivedCols[i];
    boolean isOneToOne = type == DeriveType.PK_FK || ArrayUtils.contains(hostCols, derivedCol) || (extra != null && extra[i].contains("1-1"));
    derivedToHostMap.put(derivedCol, new DeriveInfo(type, dimension, hostCols, isOneToOne));
  }
}

代码示例来源:origin: KylinOLAP/Kylin

@SuppressWarnings("unchecked")
private void initRow(String[] cols, int[] keyIndex) {
  T[] value = convertRow(cols);
  T[] keyCols = (T[]) java.lang.reflect.Array.newInstance(value[0].getClass(), keyIndex.length);
  for (int i = 0; i < keyCols.length; i++)
    keyCols[i] = value[keyIndex[i]];
  Array<T> key = new Array<T>(keyCols);
  if (data.containsKey(key))
    throw new IllegalStateException("Dup key found, key=" + toString(keyCols) + ", value1=" + toString(data.get(key)) + ", value2=" + toString(value));
  data.put(key, value);
}

代码示例来源:origin: KylinOLAP/Kylin

public LookupFiller(int[] hostIndex, LookupStringTable lookupTable, DeriveInfo deriveInfo, String[] derivedFieldNames) {
  this.hostIndex = hostIndex;
  this.hostLen = hostIndex.length;
  this.lookupKey = new Array<String>(new String[hostLen]);
  this.lookupTable = lookupTable;
  this.derivedIndex = new int[deriveInfo.columns.length];
  this.derivedLen = derivedIndex.length;
  this.derivedFieldNames = derivedFieldNames;
  for (int i = 0; i < derivedLen; i++) {
    derivedIndex[i] = deriveInfo.columns[i].getColumn().getZeroBasedIndex();
  }
}

代码示例来源:origin: KylinOLAP/Kylin

rawKey[i] = new ByteArray(trimSplitBuffer(splitBuffers[tableJoin.fkIndice.get(i)]));
Array<ByteArray> key = new Array<ByteArray>(rawKey);
ByteArray[] dimRow = dimTbl.getRow(key);
if (dimRow == null) {

代码示例来源:origin: KylinOLAP/Kylin

private boolean matchAllCompositeKeys(TreeMap<String, String> lookupCol2FactTableCol, LinkedList<String> columnValues) {
  KylinConfig config = KylinConfig.getInstanceFromEnv();
  for (String lookupTable : lookupTableKeys.keySet()) {
    if (lookupTableKeys.get(lookupTable).size() == 1)
      continue;
    String[] comboKey = new String[lookupTableKeys.get(lookupTable).size()];
    int index = 0;
    for (String column : lookupTableKeys.get(lookupTable)) {
      String key = lookupTable + "/" + column;
      String factTableCol = lookupCol2FactTableCol.get(key);
      int cardinal = MetadataManager.getInstance(config).getTableDesc(factTableName).findColumnByName(factTableCol).getZeroBasedIndex();
      comboKey[index] = columnValues.get(cardinal);
      index++;
    }
    Array<String> wrap = new Array<String>(comboKey);
    if (!lookupTableCompositeKeyValues.get(lookupTable).contains(wrap)) {
      // System.out.println("Try " + wrap + " Failed, continue...");
      return false;
    }
  }
  return true;
}

代码示例来源:origin: KylinOLAP/Kylin

Array<String> wrap = new Array<String>(comboKeys);
if (lookupTableCompositeKeyValues.get(lookupTableName).contains(wrap)) {
  throw new Exception("The composite key already exist in the lookup table");

代码示例来源:origin: KylinOLAP/Kylin

@Test
  public void testBasic() throws Exception {
    TableDesc siteTable = MetadataManager.getInstance(getTestConfig()).getTableDesc("EDW.TEST_SITES");
    TableDesc categoryTable = MetadataManager.getInstance(getTestConfig()).getTableDesc("DEFAULT.test_category_groupings");
    LookupBytesTable lookup;

    System.out.println("============================================================================");

    File f = new File(LOCALMETA_TEST_DATA + "/data/EDW.TEST_SITES.csv");
    lookup = new LookupBytesTable(siteTable, new String[] { "SITE_ID" }, new FileTable("file://" + f.getAbsolutePath(), 10));
    lookup.dump();

    System.out.println("============================================================================");

    f = new File(LOCALMETA_TEST_DATA + "/data/DEFAULT.TEST_CATEGORY_GROUPINGS.csv");
    lookup = new LookupBytesTable(categoryTable, new String[] { "leaf_categ_id", "site_id" }, new FileTable("file://" + f.getAbsolutePath(), 36));
    lookup.dump();

    System.out.println("============================================================================");

    ByteArray k1 = new ByteArray(Bytes.toBytes("533"));
    ByteArray k2 = new ByteArray(Bytes.toBytes("0"));
    Array<ByteArray> key = new Array<ByteArray>(new ByteArray[] { k1, k2 });
    System.out.println(lookup.getRow(key));
  }
}

相关文章

微信公众号

最新文章

更多

Array类方法