Java Code Examples for org.apache.kylin.metadata.model.ColumnDesc#setTable()

The following examples show how to use org.apache.kylin.metadata.model.ColumnDesc#setTable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CoprocessorRowType.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
@Override
public CoprocessorRowType deserialize(ByteBuffer in) {
    int n = BytesUtil.readVInt(in);
    int bodyOffset = BytesUtil.readVInt(in);
    TblColRef[] cols = new TblColRef[n];
    int[] colSizes = new int[n];
    for (int i = 0; i < n; i++) {
        String tableName = BytesUtil.readAsciiString(in);
        String colName = BytesUtil.readAsciiString(in);
        String datatype = BytesUtil.readAsciiString(in);
        TableDesc table = new TableDesc();
        table.setName(tableName);
        ColumnDesc col = new ColumnDesc();
        col.setTable(table);
        col.setName(colName);
        col.setDatatype(datatype);
        col.init(table);
        cols[i] = col.getRef();

        int colSize = BytesUtil.readVInt(in);
        colSizes[i] = colSize;
    }
    return new CoprocessorRowType(cols, colSizes, bodyOffset);
}
 
Example 2
Source File: CoprocessorRowType.java    From kylin with Apache License 2.0 6 votes vote down vote up
@Override
public CoprocessorRowType deserialize(ByteBuffer in) {
    int n = BytesUtil.readVInt(in);
    int bodyOffset = BytesUtil.readVInt(in);
    TblColRef[] cols = new TblColRef[n];
    int[] colSizes = new int[n];
    for (int i = 0; i < n; i++) {
        String tableName = BytesUtil.readAsciiString(in);
        String colName = BytesUtil.readAsciiString(in);
        String datatype = BytesUtil.readAsciiString(in);
        TableDesc table = new TableDesc();
        table.setName(tableName);
        ColumnDesc col = new ColumnDesc();
        col.setTable(table);
        col.setName(colName);
        col.setDatatype(datatype);
        col.init(table);
        cols[i] = col.getRef();

        int colSize = BytesUtil.readVInt(in);
        colSizes[i] = colSize;
    }
    return new CoprocessorRowType(cols, colSizes, bodyOffset);
}
 
Example 3
Source File: ColumnTupleFilter.java    From Kylin with Apache License 2.0 6 votes vote down vote up
@Override
public void deserialize(byte[] bytes) {
    ColumnDesc column = new ColumnDesc();
    ByteBuffer buffer = ByteBuffer.wrap(bytes);
    String tableName = BytesUtil.readUTFString(buffer);
    if (tableName != null) {
        TableDesc table = new TableDesc();
        table.setName(tableName);
        column.setTable(table);
    }

    column.setName(BytesUtil.readUTFString(buffer));
    column.setDatatype(BytesUtil.readUTFString(buffer));

    this.columnRef = new TblColRef(column);
}
 
Example 4
Source File: CoprocessorRowType.java    From Kylin with Apache License 2.0 6 votes vote down vote up
@Override
public CoprocessorRowType deserialize(ByteBuffer in) {
    int n = BytesUtil.readVInt(in);
    TblColRef[] cols = new TblColRef[n];
    int[] colSizes = new int[n];
    for (int i = 0; i < n; i++) {
        String tableName = BytesUtil.readAsciiString(in);
        String colName = BytesUtil.readAsciiString(in);
        TableDesc table = new TableDesc();
        table.setName(tableName);
        ColumnDesc col = new ColumnDesc();
        col.setTable(table);
        col.setName(colName);
        cols[i] = new TblColRef(col);

        int colSize = BytesUtil.readVInt(in);
        colSizes[i] = colSize;
    }
    return new CoprocessorRowType(cols, colSizes);
}
 
Example 5
Source File: StorageTest.java    From Kylin with Apache License 2.0 6 votes vote down vote up
private List<TblColRef> buildGroups() {
    List<TblColRef> groups = new ArrayList<TblColRef>();

    TableDesc t1 = new TableDesc();
    t1.setName("TEST_KYLIN_FACT");
    t1.setDatabase("DEFAULT");
    ColumnDesc c1 = new ColumnDesc();
    c1.setName("CAL_DT");
    c1.setTable(t1);
    c1.setDatatype("string");
    TblColRef cf1 = new TblColRef(c1);
    groups.add(cf1);

    TableDesc t2 = new TableDesc();
    t2.setName("TEST_CATEGORY_GROUPINGS");
    t2.setDatabase("DEFAULT");
    ColumnDesc c2 = new ColumnDesc();
    c2.setName("META_CATEG_NAME");
    c2.setTable(t2);
    c2.setDatatype("string");
    TblColRef cf2 = new TblColRef(c2);
    groups.add(cf2);

    return groups;
}
 
Example 6
Source File: FilterBaseTest.java    From Kylin with Apache License 2.0 6 votes vote down vote up
protected List<TblColRef> buildGroups() {
    List<TblColRef> groups = new ArrayList<TblColRef>();

    TableDesc t1 = new TableDesc();
    t1.setName("TEST_KYLIN_FACT");
    t1.setDatabase("DEFAULT");
    ColumnDesc c1 = new ColumnDesc();
    c1.setName("CAL_DT");
    c1.setDatatype("String");
    c1.setTable(t1);
    TblColRef cf1 = new TblColRef(c1);
    groups.add(cf1);

    TableDesc t2 = new TableDesc();
    t2.setName("TEST_CATEGORY_GROUPINGS");
    t2.setDatabase("DEFAULT");
    ColumnDesc c2 = new ColumnDesc();
    c2.setName("META_CATEG_NAME");
    c1.setDatatype("String");
    c2.setTable(t2);
    TblColRef cf2 = new TblColRef(c2);
    groups.add(cf2);

    return groups;
}
 
Example 7
Source File: FilterSerializeTest.java    From Kylin with Apache License 2.0 6 votes vote down vote up
@Test
public void testSerialize07() {
    TableDesc table = new TableDesc();
    table.setName("TEST_KYLIN_FACT");
    table.setDatabase("DEFAULT");

    ColumnDesc column = new ColumnDesc();
    column.setTable(table);
    TblColRef colRef = new TblColRef(column);
    List<TblColRef> groups = new ArrayList<TblColRef>();
    groups.add(colRef);
    TupleFilter filter = buildCompareFilter(groups, 0);

    byte[] bytes = TupleFilterSerializer.serialize(filter);
    TupleFilter newFilter = TupleFilterSerializer.deserialize(bytes);

    compareFilter(filter, newFilter);
}
 
Example 8
Source File: FilterSerializeTest.java    From Kylin with Apache License 2.0 6 votes vote down vote up
@Test
public void testSerialize08() {
    TableDesc table = new TableDesc();
    table.setDatabase("DEFAULT");

    ColumnDesc column = new ColumnDesc();
    column.setTable(table);
    TblColRef colRef = new TblColRef(column);
    List<TblColRef> groups = new ArrayList<TblColRef>();
    groups.add(colRef);
    TupleFilter filter = buildCompareFilter(groups, 0);

    byte[] bytes = TupleFilterSerializer.serialize(filter);
    TupleFilter newFilter = TupleFilterSerializer.deserialize(bytes);

    compareFilter(filter, newFilter);
}
 
Example 9
Source File: FilterSerializeTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testSerialize07() {
    TableDesc table = new TableDesc();
    table.setName("TEST_KYLIN_FACT");
    table.setDatabase("DEFAULT");

    ColumnDesc column = new ColumnDesc();
    column.setTable(table);
    TblColRef colRef = column.getRef();
    List<TblColRef> groups = new ArrayList<TblColRef>();
    groups.add(colRef);

    assertFilterSerDe(buildEQCompareFilter(groups, 0));
}
 
Example 10
Source File: FilterSerializeTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testSerialize08() {
    TableDesc table = new TableDesc();
    table.setDatabase("DEFAULT");

    ColumnDesc column = new ColumnDesc();
    column.setTable(table);
    TblColRef colRef = column.getRef();
    List<TblColRef> groups = new ArrayList<TblColRef>();
    groups.add(colRef);

    assertFilterSerDe(buildEQCompareFilter(groups, 0));
}
 
Example 11
Source File: FilterSerializeTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testSerialize07() {
    TableDesc table = new TableDesc();
    table.setName("TEST_KYLIN_FACT");
    table.setDatabase("DEFAULT");

    ColumnDesc column = new ColumnDesc();
    column.setTable(table);
    TblColRef colRef = column.getRef();
    List<TblColRef> groups = new ArrayList<TblColRef>();
    groups.add(colRef);

    assertFilterSerDe(buildEQCompareFilter(groups, 0));
}
 
Example 12
Source File: FilterSerializeTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testSerialize08() {
    TableDesc table = new TableDesc();
    table.setDatabase("DEFAULT");

    ColumnDesc column = new ColumnDesc();
    column.setTable(table);
    TblColRef colRef = column.getRef();
    List<TblColRef> groups = new ArrayList<TblColRef>();
    groups.add(colRef);

    assertFilterSerDe(buildEQCompareFilter(groups, 0));
}
 
Example 13
Source File: AggregateRegionObserverTest.java    From Kylin with Apache License 2.0 4 votes vote down vote up
private TblColRef newCol(String name, TableDesc t) {
    ColumnDesc col = new ColumnDesc();
    col.setName(name);
    col.setTable(t);
    return new TblColRef(col);
}