Java Code Examples for org.apache.kylin.metadata.model.DataModelDesc#getJoinByPKSide()
The following examples show how to use
org.apache.kylin.metadata.model.DataModelDesc#getJoinByPKSide() .
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: LookupTableToHFileJob.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private String[] getLookupKeyColumns(CubeInstance cube, String tableName) { CubeDesc cubeDesc = cube.getDescriptor(); DataModelDesc modelDesc = cubeDesc.getModel(); TableRef lookupTableRef = null; for (TableRef tableRef : modelDesc.getLookupTables()) { if (tableRef.getTableIdentity().equalsIgnoreCase(tableName)) { lookupTableRef = tableRef; break; } } if (lookupTableRef == null) { throw new IllegalStateException("cannot find table in model:" + tableName); } JoinDesc joinDesc = modelDesc.getJoinByPKSide(lookupTableRef); TblColRef[] keyColRefs = joinDesc.getPrimaryKeyColumns(); String[] result = new String[keyColRefs.length]; for (int i = 0; i < keyColRefs.length; i++) { result[i] = keyColRefs[i].getName(); } return result; }
Example 2
Source File: LookupTableToHFileJob.java From kylin with Apache License 2.0 | 6 votes |
private String[] getLookupKeyColumns(CubeInstance cube, String tableName) { CubeDesc cubeDesc = cube.getDescriptor(); DataModelDesc modelDesc = cubeDesc.getModel(); TableRef lookupTableRef = null; for (TableRef tableRef : modelDesc.getLookupTables()) { if (tableRef.getTableIdentity().equalsIgnoreCase(tableName)) { lookupTableRef = tableRef; break; } } if (lookupTableRef == null) { throw new IllegalStateException("cannot find table in model:" + tableName); } JoinDesc joinDesc = modelDesc.getJoinByPKSide(lookupTableRef); TblColRef[] keyColRefs = joinDesc.getPrimaryKeyColumns(); String[] result = new String[keyColRefs.length]; for (int i = 0; i < keyColRefs.length; i++) { result[i] = keyColRefs[i].getName(); } return result; }
Example 3
Source File: LookupTableToHFileMapper.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
@Override protected void doSetup(Context context) throws IOException { super.bindCurrentConfiguration(context.getConfiguration()); cubeName = context.getConfiguration().get(BatchConstants.CFG_CUBE_NAME); tableName = context.getConfiguration().get(BatchConstants.CFG_TABLE_NAME); shardNum = Integer.parseInt(context.getConfiguration().get(BatchConstants.CFG_SHARD_NUM)); KylinConfig config = AbstractHadoopJob.loadKylinPropsAndMetadata(); CubeManager cubeMgr = CubeManager.getInstance(config); cubeDesc = cubeMgr.getCube(cubeName).getDescriptor(); DataModelDesc modelDesc = cubeDesc.getModel(); TableDesc tableDesc = TableMetadataManager.getInstance(KylinConfig.getInstanceFromEnv()).getTableDesc( tableName, cubeDesc.getProject()); TableRef lookupTableRef = null; for (TableRef tableRef : modelDesc.getLookupTables()) { if (tableRef.getTableIdentity().equalsIgnoreCase(tableName)) { lookupTableRef = tableRef; break; } } JoinDesc joinDesc = modelDesc.getJoinByPKSide(lookupTableRef); TblColRef[] keyColRefs = joinDesc.getPrimaryKeyColumns(); String[] keyColumns = new String[keyColRefs.length]; for (int i = 0; i < keyColRefs.length; i++) { keyColumns[i] = keyColRefs[i].getName(); } encoder = new HBaseLookupRowEncoder(tableDesc, keyColumns, shardNum); Configuration conf = context.getConfiguration(); lookupTableInputFormat = MRUtil.getTableInputFormat(tableDesc, conf.get(BatchConstants.ARG_CUBING_JOB_ID)); }
Example 4
Source File: LookupTableToHFileMapper.java From kylin with Apache License 2.0 | 5 votes |
@Override protected void doSetup(Context context) throws IOException { super.bindCurrentConfiguration(context.getConfiguration()); cubeName = context.getConfiguration().get(BatchConstants.CFG_CUBE_NAME); tableName = context.getConfiguration().get(BatchConstants.CFG_TABLE_NAME); shardNum = Integer.parseInt(context.getConfiguration().get(BatchConstants.CFG_SHARD_NUM)); KylinConfig config = AbstractHadoopJob.loadKylinPropsAndMetadata(); CubeManager cubeMgr = CubeManager.getInstance(config); cubeDesc = cubeMgr.getCube(cubeName).getDescriptor(); DataModelDesc modelDesc = cubeDesc.getModel(); TableDesc tableDesc = TableMetadataManager.getInstance(KylinConfig.getInstanceFromEnv()).getTableDesc( tableName, cubeDesc.getProject()); TableRef lookupTableRef = null; for (TableRef tableRef : modelDesc.getLookupTables()) { if (tableRef.getTableIdentity().equalsIgnoreCase(tableName)) { lookupTableRef = tableRef; break; } } JoinDesc joinDesc = modelDesc.getJoinByPKSide(lookupTableRef); TblColRef[] keyColRefs = joinDesc.getPrimaryKeyColumns(); String[] keyColumns = new String[keyColRefs.length]; for (int i = 0; i < keyColRefs.length; i++) { keyColumns[i] = keyColRefs[i].getName(); } encoder = new HBaseLookupRowEncoder(tableDesc, keyColumns, shardNum); Configuration conf = context.getConfiguration(); lookupTableInputFormat = MRUtil.getTableInputFormat(tableDesc, conf.get(BatchConstants.ARG_CUBING_JOB_ID)); }