@Override public String apply(String input) { RelDataTypeField field = type.getField(input, false, false); if(field == null){ throw UserException.validationError() .message("Unable to find field %s in table %s. Available fields were: %s.", input, SqlUtils.quotedCompound(path), FluentIterable.from(type.getFieldNames()).transform(SqlUtils.QUOTER).join(Joiner.on(", ")) ).build(logger); } return field.getName(); }
@Override public ReflectionGoal apply(Ord<ReflectionDetails> reflectionDetails) { return new ReflectionGoal() .setName(String.format("AUTO_%s_AGG_%d", SqlUtils.quotedCompound(datasetConfig.getFullPathList()), reflectionDetails.i)) .setDetails(reflectionDetails.e) .setType(ReflectionType.AGGREGATION); } });
@Override public ReflectionGoal apply(Ord<ReflectionDetails> reflectionDetails) { return new ReflectionGoal() .setName(String.format("AUTO_%s_RAW_%d", SqlUtils.quotedCompound(datasetConfig.getFullPathList()), reflectionDetails.i)) .setDetails(reflectionDetails.e) .setType(ReflectionType.RAW); } });
private static List<NameAndGranularity> qualifyColumnsWithGranularity(DremioTable table, List<NameAndGranularity> strings){ final RelDataType type = table.getRowType(JavaTypeFactoryImpl.INSTANCE); return strings.stream().map(input -> { RelDataTypeField field = type.getField(input.getName(), false, false); if(field == null){ throw UserException.validationError() .message("Unable to find field %s in table %s. Available fields were: %s.", input.getName(), SqlUtils.quotedCompound(table.getPath().getPathComponents()), FluentIterable.from(type.getFieldNames()).transform(SqlUtils.QUOTER).join(Joiner.on(", ")) ).build(logger); } return new NameAndGranularity(field.getName(), input.getGranularity()); }).collect(Collectors.toList()); }
Stream<AccelerationListManager.ReflectionInfo> reflections = StreamSupport.stream(goalReflections.spliterator(), false).map(goal -> { final String dataset = quotedCompound(namespaceService.get().findDatasetByUUID(goal.getDatasetId()).getFullPathList()); final Optional<ReflectionStatus> statusOpt = getNoThrowStatus(goal.getId()); String combinedStatus = "UNKNOWN"; return null; String datasetPath = quotedCompound(dataset.getFullPathList()); String targetDatasetPath = quotedCompound(targetDataset.getFullPathList()); final Optional<ExternalReflectionStatus> statusOptional = getNoThrowStatusForExternal(new ReflectionId(externalReflection.getId())); final String status = statusOptional.isPresent() ? statusOptional.get().getConfigStatus().toString() : "UNKNOWN";
@Override public Iterable<ExternalReflection> getExternalReflectionByDatasetPath(List<String> datasetPath) { DatasetConfig datasetConfig; try { datasetConfig = namespaceService.get().getDataset(new NamespaceKey(datasetPath)); } catch (NamespaceException e) { throw UserException.validationError(e).build(logger); } if (datasetConfig == null) { throw UserException.validationError().message(String.format("Dataset %s not found", quotedCompound(datasetPath))).build(logger); } return externalReflectionStore.findByDatasetId(datasetConfig.getId().getId()); }
private static List<NameAndMeasures> qualifyColumnsWithMeasures(DremioTable table, List<NameAndMeasures> measures){ // we are using getSchema() instead of getRowType() as it doesn't always report the correct field types for View tables final RelDataType type = table.getSchema().toCalciteRecordType(JavaTypeFactoryImpl.INSTANCE); return measures.stream().map(input -> { RelDataTypeField field = type.getField(input.getName(), false, false); if(field == null){ throw UserException.validationError() .message("Unable to find field %s in table %s. Available fields were: %s.", input.getName(), SqlUtils.quotedCompound(table.getPath().getPathComponents()), FluentIterable.from(type.getFieldNames()).transform(SqlUtils.QUOTER).join(Joiner.on(", ")) ).build(logger); } final RelDataTypeFamily dataTypeFamily = field.getType().getFamily(); TypeHandler handle = null; if(dataTypeFamily instanceof SqlTypeFamily) { handle = TYPE_ALLOWANCES.get(dataTypeFamily); } if(handle == null) { throw UserException.validationError() .message("Unable to configure reflection on field %s in table %s because it was type %s.", input.getName(), SqlUtils.quotedCompound(table.getPath().getPathComponents()), dataTypeFamily ).build(logger); } return new NameAndMeasures(field.getName(), handle.validate(field.getName(), input.getMeasureTypes())); }).collect(Collectors.toList()); }
throw UserException .validationError() .message(String.format("Dataset %s not found", quotedCompound(dataset))) .build(logger); throw UserException .validationError() .message(String.format("Dataset %s not found", quotedCompound(targetDataset))) .build(logger);
throw UserException .validationError() .message(String.format("Table [%s] not found", SqlUtils.quotedCompound(tableSchemaPath))) .build(logger);