code: private void check() throws CouchbaseLiteException {
          synchronized (lock) {
              if (c4query != null) { return; }
  
              database = (Database) from.getSource();
              final String json = encodeAsJson();
              Log.v(DOMAIN, "Query encoded as %s", json);
              if (json == null) { throw new CouchbaseLiteException("Failed to generate JSON query."); }
  
              if (columnNames == null) { columnNames = generateColumnNames(); }
  
              try {
                  c4query = database.getC4Database().createQuery(json);
              }
              catch (LiteCoreException e) {
                  throw CBLStatus.convertException(e);
              }
          }
      }
docs: ---------------------------------------------