private static CompleteType getRawSchema(QueryContext context, List<String> path, final String fieldname) { final NamespaceKey key = new NamespaceKey(path); List<DatasetField> datasetFields = null; try { DatasetConfig datasetConfig = context.getNamespaceService().getDataset(key); datasetFields = datasetConfig.getDatasetFieldsList(); } catch (NamespaceNotFoundException e) { // we will return a dummy type, below } catch (NamespaceException e) { throw new RuntimeException(e); } if (datasetFields != null) { // do we have a known schema for the converted field ? DatasetField datasetField = Iterables.find(datasetFields, new Predicate<DatasetField>() { @Override public boolean apply(@Nullable DatasetField input) { return fieldname.equals(input.getFieldName()); } }, null); if (datasetField != null) { // yes we do return CompleteType.deserialize(datasetField.getFieldSchema().toByteArray()); } } // return a dummy type for now return new CompleteType(ArrowType.Struct.INSTANCE, Collections.<Field>emptyList()); }
private OperatorContextImpl createContext(Writer writer) { BufferAllocator allocator = context.getAllocator().newChildAllocator("direct-command", 0, Long.MAX_VALUE); final OperatorStats stats = new OperatorStats(new OpProfileDef(0,0,0), allocator); final OperatorContextImpl oc = new OperatorContextImpl( context.getConfig(), FragmentHandle.newBuilder().setQueryId(context.getQueryId()).setMajorFragmentId(0).setMinorFragmentId(0).build(), writer, allocator, allocator, null, stats, null, null, context.getFunctionRegistry(), null, context.getOptions(), context.getNamespaceService(), null, NodeDebugContextProvider.NOOP, 60000, null, ImmutableList.of()); return oc; } }
return direct.create(new AccelDropReflectionHandler(catalog, context.getAccelerationManager())); } else if (sqlNode instanceof SqlForgetTable) { return direct.create(new ForgetTableHandler(catalog, context.getNamespaceService())); } else if (sqlNode instanceof SqlRefreshTable) { return direct.create(new RefreshTableHandler(catalog)); return direct.create(new RefreshSourceStatusHandler(catalog)); } else if (sqlNode instanceof SqlSetApprox) { return direct.create(new SetApproxHandler(catalog, context.getNamespaceService()));