Tabnine Logo
SamzaSqlApplicationConfig.getUdfMetadata
Code IndexAdd Tabnine to your IDE (free)

How to use
getUdfMetadata
method
in
org.apache.samza.sql.runner.SamzaSqlApplicationConfig

Best Java code snippets using org.apache.samza.sql.runner.SamzaSqlApplicationConfig.getUdfMetadata (Showing top 7 results out of 315)

origin: apache/samza

public SamzaSqlExecutionContext(SamzaSqlApplicationConfig config) {
 this.sqlConfig = config;
 udfMetadata =
   this.sqlConfig.getUdfMetadata().stream().collect(Collectors.toMap(UdfMetadata::getName, Function.identity()));
}
origin: org.apache.samza/samza-sql

public SamzaSqlExecutionContext(SamzaSqlApplicationConfig config) {
 this.sqlConfig = config;
 udfMetadata =
   this.sqlConfig.getUdfMetadata().stream().collect(Collectors.toMap(UdfMetadata::getName, Function.identity()));
}
origin: apache/samza

@Override
public Collection<RelRoot> convertDsl(String dsl) {
 // TODO: Introduce an API to parse a dsl string and return one or more sql statements
 List<String> sqlStmts = fetchSqlFromConfig(config);
 List<SamzaSqlQueryParser.QueryInfo> queryInfo = fetchQueryInfo(sqlStmts);
 SamzaSqlApplicationConfig sqlConfig = new SamzaSqlApplicationConfig(config,
   queryInfo.stream().map(SamzaSqlQueryParser.QueryInfo::getSources).flatMap(Collection::stream)
     .collect(Collectors.toList()),
   queryInfo.stream().map(SamzaSqlQueryParser.QueryInfo::getSink).collect(Collectors.toList()));
 QueryPlanner planner =
   new QueryPlanner(sqlConfig.getRelSchemaProviders(), sqlConfig.getInputSystemStreamConfigBySource(),
     sqlConfig.getUdfMetadata());
 List<RelRoot> relRoots = new LinkedList<>();
 for (String sql: sqlStmts) {
  // we always pass only select query to the planner for samza sql. The reason is that samza sql supports
  // schema evolution where source and destination could up to an extent have independent schema evolution while
  // calcite expects strict comformance of the destination schema with that of the fields in the select query.
  SamzaSqlQueryParser.QueryInfo qinfo = SamzaSqlQueryParser.parseQuery(sql);
  relRoots.add(planner.plan(qinfo.getSelectQuery()));
 }
 return relRoots;
}
origin: org.apache.samza/samza-sql

@Override
public Collection<RelRoot> convertDsl(String dsl) {
 // TODO: Introduce an API to parse a dsl string and return one or more sql statements
 List<String> sqlStmts = fetchSqlFromConfig(config);
 List<SamzaSqlQueryParser.QueryInfo> queryInfo = fetchQueryInfo(sqlStmts);
 SamzaSqlApplicationConfig sqlConfig = new SamzaSqlApplicationConfig(config,
   queryInfo.stream().map(SamzaSqlQueryParser.QueryInfo::getSources).flatMap(Collection::stream)
     .collect(Collectors.toSet()),
   queryInfo.stream().map(SamzaSqlQueryParser.QueryInfo::getSink).collect(Collectors.toSet()));
 QueryPlanner planner =
   new QueryPlanner(sqlConfig.getRelSchemaProviders(), sqlConfig.getSystemStreamConfigsBySource(),
     sqlConfig.getUdfMetadata());
 List<RelRoot> relRoots = new LinkedList<>();
 for (String sql: sqlStmts) {
  // when sql is a query, we only pass the select query to the planner
  SamzaSqlQueryParser.QueryInfo qinfo = SamzaSqlQueryParser.parseQuery(sql);
  if (qinfo.getSink().split("\\.")[0].equals(SamzaSqlApplicationConfig.SAMZA_SYSTEM_LOG)) {
   sql = qinfo.getSelectQuery();
  }
  relRoots.add(planner.plan(sql));
 }
 return relRoots;
}
origin: apache/samza

/**
 * For unit testing only
 */
@VisibleForTesting
void translate(SamzaSqlQueryParser.QueryInfo queryInfo, StreamApplicationDescriptor appDesc, int queryId) {
 QueryPlanner planner =
   new QueryPlanner(sqlConfig.getRelSchemaProviders(), sqlConfig.getInputSystemStreamConfigBySource(),
     sqlConfig.getUdfMetadata());
 final RelRoot relRoot = planner.plan(queryInfo.getSelectQuery());
 SamzaSqlExecutionContext executionContext = new SamzaSqlExecutionContext(sqlConfig);
 TranslatorContext translatorContext = new TranslatorContext(appDesc, relRoot, executionContext);
 translate(relRoot, sqlConfig.getOutputSystemStreams().get(queryId), translatorContext, queryId);
 Map<Integer, TranslatorContext> translatorContexts = new HashMap<>();
 translatorContexts.put(queryId, translatorContext.clone());
 appDesc.withApplicationTaskContextFactory(new ApplicationTaskContextFactory<SamzaSqlApplicationContext>() {
  @Override
  public SamzaSqlApplicationContext create(ExternalContext externalContext, JobContext jobContext,
    ContainerContext containerContext, TaskContext taskContext,
    ApplicationContainerContext applicationContainerContext) {
   return new SamzaSqlApplicationContext(translatorContexts);
  }
 });
}
origin: apache/samza

@Test
public void testConfigInit() {
 Map<String, String> config = SamzaSqlTestConfig.fetchStaticConfigsWithFactories(10);
 config.put(SamzaSqlApplicationConfig.CFG_SQL_STMT, "Insert into testavro.COMPLEX1 select * from testavro.SIMPLE1");
 String configUdfResolverDomain = String.format(SamzaSqlApplicationConfig.CFG_FMT_UDF_RESOLVER_DOMAIN, "config");
 int numUdfs = config.get(configUdfResolverDomain + ConfigBasedUdfResolver.CFG_UDF_CLASSES).split(",").length;
 List<String> sqlStmts = fetchSqlFromConfig(config);
 List<SamzaSqlQueryParser.QueryInfo> queryInfo = fetchQueryInfo(sqlStmts);
 SamzaSqlApplicationConfig samzaSqlApplicationConfig = new SamzaSqlApplicationConfig(new MapConfig(config),
   queryInfo.stream().map(SamzaSqlQueryParser.QueryInfo::getSources).flatMap(Collection::stream)
     .collect(Collectors.toList()),
   queryInfo.stream().map(SamzaSqlQueryParser.QueryInfo::getSink).collect(Collectors.toList()));
 Assert.assertEquals(numUdfs, samzaSqlApplicationConfig.getUdfMetadata().size());
 Assert.assertEquals(1, samzaSqlApplicationConfig.getInputSystemStreamConfigBySource().size());
 Assert.assertEquals(1, samzaSqlApplicationConfig.getOutputSystemStreamConfigsBySource().size());
}
origin: org.apache.samza/samza-sql

/**
 * For unit testing only
 */
@VisibleForTesting
public void translate(SamzaSqlQueryParser.QueryInfo queryInfo, StreamApplicationDescriptor appDesc) {
 QueryPlanner planner =
   new QueryPlanner(sqlConfig.getRelSchemaProviders(), sqlConfig.getSystemStreamConfigsBySource(),
     sqlConfig.getUdfMetadata());
 final RelRoot relRoot = planner.plan(queryInfo.getSql());
 int queryId = 1;
 SamzaSqlExecutionContext executionContext = new SamzaSqlExecutionContext(sqlConfig);
 Map<String, SamzaRelConverter> converters = sqlConfig.getSamzaRelConverters();
 TranslatorContext translatorContext = new TranslatorContext(appDesc, relRoot, executionContext, converters);
 translate(relRoot, translatorContext, queryId);
 Map<Integer, TranslatorContext> translatorContexts = new HashMap<>();
 translatorContexts.put(queryId, translatorContext.clone());
 appDesc.withApplicationTaskContextFactory((jobContext,
   containerContext,
   taskContext,
   applicationContainerContext) ->
   new SamzaSqlApplicationContext(translatorContexts));
}
org.apache.samza.sql.runnerSamzaSqlApplicationConfiggetUdfMetadata

Popular methods of SamzaSqlApplicationConfig

  • <init>
  • createIOResolver
  • getInputSystemStreamConfigBySource
  • getOutputSystemStreamConfigsBySource
  • initializePlugin
  • createUdfResolver
  • deserializeSqlStmts
  • getDomainProperties
  • getOutputSystemStreams
  • getRelSchemaProviders
  • getSamzaRelConverters
  • getSystemStreamName
  • getSamzaRelConverters,
  • getSystemStreamName,
  • getWindowDurationMs,
  • populateSystemStreams,
  • populateSystemStreamsAndGetRelRoots,
  • serializeSqlStmts,
  • getIoResolver,
  • getMetadataTopicPrefix,
  • getSamzaRelTableKeyConverters

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (ScheduledExecutorService)
  • addToBackStack (FragmentTransaction)
  • notifyDataSetChanged (ArrayAdapter)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • JList (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now