我正在研究构建一个自定义的Spark SQL CSVinferchema来识别自定义数据类型(那些未使用该inferschema选项标识的数据类型).我使用a StringIndexer来获取唯一的分类值来标识自定义数据类型.
String[] categoricalStringValues = new StringIndexer().setInputCol(columnName).fit(dataframe).labels();
// Code to identify/guess the most likely custom datatype
// some examples: currency ($12.00), percent (24.05%) etc
Run Code Online (Sandbox Code Playgroud)
这个过程非常缓慢.我找到了CSVInferSchemascala代码.有没有一种方法可以调用,使用或解释此类来开发代码来识别自定义数据类型?