-
Notifications
You must be signed in to change notification settings - Fork 802
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33acb21
commit 0d8f2b5
Showing
223 changed files
with
13,003 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
core/src/main/java/com/alibaba/alink/common/io/xls/XlsReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.alibaba.alink.common.io.xls; | ||
|
||
import org.apache.flink.api.common.io.RichInputFormat; | ||
import org.apache.flink.api.java.tuple.Tuple2; | ||
import org.apache.flink.core.fs.FileInputSplit; | ||
import org.apache.flink.ml.api.misc.param.Params; | ||
import org.apache.flink.table.api.TableSchema; | ||
import org.apache.flink.types.Row; | ||
|
||
public interface XlsReader { | ||
Tuple2 <RichInputFormat <Row, FileInputSplit>, TableSchema> create(Params params); | ||
} |
45 changes: 45 additions & 0 deletions
45
core/src/main/java/com/alibaba/alink/common/io/xls/XlsReaderClassLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.alibaba.alink.common.io.xls; | ||
|
||
import com.alibaba.alink.common.exceptions.AkPluginErrorException; | ||
import com.alibaba.alink.common.io.plugin.ClassLoaderContainer; | ||
import com.alibaba.alink.common.io.plugin.ClassLoaderFactory; | ||
import com.alibaba.alink.common.io.plugin.PluginDistributeCache; | ||
import com.alibaba.alink.common.io.plugin.RegisterKey; | ||
import com.alibaba.alink.common.io.plugin.TemporaryClassLoaderContext; | ||
|
||
import java.util.Iterator; | ||
import java.util.ServiceLoader; | ||
|
||
public class XlsReaderClassLoader extends ClassLoaderFactory { | ||
private final static String XLS_NAME = "xls"; | ||
|
||
public XlsReaderClassLoader(String version) { | ||
super(new RegisterKey(XLS_NAME, version), PluginDistributeCache.createDistributeCache(XLS_NAME, version)); | ||
} | ||
|
||
public static XlsReader create(XlsReaderClassLoader factory) { | ||
ClassLoader classLoader = factory.create(); | ||
|
||
try (TemporaryClassLoaderContext context = TemporaryClassLoaderContext.of(classLoader)) { | ||
Iterator <XlsReader> iter = ServiceLoader | ||
.load(XlsReader.class, classLoader) | ||
.iterator(); | ||
if (iter.hasNext()) { | ||
return iter.next(); | ||
} else { | ||
throw new AkPluginErrorException("Could not find the class factory in classloader."); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public ClassLoader create() { | ||
return ClassLoaderContainer.getInstance().create( | ||
registerKey, | ||
distributeCache, | ||
XlsReader.class, | ||
xlsReader -> true, | ||
descriptor -> registerKey.getVersion() | ||
); | ||
} | ||
} |
Oops, something went wrong.