-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create option for machine readable output for scan #984
Comments
Suggestion: make a refactoring on org.apache.fluo.core.util.ScanUtil to receive a java.io.OutputStream or a java.io.Writer or both to avoid something like that: System.out.println(sb.toString()); Could this be done in that same thread? |
I think passing in something like an OutputStream is much cleaner. Would need to preserve the |
I'm working on this. Do you think we could use the commons-csv lib? I'm creating some properties on fluo-app to CSV format: ## Fluo Scan properties
## -----------------
## Properties to export the scan result to CSV format.
fluo.scan.csv.delimiter = ;
fluo.scan.csv.header = true
fluo.scan.csv.quote = "
# Possible values: ALL, ALL_NON_NULL, MINIMAL, NON_NUMERIC and NONE
# @see org.apache.commons.csv.QuoteMode
fluo.scan.csv.quoteMode = ALL
fluo.scan.csv.comment = #
fluo.scan.csv.escape = \ |
In distribution module, fetch.sh file, are there any reason for this dependency to be in this version? download com.google.code.gson:gson:jar:2.2.4 In Fluo pom.xml we are in 2.8.0. Can I upgrade to use for the --json scan? |
Sample of CSV file:
JSON file: [root@6cf4e94e7248 share]# fluo scan -a myapp --json
{"ROW":"HISTORICO:123:1:10:100:0a5f7383-58ec-48e1-8a4a-545bb99ace9f","COLUMN_FAMILY":"cadastral","COLUMN_QUALIFIER":"cadastralDAT_NSC","COLUMN_VISIBILITY":"","VALUE":"111111111"}
{"ROW":"HISTORICO:123:1:10:100:0a5f7383-58ec-48e1-8a4a-545bb99ace9f","COLUMN_FAMILY":"cadastral","COLUMN_QUALIFIER":"cadastralNOM_RAZ_SOC","COLUMN_VISIBILITY":"","VALUE":"yyy"}
{"ROW":"HISTORICO:123:1:10:100:60aabb11-cc1a-4bdd-9c12-29545ceae5ea","COLUMN_FAMILY":"cadastral","COLUMN_QUALIFIER":"cadastralDAT_NSC","COLUMN_VISIBILITY":"","VALUE":"111111111"}
{"ROW":"HISTORICO:123:1:10:100:60aabb11-cc1a-4bdd-9c12-29545ceae5ea","COLUMN_FAMILY":"cadastral","COLUMN_QUALIFIER":"cadastralNOM_RAZ_SOC","COLUMN_VISIBILITY":"","VALUE":"yyy"}
{"ROW":"HISTORICO:123:1:10:100:d4cc616a-629a-4361-b7ee-0efa007a400b","COLUMN_FAMILY":"cadastral","COLUMN_QUALIFIER":"cadastralDAT_NSC","COLUMN_VISIBILITY":"","VALUE":"111111111"}
{"ROW":"HISTORICO:123:1:10:100:d4cc616a-629a-4361-b7ee-0efa007a400b","COLUMN_FAMILY":"cadastral","COLUMN_QUALIFIER":"cadastralNOM_RAZ_SOC","COLUMN_VISIBILITY":"","VALUE":"yyy"} |
My slight preference would be to make the csv options command line options. The reason is that I think this would give more predictable results. However I can see the convenience of putting the options in the config file. So I am uncertain which is best. If doing command line options, could be something like the following.
I would replace I think using commons csv is fine. For the json dependency upgrade we need to make sure it does not cause issue with Accumulo and Hadoop libraries. If it does not, then its ok to upgrade. |
About the config in the command line, I believe is possible keep both. It’s a good idea! About the short names. Sounds good! Done! About the dependence, is it common this two versions of the same component? |
I think its ok to update gson to 2.8.0 in the fetch script. I was looking at |
Now we have 3 options to configure the scan command:
[root@9bb10c2c941e share]# fluo scan -a myapp --csv
[root@9bb10c2c941e share]# fluo scan -a myapp --csv --csv-delimiter '|'
[root@9bb10c2c941e share]# fluo scan -a myapp --csv -o fluo.scan.csv.delimiter='|' |
I forgot about |
It would be useful if the fluo scan command had an option to produce machine readable output. This could be something like
fluo scan -a app1 --json
orfluo scan -s app1 --csv
. Not sure what the best format to use for the output is. If we start with something like a--json
option then we can always add something like a--csv
option later.The text was updated successfully, but these errors were encountered: