use of com.bakdata.conquery.models.query.resultinfo.SimpleResultInfo in project conquery by bakdata.
the class TableExportQuery method createResultInfos.
private static List<ResultInfo> createResultInfos(int size, Map<SecondaryIdDescription, Integer> secondaryIdPositions, Map<Column, Integer> positions) {
ResultInfo[] infos = new ResultInfo[size];
infos[0] = ConqueryConstants.DATES_INFO;
for (Map.Entry<SecondaryIdDescription, Integer> e : secondaryIdPositions.entrySet()) {
SecondaryIdDescription desc = e.getKey();
Integer pos = e.getValue();
infos[pos] = new SimpleResultInfo(desc.getLabel(), ResultType.IdT.INSTANCE);
}
for (Map.Entry<Column, Integer> entry : positions.entrySet()) {
// 0 Position is date, already covered
final int position = entry.getValue();
// SecondaryIds are pulled to the front, already covered.
final Column column = entry.getKey();
if (position == 0 || column.getSecondaryId() != null) {
continue;
}
infos[position] = new SimpleResultInfo(column.getTable().getLabel() + " " + column.getLabel(), ResultType.resolveResultType(column.getType()));
}
return List.of(infos);
}
use of com.bakdata.conquery.models.query.resultinfo.SimpleResultInfo in project conquery by bakdata.
the class UniqueNameTest method testNameCollision.
@Test
void testNameCollision() {
final UniqueNamer uniqueNamer = new UniqueNamer(new PrintSettings(true, Locale.ROOT, null, new ConqueryConfig(), null));
final SimpleResultInfo info1 = new SimpleResultInfo("test", null);
final SimpleResultInfo info2 = new SimpleResultInfo("test", null);
final SimpleResultInfo info3 = new SimpleResultInfo("test_1", null);
final SimpleResultInfo info4 = new SimpleResultInfo("test", null);
assertThat(uniqueNamer.getUniqueName(info1)).isEqualTo("test");
assertThat(uniqueNamer.getUniqueName(info2)).isEqualTo("test_1");
assertThat(uniqueNamer.getUniqueName(info3)).isEqualTo("test_1_1");
assertThat(uniqueNamer.getUniqueName(info4)).isEqualTo("test_2");
}
use of com.bakdata.conquery.models.query.resultinfo.SimpleResultInfo in project conquery by bakdata.
the class CQExternal method getResultInfos.
@Override
public List<ResultInfo> getResultInfos() {
if (extra == null) {
return Collections.emptyList();
}
List<ResultInfo> resultInfos = new ArrayList<>();
for (int col = 0; col < format.size(); col++) {
if (!format.get(col).equals(FORMAT_EXTRA)) {
continue;
}
String column = values[0][col];
resultInfos.add(new SimpleResultInfo(column, new ResultType.ListT(ResultType.StringT.INSTANCE)));
}
return resultInfos;
}
use of com.bakdata.conquery.models.query.resultinfo.SimpleResultInfo in project conquery by bakdata.
the class SecondaryIdQuery method getResultInfos.
@Override
public List<ResultInfo> getResultInfos() {
List<ResultInfo> resultInfos = new ArrayList<>();
resultInfos.add(new SimpleResultInfo(secondaryId.getName(), ResultType.IdT.INSTANCE));
resultInfos.addAll(query.getResultInfos());
return resultInfos;
}
Aggregations