You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/25 17:17:28 UTC

[GitHub] [arrow] lidavidm commented on a diff in pull request #12982: ARROW-16311: [JAVA] do not return table_schema column when it's not requrested

lidavidm commented on code in PR #12982:
URL: https://github.com/apache/arrow/pull/12982#discussion_r857855555


##########
java/flight/flight-sql/src/test/java/org/apache/arrow/flight/sql/example/FlightSqlExample.java:
##########
@@ -1488,7 +1488,14 @@ public void getStreamSchemas(final CommandGetDbSchemas command, final CallContex
   @Override
   public FlightInfo getFlightInfoTables(final CommandGetTables request, final CallContext context,
                                         final FlightDescriptor descriptor) {
-    return getFlightInfoForSchema(request, descriptor, Schemas.GET_TABLES_SCHEMA);
+
+    Schema schemaToUse = Schemas.GET_TABLES_SCHEMA;
+
+    if (!request.getIncludeSchema()) {
+      schemaToUse = Schemas.GET_TABLES_SCHEMA_NO_SCHEMA;
+    }
+
+    return getFlightInfoForSchema(request, descriptor, schemaToUse);

Review Comment:
   nit: no need for so many newlines
   ```suggestion
       Schema schemaToUse = Schemas.GET_TABLES_SCHEMA;
       if (!request.getIncludeSchema()) {
         schemaToUse = Schemas.GET_TABLES_SCHEMA_NO_SCHEMA;
       }
   
       return getFlightInfoForSchema(request, descriptor, schemaToUse);
   ```



##########
java/flight/flight-sql/src/test/java/org/apache/arrow/flight/TestFlightSql.java:
##########
@@ -180,6 +180,14 @@ public void testGetTablesSchema() {
     collector.checkThat(info.getSchema(), is(FlightSqlProducer.Schemas.GET_TABLES_SCHEMA));
   }
 
+  @Test
+  public void testGetTablesSchemaExcludeSchema() {
+    final FlightInfo info = sqlClient.getTables(null, null, null, null, false);
+    collector.checkThat(info.getSchema(), is(FlightSqlProducer.Schemas.GET_TABLES_SCHEMA_NO_SCHEMA));
+  }
+
+
+

Review Comment:
   nit: no need for so many newlines
   ```suggestion
     public void testGetTablesSchemaExcludeSchema() {
       final FlightInfo info = sqlClient.getTables(null, null, null, null, false);
       collector.checkThat(info.getSchema(), is(FlightSqlProducer.Schemas.GET_TABLES_SCHEMA_NO_SCHEMA));
     }
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org