/** * Add a query rewrite rule to this engine. * * @param rules Rule classes */ public void addRewriteRule(Iterable<Class<? extends GlobalPlanRewriteRule>> rules) { for (Class<? extends GlobalPlanRewriteRule> clazz : rules) { try { GlobalPlanRewriteRule rule = ReflectionUtil.newInstance(clazz); addRewriteRule(rule); } catch (Throwable t) { throw new RuntimeException(t); } } }
/** * Add a query rewrite rule to this engine. * * @param rules Rule classes */ public void addRewriteRule(Iterable<Class<? extends GlobalPlanRewriteRule>> rules) { for (Class<? extends GlobalPlanRewriteRule> clazz : rules) { try { GlobalPlanRewriteRule rule = ReflectionUtil.newInstance(clazz); addRewriteRule(rule); } catch (Throwable t) { throw new RuntimeException(t); } } }
/** * By default, DelimitedTextFileScanner uses CSVLineSerder. If a table property 'text.serde.class' is given, * it will use the specified serder class. * * @return TextLineSerder */ public static TextLineSerDe getLineSerde(TableMeta meta) { TextLineSerDe lineSerder; String serDeClassName; // if there is no given serde class, it will use CSV line serder. serDeClassName = meta.getOption(StorageConstants.TEXT_SERDE_CLASS, StorageConstants.DEFAULT_TEXT_SERDE_CLASS); try { Class<? extends TextLineSerDe> serdeClass; if (serdeClassCache.containsKey(serDeClassName)) { serdeClass = serdeClassCache.get(serDeClassName); } else { serdeClass = (Class<? extends TextLineSerDe>) Class.forName(serDeClassName); serdeClassCache.put(serDeClassName, serdeClass); } lineSerder = ReflectionUtil.newInstance(serdeClass); } catch (Throwable e) { throw new RuntimeException("TextLineSerde class cannot be initialized.", e); } return lineSerder; }
/** * By default, DelimitedTextFileScanner uses CSVLineSerder. If a table property 'text.serde.class' is given, * it will use the specified serder class. * * @return TextLineSerder */ public static TextLineSerDe getLineSerde(TableMeta meta) { TextLineSerDe lineSerder; String serDeClassName; // if there is no given serde class, it will use CSV line serder. serDeClassName = meta.getProperty(StorageConstants.TEXT_SERDE_CLASS, StorageConstants.DEFAULT_TEXT_SERDE_CLASS); try { Class<? extends TextLineSerDe> serdeClass; if (serdeClassCache.containsKey(serDeClassName)) { serdeClass = serdeClassCache.get(serDeClassName); } else { serdeClass = (Class<? extends TextLineSerDe>) Class.forName(serDeClassName); serdeClassCache.put(serDeClassName, serdeClass); } lineSerder = ReflectionUtil.newInstance(serdeClass); } catch (Throwable e) { throw new RuntimeException("TextLineSerde class cannot be initialized.", e); } return lineSerder; }
public static ServiceTracker get(TajoConf conf) { Class<ServiceTracker> trackerClass; try { if (conf.getBoolVar(TajoConf.ConfVars.TAJO_MASTER_HA_ENABLE)) { trackerClass = (Class<ServiceTracker>) conf.getClassVar(TajoConf.ConfVars.HA_SERVICE_TRACKER_CLASS); } else { trackerClass = (Class<ServiceTracker>) conf.getClassVar(TajoConf.ConfVars.DEFAULT_SERVICE_TRACKER_CLASS); } return ReflectionUtil.newInstance(trackerClass, conf); } catch (Throwable t) { throw new RuntimeException(t); } } }
public static ServiceTracker get(TajoConf conf) { Class<ServiceTracker> trackerClass; try { if (conf.getBoolVar(TajoConf.ConfVars.TAJO_MASTER_HA_ENABLE)) { trackerClass = (Class<ServiceTracker>) conf.getClassVar(TajoConf.ConfVars.HA_SERVICE_TRACKER_CLASS); } else { trackerClass = (Class<ServiceTracker>) conf.getClassVar(TajoConf.ConfVars.DEFAULT_SERVICE_TRACKER_CLASS); } return ReflectionUtil.newInstance(trackerClass, conf); } catch (Throwable t) { throw new RuntimeException(t); } } }
@VisibleForTesting public GlobalPlanner(final TajoConf conf, final CatalogService catalog) throws IOException { this.conf = conf; this.catalog = catalog; this.dataFormat = conf.getVar(ConfVars.SHUFFLE_FILE_FORMAT).toUpperCase(); this.finalOutputDataFormat = conf.getVar(ConfVars.QUERY_OUTPUT_DEFAULT_FILE_FORMAT).toUpperCase(); Class<? extends GlobalPlanRewriteRuleProvider> clazz = (Class<? extends GlobalPlanRewriteRuleProvider>) conf.getClassVar(GLOBAL_PLAN_REWRITE_RULE_PROVIDER_CLASS); GlobalPlanRewriteRuleProvider provider = ReflectionUtil.newInstance(clazz, conf); rewriteEngine = new GlobalPlanRewriteEngine(); rewriteEngine.addRewriteRule(provider.getRules()); }
@VisibleForTesting public GlobalPlanner(final TajoConf conf, final CatalogService catalog) throws IOException { this.conf = conf; this.catalog = catalog; this.dataFormat = conf.getVar(ConfVars.SHUFFLE_FILE_FORMAT).toUpperCase(); this.finalOutputDataFormat = conf.getVar(ConfVars.QUERY_OUTPUT_DEFAULT_FILE_FORMAT).toUpperCase(); Class<? extends GlobalPlanRewriteRuleProvider> clazz = (Class<? extends GlobalPlanRewriteRuleProvider>) conf.getClassVar(GLOBAL_PLAN_REWRITE_RULE_PROVIDER_CLASS); GlobalPlanRewriteRuleProvider provider = ReflectionUtil.newInstance(clazz, conf); rewriteEngine = new GlobalPlanRewriteEngine(); rewriteEngine.addRewriteRule(provider.getRules()); }
public LogicalOptimizer(TajoConf conf, CatalogService catalog, StorageService storage) { this.catalog = catalog; this.storage = storage; // TODO: set the catalog instance to FilterPushdownRule Class clazz = conf.getClassVar(ConfVars.LOGICAL_PLAN_REWRITE_RULE_PROVIDER_CLASS); LogicalPlanRewriteRuleProvider provider = (LogicalPlanRewriteRuleProvider) ReflectionUtil.newInstance(clazz, conf); rulesBeforeJoinOpt = new BaseLogicalPlanRewriteEngine(); rulesBeforeJoinOpt.addRewriteRule(provider.getPreRules()); rulesAfterToJoinOpt = new BaseLogicalPlanRewriteEngine(); rulesAfterToJoinOpt.addRewriteRule(provider.getPostRules()); }
public LogicalOptimizer(TajoConf conf, CatalogService catalog, StorageService storage) { this.catalog = catalog; this.storage = storage; // TODO: set the catalog instance to FilterPushdownRule Class clazz = conf.getClassVar(ConfVars.LOGICAL_PLAN_REWRITE_RULE_PROVIDER_CLASS); LogicalPlanRewriteRuleProvider provider = (LogicalPlanRewriteRuleProvider) ReflectionUtil.newInstance(clazz, conf); rulesBeforeJoinOpt = new BaseLogicalPlanRewriteEngine(storage); rulesBeforeJoinOpt.addRewriteRule(provider.getPreRules()); rulesAfterToJoinOpt = new BaseLogicalPlanRewriteEngine(storage); rulesAfterToJoinOpt.addRewriteRule(provider.getPostRules()); }