Package com.illumon.iris.importers
Class JsonSchemaCreator
java.lang.Object
com.illumon.iris.importers.JsonSchemaCreator
public class JsonSchemaCreator extends Object
-
Constructor Summary
Constructors Constructor Description JsonSchemaCreator(com.fishlib.io.logger.Logger log, StatusCallback progress)
-
Method Summary
Modifier and Type Method Description CsvImporterHelper
getInitializedCsvImporterHelper(File sourceFile, com.fishlib.io.logger.Logger log)
Using a Json to CSV input stream, sets up and returns a CsvImporterHelper to provide column details and record parsing capabilities.String
getTableSchema(String namespace, String table, String groupingColumn, String partitionColumn, String sourceName, String sourcePartitionColumn, File sourceFile, boolean bestFit, boolean logProgress, long maxRows)
Get an XML String of table schema based on a file and user-provided options.static void
main(String... args)
Regular main entry point, used when this module is called from a java command line, or from an IntelliJ run configuration.
-
Constructor Details
-
Method Details
-
getInitializedCsvImporterHelper
public CsvImporterHelper getInitializedCsvImporterHelper(@NotNull File sourceFile, com.fishlib.io.logger.Logger log)Using a Json to CSV input stream, sets up and returns a CsvImporterHelper to provide column details and record parsing capabilities.- Parameters:
sourceFile
- File object pointing to the CSV file to be analyzed.log
- An Iris event logger object.- Returns:
- A CsvImporterHelper that can process the passed sourceFile.
-
getTableSchema
public String getTableSchema(String namespace, String table, String groupingColumn, String partitionColumn, String sourceName, String sourcePartitionColumn, File sourceFile, boolean bestFit, boolean logProgress, long maxRows)Get an XML String of table schema based on a file and user-provided options. This method is public so other applications, like the Schema Editor, can use it.- Parameters:
namespace
- Namespace to use for the new schema.table
- Table name to use for the new schema.groupingColumn
- Optional single column name to mark as a Grouping column.partitionColumn
- Which column to use as the Partitioning column.sourceName
- Name to use for the CSV InputSource.sourcePartitionColumn
- Column name in the source data to use for multi-partition importssourceFile
- File object pointing to the CSV file to be analyzed.logProgress
- Whether to update the log with progress percentages.maxRows
- A maximum number of rows to read, rather than reading the whole file. A value of zero or less means to read the whole file.- Returns:
- A String with the XML of derived table schema and CSV import instructions.
-
main
Regular main entry point, used when this module is called from a java command line, or from an IntelliJ run configuration.- Parameters:
args
- Varargs list of arguments in Apache CLI format
-