carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jackylk <...@git.apache.org>
Subject [GitHub] carbondata pull request #1102: [CARBONDATA-1098] Change page statistics use ...
Date Mon, 10 Jul 2017 13:56:07 GMT
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1102#discussion_r126428058
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/EncodedMeasurePage.java
---
    @@ -0,0 +1,88 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.carbondata.core.datastore.page.encoding;
    +
    +import java.io.IOException;
    +import java.nio.ByteBuffer;
    +import java.util.ArrayList;
    +import java.util.List;
    +
    +import org.apache.carbondata.core.datastore.compression.Compressor;
    +import org.apache.carbondata.core.datastore.compression.CompressorFactory;
    +import org.apache.carbondata.core.datastore.page.EncodedTablePage;
    +import org.apache.carbondata.core.metadata.ValueEncoderMeta;
    +import org.apache.carbondata.core.util.CarbonMetadataUtil;
    +import org.apache.carbondata.format.BlockletMinMaxIndex;
    +import org.apache.carbondata.format.DataChunk2;
    +import org.apache.carbondata.format.DataChunk3;
    +import org.apache.carbondata.format.Encoding;
    +import org.apache.carbondata.format.PresenceMeta;
    +
    +/**
    + * Encoded measure page that include data and statistics
    + */
    +public class EncodedMeasurePage extends EncodedColumnPage {
    +
    +  private ValueEncoderMeta metaData;
    +
    +  public EncodedMeasurePage(int pageSize, byte[] encodedData, ValueEncoderMeta metaData)
{
    +    super(pageSize, encodedData);
    +    this.metaData = metaData;
    +    this.dataChunk2 = buildDataChunk2();
    +  }
    +
    +  @Override
    +  public DataChunk2 buildDataChunk2() {
    +    DataChunk2 dataChunk = new DataChunk2();
    +    dataChunk.min_max = new BlockletMinMaxIndex();
    +    dataChunk.setChunk_meta(CarbonMetadataUtil.getSnappyChunkCompressionMeta());
    +    dataChunk.setNumberOfRowsInpage(pageSize);
    +    dataChunk.setData_page_length(encodedData.length);
    +    dataChunk.setRowMajor(false);
    +    // TODO : Change as per this encoders.
    +    List<Encoding> encodings = new ArrayList<Encoding>();
    +    encodings.add(Encoding.DELTA);
    +    dataChunk.setEncoders(encodings);
    +    PresenceMeta presenceMeta = new PresenceMeta();
    +    presenceMeta.setPresent_bit_streamIsSet(true);
    +    Compressor compressor = CompressorFactory.getInstance().getCompressor();
    +    presenceMeta.setPresent_bit_stream(
    +        compressor.compressByte(metaData.getNullBitSet().toByteArray()));
    +    dataChunk.setPresence(presenceMeta);
    +    List<ByteBuffer> encoderMetaList = new ArrayList<ByteBuffer>();
    +    encoderMetaList.add(
    +        ByteBuffer.wrap(metaData.serialize()));
    +    dataChunk.setEncoder_meta(encoderMetaList);
    +    dataChunk.min_max.addToMax_values(ByteBuffer.wrap(metaData.getMaxAsBytes()));
    +    dataChunk.min_max.addToMin_values(ByteBuffer.wrap(metaData.getMinAsBytes()));
    +    return dataChunk;
    +  }
    +
    +  public static DataChunk3 getDataChunk3(List<EncodedTablePage> encodedTablePageList,
    --- End diff --
    
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message