.setSqlQuery(new SqlQuery(sql, Arrays.asList("sys"), securityContext)) .setQueryType(QueryType.UI_INTERNAL_RUN) .build(), NoOpJobStatusListener.INSTANCE));
.setSqlQuery(query) .setQueryType(QueryType.UI_INTERNAL_PREVIEW) .setDatasetPath(NONE_PATH) .build(), new NoOpJobStatusListener() { @Override public void jobFailed(final Exception e) {
.setSqlQuery(query) .setQueryType(queryType) .setDatasetPath(datasetPath.toNamespaceKey()) .setDatasetVersion(version) .build(), statusListener)); } catch (UserRemoteException e) { throw new DACRuntimeException(format("Failure while running %s query for dataset %s :\n%s", queryType, messagePath, query) + "\n" + e.getMessage(), e);
.setSqlQuery(query) .setQueryType(QueryType.UI_PREVIEW) .build(), NoOpJobStatusListener.INSTANCE)); job.getData().loadIfNecessary(); JobDataFragment truncData = job.getData().truncate(500); .setSqlQuery(new SqlQuery("select * from \"" + HOME_NAME + "\".file1", SampleDataPopulator.DEFAULT_USER_NAME)) .build(), NoOpJobStatusListener.INSTANCE)); job.getData().loadIfNecessary(); truncData = job.getData().truncate(500);
doc("Submitting job for dataset testB.dsB1 dataset for version " + v2.getVersion()); l(JobsService.class).submitJob(JobRequest.newBuilder() .setSqlQuery(getQueryFromConfig(dsGet)) .setQueryType(QueryType.UI_RUN) .setDatasetPath(getDatasetPath(dsGet).toNamespaceKey()) .setDatasetVersion(v2) .build(), NoOpJobStatusListener.INSTANCE).getData().loadIfNecessary();
.setSqlQuery(getQueryFromConfig(ds1)) .setQueryType(QueryType.UI_RUN) .setDatasetPath(datasetPath1.toNamespaceKey()) .setDatasetVersion(ds1.getDatasetVersion()) .build(), NoOpJobStatusListener.INSTANCE).getData().loadIfNecessary(); l(JobsService.class).submitJob(JobRequest.newBuilder() .setSqlQuery(getQueryFromConfig(ds2)) .setQueryType(QueryType.UI_RUN) .setDatasetPath(datasetPath2.toNamespaceKey()) .setDatasetVersion(ds2.getDatasetVersion()) .build(), NoOpJobStatusListener.INSTANCE).getData().loadIfNecessary(); l(JobsService.class).submitJob(JobRequest.newBuilder() .setSqlQuery(getQueryFromConfig(ds3)) .setQueryType(QueryType.UI_RUN) .setDatasetPath(datasetPath3.toNamespaceKey()) .setDatasetVersion(ds3.getDatasetVersion()) .build(), NoOpJobStatusListener.INSTANCE).getData().loadIfNecessary(); l(JobsService.class).submitJob(JobRequest.newBuilder() .setSqlQuery(getQueryFromConfig(ds2)) .setQueryType(QueryType.UI_RUN) .setDatasetPath(datasetPath2.toNamespaceKey()) .setDatasetVersion(ds2.getDatasetVersion()) .build(), NoOpJobStatusListener.INSTANCE).getData().loadIfNecessary();
.setSqlQuery(getQueryFromSQL("select * from LocalFS1.\"dac-sample1.json\" limit 1")) .setDatasetPath(ds1.toNamespaceKey()) .setDatasetVersion(new DatasetVersion("v1")).build(), NoOpJobStatusListener.INSTANCE); Job job2_0 = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(getQueryFromSQL("select * from LocalFS1.\"dac-sample1.json\" limit 1")) .setDatasetPath(ds2.toNamespaceKey()) .setDatasetVersion(new DatasetVersion("v1")).build(), NoOpJobStatusListener.INSTANCE); Job job3_0 = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(getQueryFromSQL("select * from LocalFS1.\"dac-sample1.json\" limit 1")) .setDatasetPath(ds3.toNamespaceKey()) .setDatasetVersion(new DatasetVersion("v1")).build(), NoOpJobStatusListener.INSTANCE); .setSqlQuery(getQueryFromSQL("select * from LocalFS1.\"dac-sample1.json\" limit 1")) .setDatasetPath(ds1.toNamespaceKey()) .setDatasetVersion(new DatasetVersion("v1")).build(), NoOpJobStatusListener.INSTANCE); Job job1_3 = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(getQueryFromSQL("select * from LocalFS1.\"dac-sample1.json\" limit 1")) .setDatasetPath(ds1.toNamespaceKey()) .setDatasetVersion(new DatasetVersion("v2")).build(), NoOpJobStatusListener.INSTANCE); Job job2_2 = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(getQueryFromSQL("select * from LocalFS1.\"dac-sample1.json\" limit 1")) .setDatasetPath(ds2.toNamespaceKey()) .setDatasetVersion(new DatasetVersion("v2")).build(), NoOpJobStatusListener.INSTANCE); .setSqlQuery(getQueryFromSQL("select * from LocalFS1.\"dac-sample1.json\" limit 1")) .setDatasetPath(ds1.toNamespaceKey()) .setDatasetVersion(new DatasetVersion("v1")).build(), NoOpJobStatusListener.INSTANCE); job1_4.getData().loadIfNecessary(); List<Job> jobs = ImmutableList.copyOf(jobsService.getAllJobs());
.setSqlQuery(getQueryFromConfig(dsGet)) .setQueryType(QueryType.UI_PREVIEW) .setDatasetPath(getDatasetPath(dsGet).toNamespaceKey()) .setDatasetVersion(v2) .build(), NoOpJobStatusListener.INSTANCE).getData().loadIfNecessary(); .setSqlQuery(new SqlQuery(dsGet.getSql(), dsGet.getContext(), USERNAME)) .setQueryType(QueryType.UI_PREVIEW) .setDatasetPath(getDatasetPath(dsGet).toNamespaceKey()) .setDatasetVersion(v2) .build(), NoOpJobStatusListener.INSTANCE).getData().loadIfNecessary();
final JobsService jobsService = l(JobsService.class); JobUI job = new JobUI(jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(new SqlQuery("select * from \"" + HOME_NAME + "\".\"excel\"", SampleDataPopulator.DEFAULT_USER_NAME)) .build(), NoOpJobStatusListener.INSTANCE)); job.getData().loadIfNecessary(); JobDataFragment truncData = job.getData().truncate(500);
.setSqlQuery(new SqlQuery(ctasSql, virtualDatasetUI.getContextList(), userName)) .build(), NoOpJobStatusListener.INSTANCE); logger.debug("Scheduled download job {} for {}", job.getJobId(), datasetPath); return job;
.setSqlQuery(query) .setQueryType(QueryType.UI_INTERNAL_RUN) .build(), listener);
final DeferredException ex = new DeferredException(); Job job = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(new SqlQuery("select n_regionkey, max(n_nationkey) as max_nation from cp.\"tpch/nation.parquet\" group by n_regionkey", SYSTEM_USERNAME)) .setQueryType(QueryType.JDBC) .setDatasetPath(datsetPath.toNamespaceKey()) .setDatasetVersion(DatasetVersion.newVersion()) .build(), new JobStatusLogger() { @Override public void planRelTransform(PlannerPhase phase, RelNode before, RelNode after, long millisTaken) {
final JobsService jobsService = l(JobsService.class); Job job = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(getQueryFromConfig(dsg1)) .setQueryType(QueryType.UI_RUN) .setDatasetPath(datasetPath.toNamespaceKey()) .setDatasetVersion(dsg1.getVersion()) .build(), NoOpJobStatusListener.INSTANCE); job.getData().loadIfNecessary(); assertEquals(2, job.getJobAttempt().getInfo().getParentsList().size());
.setSqlQuery(ctas) .setQueryType(QueryType.UI_RUN) .build(), NoOpJobStatusListener.INSTANCE); ctasJob.getData().loadIfNecessary(); .setSqlQuery(dropTable) .setQueryType(QueryType.ACCELERATOR_DROP) .build(), NoOpJobStatusListener.INSTANCE); dropTableJob.getData().loadIfNecessary();
final VirtualDatasetUI ds1 = datasetService.get(datasetPath); Job job = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(new SqlQuery(ds1.getSql(), ds1.getState().getContextList(), DEFAULT_USERNAME)) .setQueryType(QueryType.UI_RUN) .setDatasetPath(datasetPath.toNamespaceKey()) .setDatasetVersion(ds1.getVersion()) .build(), NoOpJobStatusListener.INSTANCE); boolean runningState = false; while (true) {
.setSqlQuery(new SqlQuery("create view mySpace.myFolder.myView as select * from cp.nation_ctas.t1.\"0_0_0.parquet\"", DEFAULT_USERNAME)) .setQueryType(QueryType.UI_RUN) .build(), NoOpJobStatusListener.INSTANCE); .setSqlQuery(new SqlQuery("select * from mySpace.myFolder.myView", DEFAULT_USERNAME)) .setQueryType(QueryType.UI_RUN) .build(), NoOpJobStatusListener.INSTANCE); job2.getData().loadIfNecessary(); assertEquals(25, job2.getJobAttempt().getDetails().getOutputRecords().longValue()); .setSqlQuery(new SqlQuery("drop view mySpace.myFolder.myView", DEFAULT_USERNAME)) .setQueryType(QueryType.UI_RUN) .build(), NoOpJobStatusListener.INSTANCE); job3.getData().loadIfNecessary(); .setSqlQuery(new SqlQuery("select * from mySpace.myFolder.myView", DEFAULT_USERNAME)) .setQueryType(QueryType.UI_RUN) .build(), NoOpJobStatusListener.INSTANCE);
final DatasetPath ds1 = new DatasetPath("s.ds1"); Job job1_0 = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(new SqlQuery("select * from LocalFS1.\"dac-sample1.json\" limit 10", ds1.toParentPathList(), DEFAULT_USERNAME)) .setDatasetPath(ds1.toNamespaceKey()) .setDatasetVersion(new DatasetVersion("1")) .build(), NoOpJobStatusListener.INSTANCE); job1_0.getData().loadIfNecessary(); JobDataFragment result = job1_0.getData().truncate(10);
.setSqlQuery(createQuery("/datasets/text/comma.txt")) .setQueryType(QueryType.UI_RUN) .build(), NoOpJobStatusListener.INSTANCE)); JobDataFragment jobData = job.getData().truncate(500); assertEquals(3, jobData.getReturnedRowCount());
private void deleteMaterialization(Materialization materialization) { if (Iterables.isEmpty(materializationStore.getRefreshesExclusivelyOwnedBy(materialization))) { logger.debug("materialization {} doesn't own any refresh, entry will be deleted without running a drop table", getId(materialization)); materializationStore.delete(materialization.getId()); return; } // set the materialization to DELETED so we don't try to delete it again materialization.setState(MaterializationState.DELETED); materializationStore.save(materialization); try { final String pathString = constructFullPath(getMaterializationPath(materialization)); final String query = String.format("DROP TABLE IF EXISTS %s", pathString); MaterializationSummary materializationSummary = new MaterializationSummary() .setReflectionId(materialization.getReflectionId().getId()) .setLayoutVersion(materialization.getReflectionGoalVersion()) .setMaterializationId(materialization.getId().getId()); jobsService.submitJob( JobRequest.newMaterializationJobBuilder(materializationSummary, SubstitutionSettings.of()) .setSqlQuery(new SqlQuery(query, SYSTEM_USERNAME)) .setQueryType(QueryType.ACCELERATOR_DROP) .build(), NoOpJobStatusListener.INSTANCE); } catch (Exception e) { logger.warn("failed to drop materialization {}", materialization.getId().getId(), e); } }
.setSqlQuery(createQuery("/datasets/csv/comma_windows_lineseparator.csv")) .setQueryType(QueryType.UI_RUN) .build(), NoOpJobStatusListener.INSTANCE)); JobDataFragment jobData = job.getData().truncate(500); assertEquals(3, jobData.getReturnedRowCount());