本文整理了Java中org.apache.metamodel.data.DataSet.getSelectItems()
方法的一些代码示例,展示了DataSet.getSelectItems()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataSet.getSelectItems()
方法的具体详情如下:
包路径:org.apache.metamodel.data.DataSet
类名称:DataSet
方法名:getSelectItems
暂无
代码示例来源:origin: org.apache.metamodel/MetaModel-core
public DataSetTableModel(DataSet dataSet) {
_dataSet = dataSet;
_selectItems = dataSet.getSelectItems();
_materialized = false;
}
代码示例来源:origin: apache/metamodel
public DataSetTableModel(DataSet dataSet) {
_dataSet = dataSet;
_selectItems = dataSet.getSelectItems();
_materialized = false;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
public ConvertedDataSet(DataSet dataSet, TypeConverter<?, ?>[] converters) {
super(dataSet.getSelectItems());
_dataSet = dataSet;
_converters = converters;
}
代码示例来源:origin: apache/metamodel
public ConvertedDataSet(DataSet dataSet, TypeConverter<?, ?>[] converters) {
super(dataSet.getSelectItems());
_dataSet = dataSet;
_converters = converters;
}
代码示例来源:origin: apache/metamodel
public ScalarFunctionDataSet(List<SelectItem> scalarFunctionSelectItemsToEvaluate, DataSet dataSet) {
super(CollectionUtils.concat(false, scalarFunctionSelectItemsToEvaluate,
dataSet.getSelectItems()));
_scalarFunctionSelectItemsToEvaluate = scalarFunctionSelectItemsToEvaluate;
_dataSet = dataSet;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
public static DataSet getDistinct(DataSet dataSet) {
List<SelectItem> selectItems = dataSet.getSelectItems();
List<GroupByItem> groupByItems = selectItems.stream().map(GroupByItem::new).collect(Collectors.toList());
return getGrouped(selectItems, dataSet, groupByItems);
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
public ScalarFunctionDataSet(List<SelectItem> scalarFunctionSelectItemsToEvaluate, DataSet dataSet) {
super(CollectionUtils.concat(false, scalarFunctionSelectItemsToEvaluate,
dataSet.getSelectItems()));
_scalarFunctionSelectItemsToEvaluate = scalarFunctionSelectItemsToEvaluate;
_dataSet = dataSet;
}
代码示例来源:origin: apache/metamodel
public static DataSet getDistinct(DataSet dataSet) {
List<SelectItem> selectItems = dataSet.getSelectItems();
List<GroupByItem> groupByItems = selectItems.stream().map(GroupByItem::new).collect(Collectors.toList());
return getGrouped(selectItems, dataSet, groupByItems);
}
代码示例来源:origin: org.eobjects.datacleaner/DataCleaner-monitor-services
private Object createTableMap(DataSet dataSet) {
final Map<String, Object> map = new HashMap<>();
map.put("header", createColumnHeaderList(dataSet.getSelectItems()));
map.put("rows", createRowList(dataSet));
return map;
}
代码示例来源:origin: apache/metamodel
/**
* Performs a right join (aka right outer join) operation on two datasets.
*
* @param ds1 the left dataset
* @param ds2 the right dataset
* @param onConditions the conditions to join by
* @return the right joined result dataset
*/
public static DataSet getRightJoin(DataSet ds1, DataSet ds2, FilterItem[] onConditions) {
List<SelectItem> ds1selects = ds1.getSelectItems();
List<SelectItem> ds2selects = ds2.getSelectItems();
List<SelectItem> leftOrderedSelects = new ArrayList<>();
leftOrderedSelects.addAll(ds1selects);
leftOrderedSelects.addAll(ds2selects);
// We will reuse the left join algorithm (but switch the datasets
// around)
DataSet dataSet = getLeftJoin(ds2, ds1, onConditions);
dataSet = getSelection(leftOrderedSelects, dataSet);
return dataSet;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
/**
* Performs a right join (aka right outer join) operation on two datasets.
*
* @param ds1 the left dataset
* @param ds2 the right dataset
* @param onConditions the conditions to join by
* @return the right joined result dataset
*/
public static DataSet getRightJoin(DataSet ds1, DataSet ds2, FilterItem[] onConditions) {
List<SelectItem> ds1selects = ds1.getSelectItems();
List<SelectItem> ds2selects = ds2.getSelectItems();
List<SelectItem> leftOrderedSelects = new ArrayList<>();
leftOrderedSelects.addAll(ds1selects);
leftOrderedSelects.addAll(ds2selects);
// We will reuse the left join algorithm (but switch the datasets
// around)
DataSet dataSet = getLeftJoin(ds2, ds1, onConditions);
dataSet = getSelection(leftOrderedSelects, dataSet);
return dataSet;
}
代码示例来源:origin: apache/metamodel
@Override
public boolean next() {
if (_iterator == null) {
_iterator = _dataSetProviders.iterator();
}
while (_currentDataSet == null || !_currentDataSet.next()) {
if (!_iterator.hasNext()) {
_currentDataSet = null;
return false;
}
_currentDataSet = _iterator.next().get();
assert getHeader().size() == _currentDataSet.getSelectItems().size();
}
return true;
}
代码示例来源:origin: org.eobjects.datacleaner/DataCleaner-monitor-services
private List<String> createRowValueList(DataSet dataSet) {
final List<String> values = new ArrayList<>();
Row row = dataSet.getRow();
for (int i = 0; i < dataSet.getSelectItems().length; i++) {
Object value = row.getValue(i);
values.add(ConvertToStringTransformer.transformValue(value));
}
return values;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
public boolean next() {
if (_iterator == null) {
_iterator = _dataSetProviders.iterator();
}
while (_currentDataSet == null || !_currentDataSet.next()) {
if (!_iterator.hasNext()) {
_currentDataSet = null;
return false;
}
_currentDataSet = _iterator.next().get();
assert getHeader().size() == _currentDataSet.getSelectItems().size();
}
return true;
}
代码示例来源:origin: apache/metamodel
/**
* Constructor appropriate for dataset implementations that wrap other
* datasets, such as the {@link MaxRowsDataSet}, {@link FilteredDataSet} and
* more.
*
* @param dataSet
*/
public AbstractDataSet(DataSet dataSet) {
if (dataSet instanceof AbstractDataSet) {
_header = ((AbstractDataSet) dataSet).getHeader();
} else {
_header = new CachingDataSetHeader(dataSet.getSelectItems());
}
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
/**
* Constructor appropriate for dataset implementations that wrap other
* datasets, such as the {@link MaxRowsDataSet}, {@link FilteredDataSet} and
* more.
*
* @param dataSet
*/
public AbstractDataSet(DataSet dataSet) {
if (dataSet instanceof AbstractDataSet) {
_header = ((AbstractDataSet) dataSet).getHeader();
} else {
_header = new CachingDataSetHeader(dataSet.getSelectItems());
}
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
public final DataSet intercept(DataSet dataSet) {
Map<Column, TypeConverter<?, ?>> converters = getConverters(dataSet);
if (converters.isEmpty()) {
return dataSet;
}
boolean hasConverter = false;
List<SelectItem> selectItems = dataSet.getSelectItems();
TypeConverter<?, ?>[] converterArray = new TypeConverter[selectItems.size()];
for (int i = 0; i < selectItems.size(); i++) {
SelectItem selectItem = selectItems.get(i);
Column column = selectItem.getColumn();
if (column != null && selectItem.getAggregateFunction() == null) {
TypeConverter<?, ?> converter = converters.get(column);
if (converter != null) {
hasConverter = true;
converterArray[i] = converter;
}
}
}
if (!hasConverter) {
return dataSet;
}
return new ConvertedDataSet(dataSet, converterArray);
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
public static DataSet getSelection(final List<SelectItem> selectItems, final DataSet dataSet) {
final List<SelectItem> dataSetSelectItems = dataSet.getSelectItems();
// check if the selection is already the same
if (selectItems.equals(dataSetSelectItems)) {
// return the DataSet unmodified
return dataSet;
}
final List<SelectItem> scalarFunctionSelectItemsToEvaluate = new ArrayList<>();
for (SelectItem selectItem : selectItems) {
if (selectItem.getScalarFunction() != null) {
if (!dataSetSelectItems.contains(selectItem)
&& dataSetSelectItems.contains(selectItem.replaceFunction(null))) {
scalarFunctionSelectItemsToEvaluate.add(selectItem);
}
}
}
if (scalarFunctionSelectItemsToEvaluate.isEmpty()) {
return new SubSelectionDataSet(selectItems, dataSet);
}
final ScalarFunctionDataSet scalaFunctionDataSet =
new ScalarFunctionDataSet(scalarFunctionSelectItemsToEvaluate, dataSet);
return new SubSelectionDataSet(selectItems, scalaFunctionDataSet);
}
代码示例来源:origin: apache/metamodel
public static DataSet getSelection(final List<SelectItem> selectItems, final DataSet dataSet) {
final List<SelectItem> dataSetSelectItems = dataSet.getSelectItems();
// check if the selection is already the same
if (selectItems.equals(dataSetSelectItems)) {
// return the DataSet unmodified
return dataSet;
}
final List<SelectItem> scalarFunctionSelectItemsToEvaluate = new ArrayList<>();
for (SelectItem selectItem : selectItems) {
if (selectItem.getScalarFunction() != null) {
if (!dataSetSelectItems.contains(selectItem)
&& dataSetSelectItems.contains(selectItem.replaceFunction(null))) {
scalarFunctionSelectItemsToEvaluate.add(selectItem);
}
}
}
if (scalarFunctionSelectItemsToEvaluate.isEmpty()) {
return new SubSelectionDataSet(selectItems, dataSet);
}
final ScalarFunctionDataSet scalaFunctionDataSet =
new ScalarFunctionDataSet(scalarFunctionSelectItemsToEvaluate, dataSet);
return new SubSelectionDataSet(selectItems, scalaFunctionDataSet);
}
代码示例来源:origin: apache/metamodel
public static DataSet getFiltered(DataSet dataSet, Collection<FilterItem> filterItems) {
if (filterItems == null || filterItems.isEmpty()) {
return dataSet;
}
final List<SelectItem> selectItemsOnOutput = dataSet.getSelectItems();
final Iterable<SelectItem> selectItems =
filterItems.stream().map(f -> f.getSelectItem()).filter(s -> s != null)::iterator;
final List<SelectItem> scalarFunctionSelectItems =
getUnmaterializedScalarFunctionSelectItems(selectItems, dataSet);
final boolean calculateScalarFunctions = !scalarFunctionSelectItems.isEmpty();
if (calculateScalarFunctions) {
// scalar functions are needed in evaluation of the filters
dataSet = new ScalarFunctionDataSet(scalarFunctionSelectItems, dataSet);
}
final FilteredDataSet filteredDataSet = new FilteredDataSet(dataSet, filterItems);
if (calculateScalarFunctions) {
return getSelection(selectItemsOnOutput, filteredDataSet);
} else {
return filteredDataSet;
}
}
内容来源于网络,如有侵权,请联系作者删除!