Tabnine Logo
MeasureCodec.decode
Code IndexAdd Tabnine to your IDE (free)

How to use
decode
method
in
org.apache.kylin.metadata.measure.MeasureCodec

Best Java code snippets using org.apache.kylin.metadata.measure.MeasureCodec.decode (Showing top 8 results out of 315)

origin: KylinOLAP/Kylin

public void decode(Text bytes, Object[] result) {
  decode(ByteBuffer.wrap(bytes.getBytes(), 0, bytes.getLength()), result);
}
origin: KylinOLAP/Kylin

public void decode(byte[] bytes) {
  codec.decode(ByteBuffer.wrap(bytes), values);
  convertToJavaObjects(values, values);
}
origin: KylinOLAP/Kylin

@Override
public void map(Text key, Text value, Context context) throws IOException, InterruptedException {
  outputKey.set(key.getBytes(), 0, key.getLength());
  KeyValue outputValue;
  int n = keyValueCreators.size();
  if (n == 1 && keyValueCreators.get(0).isFullCopy) { // shortcut for
                            // simple full copy
    outputValue = keyValueCreators.get(0).create(key, value.getBytes(), 0, value.getLength());
    context.write(outputKey, outputValue);
  } else { // normal (complex) case that distributes measures to multiple
       // HBase columns
    inputCodec.decode(value, inputMeasures);
    for (int i = 0; i < n; i++) {
      outputValue = keyValueCreators.get(i).create(key, inputMeasures);
      context.write(outputKey, outputValue);
    }
  }
}
origin: KylinOLAP/Kylin

@Override
public void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
  aggs.reset();
  for (Text value : values) {
    codec.decode(value, input);
    aggs.aggregate(input);
  }
  aggs.collectStates(result);
  valueBuf.clear();
  codec.encode(result, valueBuf);
  outputValue.set(valueBuf.array(), 0, valueBuf.position());
  context.write(key, outputValue);
  counter++;
  if (counter % BatchConstants.COUNTER_MAX == 0) {
    logger.info("Handled " + counter + " records!");
  }
}
origin: KylinOLAP/Kylin

private void verifyMeasures(List<MeasureDesc> measures, Text valueBytes, String m1, String m2, String m3) {
  MeasureCodec codec = new MeasureCodec(measures);
  Object[] values = new Object[measures.size()];
  codec.decode(valueBytes, values);
  assertTrue(new BigDecimal(m1).equals(values[0]));
  assertTrue(new BigDecimal(m2).equals(values[1]));
  assertTrue(new BigDecimal(m3).equals(values[2]));
}
origin: KylinOLAP/Kylin

public void aggregate(MeasureAggregator[] measureAggrs, List<Cell> rowCells) {
  int i = 0;
  for (int ci = 0; ci < nHCols; ci++) {
    HCol col = hcols[ci];
    Cell cell = findCell(col, rowCells);
    if (cell == null) {
      i += col.nMeasures;
      continue;
    }
    ByteBuffer input = ByteBuffer.wrap(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
    col.measureCodec.decode(input, col.measureValues);
    for (int j = 0; j < col.nMeasures; j++)
      measureAggrs[i++].aggregate(col.measureValues[j]);
  }
}
origin: KylinOLAP/Kylin

  fail();
hcol.measureCodec.decode(ByteBuffer.wrap(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()), hcol.measureValues);
origin: KylinOLAP/Kylin

@Test
public void basicTest() {
  MeasureDesc descs[] = new MeasureDesc[] { measure("double"), measure("long"), measure("decimal"), measure("HLLC16"), measure("HLLC16") };
  MeasureCodec codec = new MeasureCodec(descs);
  DoubleWritable d = new DoubleWritable(1.0);
  LongWritable l = new LongWritable(2);
  BigDecimal b = new BigDecimal("333.1234567");
  HyperLogLogPlusCounter hllc = new HyperLogLogPlusCounter(16);
  hllc.add("1234567");
  hllc.add("abcdefg");
  HyperLogLogPlusCounter hllc2 = new HyperLogLogPlusCounter(16);
  hllc.add("1234567");
  hllc.add("abcdefg");
  Object values[] = new Object[] { d, l, b, hllc, hllc2 };
  ByteBuffer buf = ByteBuffer.allocate(RowConstants.ROWVALUE_BUFFER_SIZE);
  codec.encode(values, buf);
  buf.flip();
  System.out.println("size: " + buf.limit());
  Object copy[] = new Object[values.length];
  codec.decode(buf, copy);
  assertTrue(Arrays.equals(values, copy));
}
org.apache.kylin.metadata.measureMeasureCodecdecode

Popular methods of MeasureCodec

  • <init>
  • encode
  • getSerializer
  • init

Popular in Java

  • Making http post requests using okhttp
  • setRequestProperty (URLConnection)
  • getExternalFilesDir (Context)
  • getSharedPreferences (Context)
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JPanel (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Table (org.hibernate.mapping)
    A relational table
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now