protected String constructQuery(String table, String[] columnNames) {
    if(columnNames == null) {
      throw new IllegalArgumentException("Column names may not be null");
    }

    StringBuilder query = new StringBuilder();
    query.append("INSERT INTO ").append(table).append(" VALUES (");

    for (int i = 0; i < columnNames.length; i++) {
      query.append("?");
      if(i != columnNames.length - 1) {
        query.append(",");
      }
    }
    query.append(");");
    return query.toString();
  }
Constructs the query used as the prepared statement to insert data.

@param table
         the table to insert into
@param columnNames
         the columns to insert into
jdbc-handler/src/main/java/org/apache/hive/storage/jdbc/dao/GenericJdbcDatabaseAccessor.java