[ https://issues.apache.org/jira/browse/ARROW-1780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16423021#comment-16423021 ]
ASF GitHub Bot commented on ARROW-1780: --------------------------------------- atuldambalkar commented on a change in pull request #1759: ARROW-1780 - [WIP] JDBC Adapter to convert Relational Data objects to Arrow Data Format Vector Objects URL: https://github.com/apache/arrow/pull/1759#discussion_r178626181 ########## File path: java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/ArrowDataFetcher.java ########## @@ -0,0 +1,107 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.arrow.adapter.jdbc; + +import org.apache.arrow.vector.VectorSchemaRoot; + +import java.sql.Connection; + +/** + * Class to fetch data from a given database table where user can specify columns to fetch + * along with limit and offset parameters. + * + * The object of this class is returned by invoking method jdbcArrowDataFetcher(Connection connection, String tableName) + * from {@link JdbcToArrow} class. Caller can use this object to fetch data repetitively based on the + * data fetch requirement and can implement pagination like functionality. + * + * This class doesn't hold any open connections to database but simply executes the "select" query everytime with + * the necessary limit and offset parameters. + * + * @since 0.10.0 + * @see JdbcToArrow + */ +public class ArrowDataFetcher { + + private static final String all_columns_query = "select * from %s limit %d offset %d"; Review comment: Yes, this is true, my bad! I was aware of this and should have thought through before implementing this. What I am thinking here now is to come up with a Java enum for all the databases and maintain a map or constant string with (limit/offset) query specific to each database. This way I can support - ORACLE_12C, MYSQL, DB2, SQL_SERVER_2012, SQL_SERVER_2008, POSTGRESQL, H2, SQLDB, INGRES, DERBY, SQLITE, CUBRID, SYBASE_ASE, SYBASE_SQL_ANYWHERE, FIREBIRD. But the only problem here is in writing test cases. What do you think about this approach and if this is okay, how we can go about testing the code for each database? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > JDBC Adapter for Apache Arrow > ----------------------------- > > Key: ARROW-1780 > URL: https://issues.apache.org/jira/browse/ARROW-1780 > Project: Apache Arrow > Issue Type: New Feature > Reporter: Atul Dambalkar > Assignee: Atul Dambalkar > Priority: Major > Labels: pull-request-available > Fix For: 0.10.0 > > > At a high level the JDBC Adapter will allow upstream apps to query RDBMS data > over JDBC and get the JDBC objects converted to Arrow objects/structures. The > upstream utility can then work with Arrow objects/structures with usual > performance benefits. The utility will be very much similar to C++ > implementation of "Convert a vector of row-wise data into an Arrow table" as > described here - > https://arrow.apache.org/docs/cpp/md_tutorials_row_wise_conversion.html > The utility will read data from RDBMS and covert the data into Arrow > objects/structures. So from that perspective this will Read data from RDBMS, > If the utility can push Arrow objects to RDBMS is something need to be > discussed and will be out of scope for this utility for now. -- This message was sent by Atlassian JIRA (v7.6.3#76005)