You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by gengliangwang <gi...@git.apache.org> on 2018/04/09 17:31:13 UTC
[GitHub] spark pull request #20535: [SPARK-23341][SQL] define some standard options f...
Github user gengliangwang commented on a diff in the pull request:
https://github.com/apache/spark/pull/20535#discussion_r180171421
--- Diff: sql/core/src/main/java/org/apache/spark/sql/sources/v2/DataSourceOptions.java ---
@@ -97,4 +142,66 @@ public double getDouble(String key, double defaultValue) {
return keyLowerCasedMap.containsKey(lcaseKey) ?
Double.parseDouble(keyLowerCasedMap.get(lcaseKey)) : defaultValue;
}
+
+ /**
+ * The option key for singular path.
+ */
+ public static final String PATH_KEY = "path";
+
+ /**
+ * The option key for multiple paths.
+ */
+ public static final String PATHS_KEY = "paths";
+
+ /**
+ * The option key for table name.
+ */
+ public static final String TABLE_KEY = "table";
+
+ /**
+ * The option key for database name.
+ */
+ public static final String DATABASE_KEY = "database";
+
+ /**
+ * Returns the value of the singular path option.
+ */
+ public Optional<String> path() {
+ return get(PATH_KEY);
+ }
+
+ /**
+ * Returns all the paths specified by both the singular path option and the multiple
+ * paths option.
+ */
+ public String[] paths() {
+ String[] singularPath = path().map(s -> new String[]{s}).orElseGet(() -> new String[0]);
+ Optional<String> pathsStr = get(PATHS_KEY);
+ System.out.println(pathsStr);
--- End diff --
remove println :)
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org