/** * Retrieve the schema bytes for a config. Manages different locations due to legacy storage. * @param config DatasetConfig to view. * @return ByteString for schema if property found. Otherwise null. */ public static ByteString getSchemaBytes(DatasetConfig config){ ByteString recordSchema = config.getRecordSchema(); if(recordSchema == null && config.getPhysicalDataset() != null){ recordSchema = config.getPhysicalDataset().getDeprecatedDatasetSchema(); } return recordSchema; }
@Override public long getApproximateRecordCount() { return config.getReadDefinition().getScanStats().getRecordCount(); }
@Override public FileConfig getFormatSettings() { return config.getPhysicalDataset().getFormatSettings(); }
public static DatasetConfig toDatasetConfig(PhysicalDatasetConfig physicalDatasetConfig, String owner) { final DatasetConfig datasetConfig = new DatasetConfig(); datasetConfig.setOwner(owner); datasetConfig.setFullPathList(physicalDatasetConfig.getFullPathList()); datasetConfig.setName(physicalDatasetConfig.getName()); datasetConfig.setType(physicalDatasetConfig.getType()); datasetConfig.setTag(physicalDatasetConfig.getTag()); datasetConfig.setPhysicalDataset(new com.dremio.service.namespace.dataset.proto.PhysicalDataset().setFormatSettings( physicalDatasetConfig.getFormatSettings())); return datasetConfig; }
public static FileConfig toFileConfig(DatasetConfig datasetConfig) { final FileConfig fileConfig = datasetConfig.getPhysicalDataset().getFormatSettings(); fileConfig.setCtime(datasetConfig.getCreatedAt()); fileConfig.setTag(datasetConfig.getTag()); fileConfig.setOwner(datasetConfig.getOwner()); fileConfig.setFullPathList(datasetConfig.getFullPathList()); fileConfig.setName(datasetConfig.getName()); return fileConfig; }
/** * Create a range for the current split version of the given dataset * * @param datasetConfig the dataset config * @return a range which would contain all split ids for this dataset and its current split version */ public static Range<DatasetSplitId> getCurrentSplitRange(DatasetConfig datasetConfig){ final long splitVersion = datasetConfig.getReadDefinition().getSplitVersion(); return getSplitRange(datasetConfig.getId(), splitVersion); }
public RefreshSettings(AccelerationSettings settings) { refreshField = settings.getRefreshField(); method = settings.getMethod(); refreshPeriodMs = settings.getRefreshPeriod(); gracePeriodMs = settings.getGracePeriod(); }
@Override public String apply(final ViewFieldType input) { return input.getName(); } });
private boolean isFSBasedDataset(DatasetConfig datasetConfig) { return datasetConfig.getType() == DatasetType.PHYSICAL_DATASET_HOME_FILE || datasetConfig.getType() == DatasetType.PHYSICAL_DATASET_SOURCE_FILE || datasetConfig.getType() == DatasetType.PHYSICAL_DATASET_SOURCE_FOLDER || datasetConfig.getType() == DatasetType.PHYSICAL_DATASET_HOME_FOLDER; }
public boolean isApproximateStatsAllowed() { PhysicalDataset pd = dataset.getDatasetConfig().getPhysicalDataset(); if(pd == null) { return false; } return pd.getAllowApproxStats() == null ? false : pd.getAllowApproxStats(); }
public ViewTable( NamespaceKey path, View view, DatasetConfig config, BatchSchema schema ) { this(path, view, config.getOwner(), config, schema); }
@Override public void setTag(AccelerationSettings value, String tag) { value.setTag(tag); } }
@Override public void setTag(DatasetSplit value, String tag) { value.setTag(tag); } }
AccelerationSettingsSerializer() { super(AccelerationSettings.getSchema()); } }
@Override public void setVersion(AccelerationSettings value, Long version) { value.setVersion(version == null ? 0 : version); }
@Override public Double getRowCount() { return (double) datasetAccessor.getDataset().getReadDefinition().getScanStats().getRecordCount(); }
@Override public FileConfig getFormatSettings() { loadIfNecessary(); return datasetConfig.getPhysicalDataset().getFormatSettings(); }
@Override public String apply(ViewFieldType input) { String name = input.getName(); // Qlik needs field names that contain spaces to be surrounded by " so we surround all field names. // If the field name contains a ", we escape it with "" (per http://help.qlik.com/en-US/sense/3.1/Subsystems/Hub/Content/Scripting/use-quotes-in-script.htm) return quoteString(name); } };
@Override public String apply(ViewFieldType field) { return field.getName(); } });