Search in sources :

Example 1 with AkMeta

use of com.alibaba.alink.common.io.filesystem.AkUtils.AkMeta in project Alink by alibaba.

the class ModelStreamUtils method getSchemaFromFolder.

public static TableSchema getSchemaFromFolder(FilePath filePath) throws IOException {
    List<Timestamp> models = listModels(filePath);
    if (models.isEmpty()) {
        throw new IllegalArgumentException("Stream model is empty. path: " + filePath.getPath().toString());
    }
    Timestamp timestamp = models.get(0);
    AkMeta meta = AkUtils.getMetaFromPath(new FilePath(new Path(filePath.getPath(), toStringPresentation(timestamp)), filePath.getFileSystem()));
    return CsvUtil.schemaStr2Schema(meta.schemaStr);
}
Also used : FilePath(com.alibaba.alink.common.io.filesystem.FilePath) Path(org.apache.flink.core.fs.Path) FilePath(com.alibaba.alink.common.io.filesystem.FilePath) AkMeta(com.alibaba.alink.common.io.filesystem.AkUtils.AkMeta) Timestamp(java.sql.Timestamp)

Example 2 with AkMeta

use of com.alibaba.alink.common.io.filesystem.AkUtils.AkMeta in project Alink by alibaba.

the class FileModelStreamSink method open.

public void open(Timestamp modelId, int subId) throws IOException {
    BaseFileSystem<?> fileSystem = filePath.getFileSystem();
    Path confDirPath = new Path(filePath.getPath(), MODEL_CONF);
    Path fileInProgress = new Path(confDirPath, String.format("%s_%d", ModelStreamUtils.toStringPresentation(modelId), subId));
    collector = new AkStream(new FilePath(fileInProgress, fileSystem), new AkMeta(schemaStr)).getWriter().getCollector();
}
Also used : FilePath(com.alibaba.alink.common.io.filesystem.FilePath) Path(org.apache.flink.core.fs.Path) FilePath(com.alibaba.alink.common.io.filesystem.FilePath) AkStream(com.alibaba.alink.common.io.filesystem.AkStream) AkMeta(com.alibaba.alink.common.io.filesystem.AkUtils.AkMeta)

Aggregations

AkMeta (com.alibaba.alink.common.io.filesystem.AkUtils.AkMeta)2 FilePath (com.alibaba.alink.common.io.filesystem.FilePath)2 Path (org.apache.flink.core.fs.Path)2 AkStream (com.alibaba.alink.common.io.filesystem.AkStream)1 Timestamp (java.sql.Timestamp)1