public static String getRequestPayload(PinotQueryGenerator.GeneratedPinotQuery pinotQuery)
    {
        ImmutableMap<String, String> pinotRequest = ImmutableMap.of(REQUEST_PAYLOAD_KEY, pinotQuery.getQuery());
        try {
            return OBJECT_MAPPER.writeValueAsString(pinotRequest);
        }
        catch (JsonProcessingException e) {
            throw new PinotException(
                    PINOT_REQUEST_GENERATOR_FAILURE,
                    Optional.of(pinotQuery.getQuery()),
                    "Unable to Jsonify request: " + Arrays.toString(pinotRequest.entrySet().toArray()),
                    e);
        }
    }
@Test
    public void testPinotBrokerRequest()
    {
        PinotQueryGenerator.GeneratedPinotQuery generatedPinotQuery = new PinotQueryGenerator.GeneratedPinotQuery(
                pinotTable.getTableName(),
                "SELECT * FROM myTable",
                ImmutableList.of(),
                false,
                false);

        PinotBrokerPageSource pageSource = new PinotBrokerPageSource(
                pinotConfig,
                new TestingConnectorSession(ImmutableList.of(
                        booleanProperty(
                                "mark_data_fetch_exceptions_as_retriable",
                                "Retry Pinot query on data fetch exceptions",
                                pinotConfig.isMarkDataFetchExceptionsAsRetriable(),
                                false))),
                generatedPinotQuery,
                ImmutableList.of(),
                ImmutableList.of(),
                new MockPinotClusterInfoFetcher(pinotConfig),
                objectMapper,
                PinotBrokerAuthenticationProvider.create(PinotEmptyAuthenticationProvider.instance()));
        assertEquals(PinotBrokerPageSource.getRequestPayload(generatedPinotQuery), "{\"sql\":\"SELECT * FROM myTable\"}");

        generatedPinotQuery = new PinotQueryGenerator.GeneratedPinotQuery(
                pinotTable.getTableName(),
                "SELECT * FROM myTable WHERE jsonStr = '\"{\"abc\" : \"def\"}\"'",
                ImmutableList.of(),
                false,
                false);
        assertEquals(PinotBrokerPageSource.getRequestPayload(generatedPinotQuery), "{\"sql\":\"SELECT * FROM myTable WHERE jsonStr = '\\\"{\\\"abc\\\" : \\\"def\\\"}\\\"'\"}");
    }