Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions hudi-cli/src/main/java/org/apache/hudi/cli/HoodieCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import org.apache.hudi.common.util.ConsistencyGuardConfig;
import org.apache.hudi.common.util.FSUtils;

/**
* This class is responsible to load table metadata and hoodie related configs.
*/
public class HoodieCLI {

public static Configuration conf;
Expand All @@ -35,6 +38,9 @@ public class HoodieCLI {
public static HoodieTableMetaClient tableMetadata;
public static HoodieTableMetaClient syncTableMetadata;

/**
* Enum for CLI state.
*/
public enum CLIState {
INIT, DATASET, SYNC
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import org.springframework.shell.plugin.support.DefaultHistoryFileNameProvider;
import org.springframework.stereotype.Component;

/**
* CLI history file provider.
*/
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
public class HoodieHistoryFileNameProvider extends DefaultHistoryFileNameProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
import org.apache.hudi.common.util.Option;

/**
* Helper class to render table for hoodie-cli
* Helper class to render table for hoodie-cli.
*/
public class HoodiePrintHelper {

/**
* Print header and raw rows
* Print header and raw rows.
*
* @param header Header
* @param rows Raw Rows
Expand All @@ -41,7 +41,7 @@ public static String print(String[] header, String[][] rows) {
}

/**
* Serialize Table to printable string
* Serialize Table to printable string.
*
* @param rowHeader Row Header
* @param fieldNameToConverterMap Field Specific Converters
Expand Down Expand Up @@ -71,7 +71,7 @@ public static String print(TableHeader rowHeader, Map<String, Function<Object, S
}

/**
* Render rows in Table
* Render rows in Table.
*
* @param buffer Table
* @return output
Expand All @@ -86,7 +86,7 @@ private static String print(Table buffer) {
}

/**
* Render only header of the table
* Render only header of the table.
*
* @param header Table Header
* @return output
Expand All @@ -98,7 +98,7 @@ private static String print(TableHeader header) {
}

/**
* Print Text table
* Print Text table.
*
* @param headers Headers
* @param data Table
Expand Down
3 changes: 3 additions & 0 deletions hudi-cli/src/main/java/org/apache/hudi/cli/HoodiePrompt.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import org.springframework.shell.plugin.support.DefaultPromptProvider;
import org.springframework.stereotype.Component;

/**
* This class deals with displaying prompt on CLI based on the state.
*/
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
public class HoodiePrompt extends DefaultPromptProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import org.springframework.shell.support.util.OsUtils;
import org.springframework.stereotype.Component;

/**
* This class is responsible to print the splash screen at the start of the application.
*/
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
public class HoodieSplashScreen extends DefaultBannerProvider {
Expand Down
6 changes: 3 additions & 3 deletions hudi-cli/src/main/java/org/apache/hudi/cli/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import java.io.IOException;
import org.springframework.shell.Bootstrap;

/**
* Main class that delegates to Spring Shell's Bootstrap class in order to simplify debugging inside an IDE.
*/
public class Main {

/**
* Main class that delegates to Spring Shell's Bootstrap class in order to simplify debugging inside an IDE
*/
public static void main(String[] args) throws IOException {
System.out.println("Main called");
new HoodieSplashScreen();
Expand Down
10 changes: 5 additions & 5 deletions hudi-cli/src/main/java/org/apache/hudi/cli/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public Table(TableHeader rowHeader, Map<String, Function<Object, String>> fieldN
}

/**
* Main API to add row to the table
* Main API to add row to the table.
*
* @param row Row
*/
Expand All @@ -82,7 +82,7 @@ public Table add(List<Comparable> row) {
}

/**
* Add all rows
* Add all rows.
*
* @param rows Rows to be aded
* @return
Expand All @@ -93,7 +93,7 @@ public Table addAll(List<List<Comparable>> rows) {
}

/**
* Add all rows
* Add all rows.
*
* @param rows Rows to be added
* @return
Expand All @@ -104,7 +104,7 @@ public Table addAllRows(List<Comparable[]> rows) {
}

/**
* API to let the table know writing is over and reading is going to start
* API to let the table know writing is over and reading is going to start.
*/
public Table flip() {
this.finishedAdding = true;
Expand All @@ -113,7 +113,7 @@ public Table flip() {
}

/**
* Sorting of rows by a specified field
* Sorting of rows by a specified field.
*
* @return
*/
Expand Down
12 changes: 6 additions & 6 deletions hudi-cli/src/main/java/org/apache/hudi/cli/TableHeader.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
import java.util.List;

/**
* Header for the table to be rendered
* Header for the table to be rendered.
*/
public class TableHeader {

// List of fields (columns)
private final List<String> fieldNames = new ArrayList<>();

/**
* Add a field (column) to table
* Add a field (column) to table.
*
* @param fieldName field Name
*/
Expand All @@ -40,14 +40,14 @@ public TableHeader addTableHeaderField(String fieldName) {
}

/**
* Get all field names
* Get all field names.
*/
public List<String> getFieldNames() {
return fieldNames;
}

/**
* Index of the field in the table
* Index of the field in the table.
*
* @param fieldName Field Name
*/
Expand All @@ -56,14 +56,14 @@ public int indexOf(String fieldName) {
}

/**
* Lookup field by offset
* Lookup field by offset.
*/
public String get(int index) {
return fieldNames.get(index);
}

/**
* Get number of fields in the table
* Get number of fields in the table.
*/
public int getNumFields() {
return fieldNames.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

/**
* CLI command to display archived commits and stats if available.
*/
@Component
public class ArchivedCommitsCommand implements CommandMarker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

/**
* CLI command to show cleans options.
*/
@Component
public class CleansCommand implements CommandMarker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

/**
* CLI command to display commits options.
*/
@Component
public class CommitsCommand implements CommandMarker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

/**
* CLI command to display compaction related options.
*/
@Component
public class CompactionCommand implements CommandMarker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

/**
* CLI command to display hudi dataset options.
*/
@Component
public class DatasetsCommand implements CommandMarker {

Expand Down Expand Up @@ -67,7 +70,7 @@ public String connect(
}

/**
* Create a Hoodie Table if it does not exist
* Create a Hoodie Table if it does not exist.
*
* @param path Base Path
* @param name Hoodie Table Name
Expand Down Expand Up @@ -113,7 +116,7 @@ public boolean isDescAvailable() {
}

/**
* Describes table properties
* Describes table properties.
*/
@CliCommand(value = "desc", help = "Describle Hoodie Table properties")
public String descTable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

/**
* CLI command to display file system options.
*/
@Component
public class FileSystemViewCommand implements CommandMarker {

Expand Down Expand Up @@ -206,7 +209,7 @@ public String showLatestFileSlices(
}

/**
* Build File System View
* Build File System View.
*
* @param globRegex Path Regex
* @param maxInstant Max Instants to be used for displaying file-instants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
import org.springframework.stereotype.Component;
import scala.collection.JavaConverters;

/**
* CLI command for importing parquet dataset to hudi dataset.
*/
@Component
public class HDFSParquetImportCommand implements CommandMarker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
import scala.Tuple2;
import scala.Tuple3;

/**
* CLI command to display log file options.
*/
@Component
public class HoodieLogFileCommand implements CommandMarker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

/**
* CLI command to display sync options.
*/
@Component
public class HoodieSyncCommand implements CommandMarker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

/**
* CLI command to display and trigger repair options.
*/
@Component
public class RepairsCommand implements CommandMarker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

/**
* CLI command to display rollback options.
*/
@Component
public class RollbacksCommand implements CommandMarker {

Expand Down Expand Up @@ -115,7 +118,7 @@ public String showRollback(
}

/**
* An Active timeline containing only rollbacks
* An Active timeline containing only rollbacks.
*/
class RollbackTimeline extends HoodieActiveTimeline {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

/**
* CLI command to display savepoint options.
*/
@Component
public class SavepointsCommand implements CommandMarker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.SQLContext;

/**
* This class deals with initializing spark context based on command entered to hudi-cli.
*/
public class SparkMain {

protected static final Logger LOG = Logger.getLogger(SparkMain.class);

/**
* Commands
* Commands.
*/
enum SparkCommand {
ROLLBACK, DEDUPLICATE, ROLLBACK_TO_SAVEPOINT, SAVEPOINT, IMPORT, UPSERT, COMPACT_SCHEDULE, COMPACT_RUN, COMPACT_UNSCHEDULE_PLAN, COMPACT_UNSCHEDULE_FILE, COMPACT_VALIDATE, COMPACT_REPAIR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.stereotype.Component;

/**
* CLI command to displays stats options.
*/
@Component
public class StatsCommand implements CommandMarker {

Expand Down
Loading