org.apache.kylin.common.util.ClassUtil Java Examples
The following examples show how to use
org.apache.kylin.common.util.ClassUtil.
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: SandboxMetastoreCLI.java From kylin with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { System.setProperty("HADOOP_USER_NAME", "root"); logger.info("Adding to classpath: " + new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath()); ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath()); System.setProperty(KylinConfig.KYLIN_CONF, HBaseMetadataTestCase.SANDBOX_TEST_DATA); if (StringUtils.isEmpty(System.getProperty("hdp.version"))) { throw new RuntimeException("No hdp.version set; Please set hdp.version in your jvm option, for example: -Dhdp.version=2.4.0.0-169"); } if (args.length < 1) { printUsage(); return; } if ("reset".equalsIgnoreCase(args[0])) { ResourceTool.main(new String[] { "reset" }); } else if ("download".equalsIgnoreCase(args[0])) { ResourceTool.main(new String[] { "download", args[1] }); } else if ("fetch".equalsIgnoreCase(args[0])) { ResourceTool.main(new String[] { "fetch", args[1], args[2] }); } else if ("upload".equalsIgnoreCase(args[0])) { ResourceTool.main(new String[] { "upload", args[1] }); } else { printUsage(); } }
Example #2
Source File: RealizationRegistry.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private void init() { providers = Maps.newConcurrentMap(); // use reflection to load providers String[] providerNames = config.getRealizationProviders(); for (String clsName : providerNames) { try { Class<? extends IRealizationProvider> cls = ClassUtil.forName(clsName, IRealizationProvider.class); IRealizationProvider p = (IRealizationProvider) cls.getMethod("getInstance", KylinConfig.class).invoke(null, config); providers.put(p.getRealizationType(), p); } catch (Exception | NoClassDefFoundError e) { if (e instanceof ClassNotFoundException || e instanceof NoClassDefFoundError) logger.warn("Failed to create realization provider " + e); else logger.error("Failed to create realization provider", e); } } if (providers.isEmpty()) throw new IllegalArgumentException("Failed to find realization provider by url: " + config.getMetadataUrl()); logger.info("RealizationRegistry is " + providers); }
Example #3
Source File: SampleCubeSetupTest.java From Kylin with Apache License 2.0 | 6 votes |
@Before public void before() throws Exception { String confPaths = System.getenv("KYLIN_HBASE_CONF_PATH"); System.out.println("The conf paths is " + confPaths); if (confPaths != null) { String[] paths = confPaths.split(":"); for (String path : paths) { if (!StringUtils.isEmpty(path)) { try { ClassUtil.addClasspath(new File(path).getAbsolutePath()); } catch (Exception e) { System.out.println(e.getLocalizedMessage()); System.out.println(e.getStackTrace()); } } } } }
Example #4
Source File: ExecutableManager.java From Kylin with Apache License 2.0 | 6 votes |
private static AbstractExecutable parseTo(ExecutablePO executablePO) { if (executablePO == null) { return null; } String type = executablePO.getType(); try { Class<? extends AbstractExecutable> clazz = ClassUtil.forName(type, AbstractExecutable.class); Constructor<? extends AbstractExecutable> constructor = clazz.getConstructor(); AbstractExecutable result = constructor.newInstance(); result.setId(executablePO.getUuid()); result.setName(executablePO.getName()); result.setParams(executablePO.getParams()); List<ExecutablePO> tasks = executablePO.getTasks(); if (tasks != null && !tasks.isEmpty()) { Preconditions.checkArgument(result instanceof DefaultChainedExecutable); for (ExecutablePO subTask: tasks) { ((DefaultChainedExecutable) result).addTask(parseTo(subTask)); } } return result; } catch (ReflectiveOperationException e) { throw new IllegalArgumentException("cannot parse this job:" + executablePO.getId(), e); } }
Example #5
Source File: RemoveBlackoutRealizationsRule.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private static IRealizationFilter getFilterImpl(KylinConfig conf) { IRealizationFilter filter = filters.get(conf); if (filter == null) { synchronized (RemoveBlackoutRealizationsRule.class) { try { Class<? extends IRealizationFilter> clz = ClassUtil.forName(conf.getQueryRealizationFilter(), IRealizationFilter.class); filter = clz.getConstructor(KylinConfig.class).newInstance(conf); } catch (Exception e) { throw new RuntimeException(e); } filters.put(conf, filter); } } return filter; }
Example #6
Source File: PartitionDesc.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public void init(DataModelDesc model) { if (StringUtils.isEmpty(partitionDateColumn)) return; //Support CustomYearMonthDayFieldPartitionConditionBuilder, partitionDateColumn split by "," partitionConditionBuilder = (IPartitionConditionBuilder) ClassUtil.newInstance(partitionConditionBuilderClz); if (partitionConditionBuilder instanceof CustomYearMonthDayFieldPartitionConditionBuilder) { ((CustomYearMonthDayFieldPartitionConditionBuilder)partitionConditionBuilder).init(this, model); } else { partitionDateColumnRef = model.findColumn(partitionDateColumn); partitionDateColumn = partitionDateColumnRef.getIdentity(); if (StringUtils.isBlank(partitionTimeColumn) == false) { partitionTimeColumnRef = model.findColumn(partitionTimeColumn); partitionTimeColumn = partitionTimeColumnRef.getIdentity(); } } }
Example #7
Source File: ResourceStore.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private static ResourceStore createResourceStore(KylinConfig kylinConfig) { StorageURL metadataUrl = kylinConfig.getMetadataUrl(); logger.info("Using metadata url {} for resource store", metadataUrl); String clsName = kylinConfig.getResourceStoreImpls().get(metadataUrl.getScheme()); try { Class<? extends ResourceStore> cls = ClassUtil.forName(clsName, ResourceStore.class); ResourceStore store = cls.getConstructor(KylinConfig.class).newInstance(kylinConfig); if (!store.exists(METASTORE_UUID_TAG)) { store.checkAndPutResource(METASTORE_UUID_TAG, new StringEntity(store.createMetaStoreUUID()), 0, StringEntity.serializer); } return store; } catch (Throwable e) { throw new IllegalArgumentException("Failed to find metadata store by url: " + metadataUrl, e); } }
Example #8
Source File: DictionaryManager.java From kylin with Apache License 2.0 | 6 votes |
private Dictionary<String> buildDictFromReadableTable(IReadableTable inpTable, DictionaryInfo dictInfo, String builderClass, TblColRef col) throws IOException { Dictionary<String> dictionary; IDictionaryValueEnumerator columnValueEnumerator = null; try { columnValueEnumerator = new TableColumnValueEnumerator(inpTable.getReader(), dictInfo.getSourceColumnIndex()); if (builderClass == null) { dictionary = DictionaryGenerator.buildDictionary(DataType.getType(dictInfo.getDataType()), columnValueEnumerator); } else { IDictionaryBuilder builder = (IDictionaryBuilder) ClassUtil.newInstance(builderClass); dictionary = DictionaryGenerator.buildDictionary(builder, dictInfo, columnValueEnumerator); } } catch (Exception ex) { throw new RuntimeException("Failed to create dictionary on " + col, ex); } finally { if (columnValueEnumerator != null) columnValueEnumerator.close(); } return dictionary; }
Example #9
Source File: DictionaryManager.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private Dictionary<String> buildDictFromReadableTable(IReadableTable inpTable, DictionaryInfo dictInfo, String builderClass, TblColRef col) throws IOException { Dictionary<String> dictionary; IDictionaryValueEnumerator columnValueEnumerator = null; try { columnValueEnumerator = new TableColumnValueEnumerator(inpTable.getReader(), dictInfo.getSourceColumnIndex()); if (builderClass == null) { dictionary = DictionaryGenerator.buildDictionary(DataType.getType(dictInfo.getDataType()), columnValueEnumerator); } else { IDictionaryBuilder builder = (IDictionaryBuilder) ClassUtil.newInstance(builderClass); dictionary = DictionaryGenerator.buildDictionary(builder, dictInfo, columnValueEnumerator); } } catch (Exception ex) { throw new RuntimeException("Failed to create dictionary on " + col, ex); } finally { if (columnValueEnumerator != null) columnValueEnumerator.close(); } return dictionary; }
Example #10
Source File: PartitionDesc.java From kylin with Apache License 2.0 | 6 votes |
public void init(DataModelDesc model) { if (StringUtils.isEmpty(partitionDateColumn)) return; //Support CustomYearMonthDayFieldPartitionConditionBuilder, partitionDateColumn split by "," partitionConditionBuilder = (IPartitionConditionBuilder) ClassUtil.newInstance(partitionConditionBuilderClz); if (partitionConditionBuilder instanceof CustomYearMonthDayFieldPartitionConditionBuilder) { ((CustomYearMonthDayFieldPartitionConditionBuilder)partitionConditionBuilder).init(this, model); } else { partitionDateColumnRef = model.findColumn(partitionDateColumn); partitionDateColumn = partitionDateColumnRef.getIdentity(); if (StringUtils.isBlank(partitionTimeColumn) == false) { partitionTimeColumnRef = model.findColumn(partitionTimeColumn); partitionTimeColumn = partitionTimeColumnRef.getIdentity(); } } }
Example #11
Source File: SandboxMetastoreCLI.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { System.setProperty("HADOOP_USER_NAME", "root"); logger.info("Adding to classpath: " + new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath()); ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath()); System.setProperty(KylinConfig.KYLIN_CONF, HBaseMetadataTestCase.SANDBOX_TEST_DATA); if (StringUtils.isEmpty(System.getProperty("hdp.version"))) { throw new RuntimeException("No hdp.version set; Please set hdp.version in your jvm option, for example: -Dhdp.version=2.4.0.0-169"); } if (args.length < 1) { printUsage(); return; } if ("reset".equalsIgnoreCase(args[0])) { ResourceTool.main(new String[] { "reset" }); } else if ("download".equalsIgnoreCase(args[0])) { ResourceTool.main(new String[] { "download", args[1] }); } else if ("fetch".equalsIgnoreCase(args[0])) { ResourceTool.main(new String[] { "fetch", args[1], args[2] }); } else if ("upload".equalsIgnoreCase(args[0])) { ResourceTool.main(new String[] { "upload", args[1] }); } else { printUsage(); } }
Example #12
Source File: RealizationRegistry.java From kylin with Apache License 2.0 | 6 votes |
private void init() { providers = Maps.newConcurrentMap(); // use reflection to load providers String[] providerNames = config.getRealizationProviders(); for (String clsName : providerNames) { try { Class<? extends IRealizationProvider> cls = ClassUtil.forName(clsName, IRealizationProvider.class); IRealizationProvider p = (IRealizationProvider) cls.getMethod("getInstance", KylinConfig.class).invoke(null, config); providers.put(p.getRealizationType(), p); } catch (Exception | NoClassDefFoundError e) { if (e instanceof ClassNotFoundException || e instanceof NoClassDefFoundError) logger.warn("Failed to create realization provider " + e); else logger.error("Failed to create realization provider", e); } } if (providers.isEmpty()) throw new IllegalArgumentException("Failed to find realization provider by url: " + config.getMetadataUrl()); logger.info("RealizationRegistry is " + providers); }
Example #13
Source File: RemoveBlackoutRealizationsRule.java From kylin with Apache License 2.0 | 6 votes |
private static IRealizationFilter getFilterImpl(KylinConfig conf) { IRealizationFilter filter = filters.get(conf); if (filter == null) { synchronized (RemoveBlackoutRealizationsRule.class) { try { Class<? extends IRealizationFilter> clz = ClassUtil.forName(conf.getQueryRealizationFilter(), IRealizationFilter.class); filter = clz.getConstructor(KylinConfig.class).newInstance(conf); } catch (Exception e) { throw new RuntimeException(e); } filters.put(conf, filter); } } return filter; }
Example #14
Source File: QueryUtil.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
static void initPushDownConvertersIfNeeded(KylinConfig kylinConfig) { String[] currentConverters = pushDownConverters.stream().map(Object::getClass).map(Class::getCanonicalName) .toArray(String[]::new); String[] configConverters = kylinConfig.getPushDownConverterClassNames(); boolean skipInit = Objects.deepEquals(currentConverters, configConverters); if (skipInit) { return; } List<IPushDownConverter> converters = Lists.newArrayList(); for (String clz : configConverters) { try { IPushDownConverter converter = (IPushDownConverter) ClassUtil.newInstance(clz); converters.add(converter); } catch (Exception e) { throw new IllegalStateException("Failed to init pushdown converter", e); } } pushDownConverters = Collections.unmodifiableList(converters); }
Example #15
Source File: ResourceStore.java From kylin with Apache License 2.0 | 6 votes |
private static ResourceStore createResourceStore(KylinConfig kylinConfig) { StorageURL metadataUrl = kylinConfig.getMetadataUrl(); logger.info("Using metadata url {} for resource store", metadataUrl); String clsName = kylinConfig.getResourceStoreImpls().get(metadataUrl.getScheme()); try { Class<? extends ResourceStore> cls = ClassUtil.forName(clsName, ResourceStore.class); ResourceStore store = cls.getConstructor(KylinConfig.class).newInstance(kylinConfig); if (!store.exists(METASTORE_UUID_TAG)) { store.checkAndPutResource(METASTORE_UUID_TAG, new StringEntity(store.createMetaStoreUUID()), 0, StringEntity.serializer); } return store; } catch (Throwable e) { throw new IllegalArgumentException("Failed to find metadata store by url: " + metadataUrl, e); } }
Example #16
Source File: DataModelManager.java From kylin with Apache License 2.0 | 5 votes |
static DataModelManager newInstance(KylinConfig conf) { try { String cls = StringUtil.noBlank(conf.getDataModelManagerImpl(), DataModelManager.class.getName()); Class<? extends DataModelManager> clz = ClassUtil.forName(cls, DataModelManager.class); return clz.getConstructor(KylinConfig.class).newInstance(conf); } catch (Exception e) { throw new RuntimeException("Failed to init DataModelManager from " + conf, e); } }
Example #17
Source File: GlobalDictHDFSStore.java From kylin with Apache License 2.0 | 5 votes |
@Override public GlobalDictMetadata readIndexFile(Path dir) throws IOException { Path indexFile = new Path(dir, V1_INDEX_NAME); try (FSDataInputStream in = fs.open(indexFile)) { int baseId = in.readInt(); int maxId = in.readInt(); int maxValueLength = in.readInt(); int nValues = in.readInt(); String converterName = in.readUTF(); BytesConverter converter; try { converter = ClassUtil.forName(converterName, BytesConverter.class).getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException("Fail to instantiate BytesConverter: " + converterName, e); } int nSlices = in.readInt(); TreeMap<AppendDictSliceKey, String> sliceFileMap = new TreeMap<>(); for (int i = 0; i < nSlices; i++) { AppendDictSliceKey key = new AppendDictSliceKey(); key.readFields(in); sliceFileMap.put(key, sliceFileName(key)); } // make sure first key is always "" String firstFile = sliceFileMap.remove(sliceFileMap.firstKey()); sliceFileMap.put(AppendDictSliceKey.START_KEY, firstFile); return new GlobalDictMetadata(baseId, maxId, maxValueLength, nValues, converter, sliceFileMap); } }
Example #18
Source File: DataModelManager.java From kylin with Apache License 2.0 | 5 votes |
private Class<DataModelDesc> getDataModelImplClass() { try { String cls = StringUtil.noBlank(config.getDataModelImpl(), DataModelDesc.class.getName()); Class<? extends DataModelDesc> clz = ClassUtil.forName(cls, DataModelDesc.class); return (Class<DataModelDesc>) clz; } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
Example #19
Source File: UHCDictionaryReducer.java From kylin with Apache License 2.0 | 5 votes |
@Override protected void doSetup(Context context) throws IOException { super.bindCurrentConfiguration(context.getConfiguration()); Configuration conf = context.getConfiguration(); mos = new MultipleOutputs(context); KylinConfig config = AbstractHadoopJob.loadKylinPropsAndMetadata(); String cubeName = conf.get(BatchConstants.CFG_CUBE_NAME); CubeInstance cube = CubeManager.getInstance(config).getCube(cubeName); CubeDesc cubeDesc = cube.getDescriptor(); List<TblColRef> uhcColumns = cubeDesc.getAllUHCColumns(); int taskId = context.getTaskAttemptID().getTaskID().getId(); col = uhcColumns.get(taskId); logger.info("column name: " + col.getIdentity()); if (cube.getDescriptor().getShardByColumns().contains(col)) { //for ShardByColumns builder = DictionaryGenerator.newDictionaryBuilder(col.getType()); builder.init(null, 0, null); } else { //for GlobalDictionaryColumns String hdfsDir = conf.get(BatchConstants.CFG_GLOBAL_DICT_BASE_DIR); DictionaryInfo dictionaryInfo = new DictionaryInfo(col.getColumnDesc(), col.getDatatype()); String builderClass = cubeDesc.getDictionaryBuilderClass(col); builder = (IDictionaryBuilder) ClassUtil.newInstance(builderClass); builder.init(dictionaryInfo, 0, hdfsDir); } }
Example #20
Source File: GlobalDictHDFSStore.java From kylin with Apache License 2.0 | 5 votes |
@Override public GlobalDictMetadata readIndexFile(Path dir) throws IOException { Path indexFile = new Path(dir, V2_INDEX_NAME); try (FSDataInputStream in = fs.open(indexFile)) { byte minorVersion = in.readByte(); // include a header to allow minor format changes if (minorVersion != MINOR_VERSION_V1) { throw new RuntimeException("Unsupported minor version " + minorVersion); } int baseId = in.readInt(); int maxId = in.readInt(); int maxValueLength = in.readInt(); int nValues = in.readInt(); String converterName = in.readUTF(); BytesConverter converter; try { converter = ClassUtil.forName(converterName, BytesConverter.class).getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException("Fail to instantiate BytesConverter: " + converterName, e); } int nSlices = in.readInt(); TreeMap<AppendDictSliceKey, String> sliceFileMap = new TreeMap<>(); for (int i = 0; i < nSlices; i++) { AppendDictSliceKey key = new AppendDictSliceKey(); key.readFields(in); String sliceFileName = in.readUTF(); sliceFileMap.put(key, sliceFileName); } return new GlobalDictMetadata(baseId, maxId, maxValueLength, nValues, converter, sliceFileMap); } }
Example #21
Source File: NumberDictionary.java From kylin with Apache License 2.0 | 5 votes |
@Override protected void setConverterByName(String converterName) throws Exception { this.bytesConvert = ClassUtil.forName("org.apache.kylin.dict.Number2BytesConverter", BytesConverter.class).getDeclaredConstructor() .newInstance(); ((Number2BytesConverter) this.bytesConvert) .setMaxDigitsBeforeDecimalPoint(Number2BytesConverter.MAX_DIGITS_BEFORE_DECIMAL_POINT_LEGACY); }
Example #22
Source File: ExternalAclProvider.java From kylin with Apache License 2.0 | 5 votes |
public static ExternalAclProvider getInstance() { if (singleton == null) { synchronized (ExternalAclProvider.class) { if (singleton == null) { String cls = KylinConfig.getInstanceFromEnv().getExternalAclProvider(); if (!StringUtils.isBlank(cls)) { singleton = (ExternalAclProvider) ClassUtil.newInstance(cls); singleton.init(); } } } } return singleton; }
Example #23
Source File: TrieDictionary.java From Kylin with Apache License 2.0 | 5 votes |
private void init(byte[] trieBytes) { this.trieBytes = trieBytes; if (BytesUtil.compareBytes(HEAD_MAGIC, 0, trieBytes, 0, HEAD_MAGIC.length) != 0) throw new IllegalArgumentException("Wrong file type (magic does not match)"); try { DataInputStream headIn = new DataInputStream( // new ByteArrayInputStream(trieBytes, HEAD_SIZE_I, trieBytes.length - HEAD_SIZE_I)); this.headSize = headIn.readShort(); this.bodyLen = headIn.readInt(); this.sizeChildOffset = headIn.read(); this.sizeNoValuesBeneath = headIn.read(); this.baseId = headIn.readShort(); this.maxValueLength = headIn.readShort(); String converterName = headIn.readUTF(); if (converterName.isEmpty() == false) this.bytesConvert = (BytesConverter<T>) ClassUtil.forName(converterName, BytesConverter.class).newInstance(); this.nValues = BytesUtil.readUnsigned(trieBytes, headSize + sizeChildOffset, sizeNoValuesBeneath); this.sizeOfId = BytesUtil.sizeForValue(baseId + nValues + 1); // note baseId could raise 1 byte in ID space, +1 to reserve all 0xFF for NULL case this.childOffsetMask = ~((BIT_IS_LAST_CHILD | BIT_IS_END_OF_VALUE) << ((sizeChildOffset - 1) * 8)); this.firstByteOffset = sizeChildOffset + sizeNoValuesBeneath + 1; // the offset from begin of node to its first value byte } catch (Exception e) { if (e instanceof RuntimeException) throw (RuntimeException) e; else throw new RuntimeException(e); } if (enableCache) { valueToIdCache = new SoftReference<HashMap>(new HashMap()); idToValueCache = new SoftReference<Object[]>(new Object[nValues]); } }
Example #24
Source File: Segments.java From kylin with Apache License 2.0 | 5 votes |
public static ISegmentAdvisor newSegmentAdvisor(ISegment seg) { try { Class<? extends ISegmentAdvisor> clz = ClassUtil.forName(seg.getConfig().getSegmentAdvisor(), ISegmentAdvisor.class); return clz.getConstructor(ISegment.class).newInstance(seg); } catch (Exception e) { throw new RuntimeException(e); } }
Example #25
Source File: QueryUtil.java From kylin with Apache License 2.0 | 5 votes |
private static void initQueryTransformers() { List<IQueryTransformer> transformers = Lists.newArrayList(); String[] classes = KylinConfig.getInstanceFromEnv().getQueryTransformers(); for (String clz : classes) { try { IQueryTransformer t = (IQueryTransformer) ClassUtil.newInstance(clz); transformers.add(t); } catch (Exception e) { throw new IllegalStateException("Failed to init query transformer", e); } } queryTransformers = transformers; }
Example #26
Source File: PushDownExecutor.java From kylin with Apache License 2.0 | 5 votes |
public Pair<List<List<String>>, List<SelectedColumnMeta>> pushDownQuery(String project, String sql, String defaultSchema, SQLException sqlException, boolean isSelect, boolean isPrepare) throws Exception { if (!kylinConfig.isPushDownEnabled()) { return null; } if (isSelect) { logger.info("Query failed to utilize pre-calculation, routing to other engines", sqlException); if (!isExpectedCause(sqlException)) { logger.info("quit doPushDownQuery because prior exception thrown is unexpected"); return null; } } else { Preconditions.checkState(sqlException == null); logger.info("Kylin cannot support non-select queries, routing to other engines"); } List<String> ids = kylinConfig.getPushDownRunnerIds(); if (ids.isEmpty() && StringUtils.isNotEmpty(kylinConfig.getPushDownRunnerClassName())) { IPushDownRunner runner = (IPushDownRunner) ClassUtil.newInstance( kylinConfig.getPushDownRunnerClassName() ); runner.init(kylinConfig); return queryBySingleRunner(runner, project, sql, defaultSchema, sqlException, isSelect, isPrepare); } else { return queryByMultiJdbcRunners(ids, project, sql, defaultSchema, sqlException, isSelect, isPrepare); } }
Example #27
Source File: OLAPToEnumerableConverter.java From kylin with Apache License 2.0 | 5 votes |
protected void doAccessControl(List<OLAPContext> contexts) { KylinConfig config = KylinConfig.getInstanceFromEnv(); String controllerCls = config.getQueryAccessController(); if (null != controllerCls && !controllerCls.isEmpty()) { OLAPContext.IAccessController accessController = (OLAPContext.IAccessController) ClassUtil.newInstance(controllerCls); accessController.check(contexts, config); } }
Example #28
Source File: BuildCubeWithEngineTest.java From Kylin with Apache License 2.0 | 5 votes |
@BeforeClass public static void beforeClass() throws Exception { logger.info("Adding to classpath: " + new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath()); ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath()); System.setProperty(KylinConfig.KYLIN_CONF, "../examples/test_case_data/sandbox"); System.setProperty("hdp.version", "2.2.0.0-2041"); // mapred-site.xml ref this }
Example #29
Source File: KylinConfig.java From kylin with Apache License 2.0 | 5 votes |
public static void setSandboxEnvIfPossible() { File dir1 = new File("../examples/test_case_data/sandbox"); File dir2 = new File("../../kylin/examples/test_case_data/sandbox"); if (dir1.exists()) { logger.info("Setting sandbox env, KYLIN_CONF=" + dir1.getAbsolutePath()); ClassUtil.addClasspath(dir1.getAbsolutePath()); System.setProperty(KylinConfig.KYLIN_CONF, dir1.getAbsolutePath()); } else if (dir2.exists()) { logger.info("Setting sandbox env, KYLIN_CONF=" + dir2.getAbsolutePath()); ClassUtil.addClasspath(dir2.getAbsolutePath()); System.setProperty(KylinConfig.KYLIN_CONF, dir2.getAbsolutePath()); } }
Example #30
Source File: AbstractPushdownRunner.java From kylin with Apache License 2.0 | 5 votes |
@Override public String convertSql(KylinConfig kylinConfig, String sql, String project, String defaultSchema, boolean isPrepare) { String converted = sql; for (String converterName : kylinConfig.getPushDownConverterClassNames()) { IPushDownConverter converter = (IPushDownConverter) ClassUtil.newInstance(converterName); String tmp = converter.convert(converted, project, defaultSchema, isPrepare); if (!converted.equals(tmp)) { logger.info("the query is converted to {} after applying converter {}", tmp, converterName); } converted = tmp; } return converted; }