GoogleCloudPlatform / bigquery-antipattern-recognition

Utility to identify and rewrite common anti patterns in BigQuery SQL syntax
Apache License 2.0
82 stars 28 forks source link

No output on adding params --output_file_path nor --output_table #13

Closed duongphannamhung closed 7 months ago

duongphannamhung commented 1 year ago

I have already read issue #5 and in my case it's worse, there're no output on both params. I try on both Docker and build java with maven on Google Cloud Shell with this cmd

mvn clean package -DskipTests

java -cp target/bigquery-antipattern-recognition-0.1.1-SNAPSHOT-jar-with-dependencies.jar \
     com.google.zetasql.toolkit.antipattern.parser.Main --read_from_info_schema \
     --read_from_info_schema_days 1 \
     --processing_project_id <project> \    
     --output_table "<project>.<dataset>.antipattern_output_table"

On catching exception I got at OutputGenerator.writeOutputToCSV

java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class [Ljava.lang.String; ([Ljava.lang.Object; and [Ljava.lang.String; are in module java.base of loader 'bootstrap')
        at com.google.zetasql.toolkit.antipattern.cmd.OutputGenerator.writeOutputToCSV(OutputGenerator.java:66)
        at com.google.zetasql.toolkit.antipattern.cmd.OutputGenerator.writeOutput(OutputGenerator.java:36)

so I write a class to unbox and handle the Output Result, especially the recommendation output at PR #16 . Hope it's working out.