private boolean filterTables(String tableName, String tableColumn) { return !tableName.startsWith(MATERIALIZED_VIEW_PREFIX) && !tableColumn.startsWith("$") && !tableName.startsWith("$") && !tableColumn.equals(prestoConfig.getCheckpointColumn()); }
@Override public List<SchemaField> getCollection(String project, String collection) { return dao.listTableColumns(project, collection).stream() // this field should be removed since the server sets it .filter(a -> !a.getColumnName().equals(prestoConfig.getCheckpointColumn())) .map(column -> { TypeSignature typeSignature = column.getDataType().getTypeSignature(); return new SchemaField(column.getColumnName(), PrestoQueryExecution.fromPrestoType(typeSignature.getBase(), typeSignature.getParameters().stream() .filter(param -> param.getKind() == TYPE) .map(param -> param.getTypeSignature().getBase()).iterator())); }).collect(Collectors.toList()); }
.filter(col -> collections.stream().allMatch(list -> list.getValue().contains(col))) .map(f -> f.getName()) .filter(f -> !f.equals(prestoConfig.getCheckpointColumn())) .collect(Collectors.joining(", ")); .map(collection -> format("select '%s' as _collection, %s, %s from %s", collection, checkTableColumn(prestoConfig.getCheckpointColumn()), sharedColumns.isEmpty() ? "1" : sharedColumns, getTableReference(project, collection, sample))) .collect(Collectors.joining(" union all ")) + ") _all"; } else { return "(select cast(null as varchar) as _collection, cast(null as timestamp) as " + checkTableColumn(prestoConfig.getCheckpointColumn()) + ", null as _user, null as " + checkTableColumn(projectConfig.getTimeColumn()) + " limit 0) _all";
checkTableColumn(prestoConfig.getCheckpointColumn()), predicate); }, '"'); queryExecutor.formatTableReference(context.project, name, Optional.empty(), ImmutableMap.of()), format("WHERE %s > from_unixtime(%d)", checkTableColumn(prestoConfig.getCheckpointColumn()), lastUpdated.getEpochSecond())); return collection; }, '"');
queryEnd += format(", \"%s\" %s", prestoConfig.getCheckpointColumn(), toSql(TIMESTAMP)); .filter(field -> schemaFields.stream().noneMatch(f -> f.getName().equals(field.getName()))) .forEach(f -> { if (f.getName().equals(prestoConfig.getCheckpointColumn())) { throw new RakamException("Checkpoint column is reserved", BAD_REQUEST);