The Redis Presto connector encounters key corruption when using the `redis.key-prefix-schema-table=true` setting with JSON data format

I am in the process of setting up Presto and Redis on my local machine using the instructions provided in the Presto-Redis Documentation.

Problem Overview:

When I set

redis.key-prefix-schema-table=true
and use the prefix dev:simple_table: for a Redis key (as recommended by the Presto Redis connector page), all key columns appear as null with the internal column _key_corrupt being true. However, the value columns are parsed correctly.

On the other hand, when I utilize

redis.key-prefix-schema-table=false
and employ pure JSON key and value strings, everything functions as expected. (note: I also attempted to use the csv dataFormat without success)

What's Working:

I have successfully set up an example involving a Redis server and a Presto server running on my local setup.

This is the content of `etc/catalog/redis.properties` file used by Presto:

connector.name=redis
redis.table-names=simple_table
redis.default-schema=dev
redis.nodes=127.0.0.1:6379
redis.table-description-dir=/Users/acarson/var/redis/tables
redis.key-delimiter=:
redis.key-prefix-schema-table=false
redis.hide-internal-columns=false

A table definition file exists at

/Users/acarson/var/redis/tables/simple_table.json

{
    "tableName": "simple_table",
    "schemaName": "dev",
    "key": {
        "dataFormat": "json",
        "fields": [
            {
                "name": "id",
                "mapping": "id",
                "type": "BIGINT"
            },
            {
                "name": "word",
                "mapping": "word",
                "type": "VARCHAR"
            }
        ]
    },
    "value": {
        "dataFormat": "json",
        "fields": [
            {
                "name": "name",
                "mapping": "name",
                "type": "VARCHAR"
            },
            {
                "name": "number",
                "mapping": "number",
                "type": "BIGINT"
            },
            {
                "name": "boolean",
                "mapping": "boolean",
                "type": "BOOLEAN"
            }
        ]
    }
}

Using redis-cli, I insert a value using the following command:

 SET '{"id": 42, "word": "foo"}' '{"name": "bar", "number": 3, "boolean": "false"}'

Subsequently, I'm able to query the data using the Presto CLI and the resulting columns display as expected:

presto:dev> SELECT * FROM simple_table;
 id | word | name | number | boolean |           _key            |                      _value                      | _key_length | _value_length | _key_corrupt | _value_corrupt 
----+------+------+--------+---------+---------------------------+--------------------------------------------------+-------------+---------------+--------------+----------------
 42 | foo  | bar  |      3 | false   | {"id": 42, "word": "foo"} | {"name": "bar", "number": 3, "boolean": "false"} |          25 |            48 | false        | false          

Issue Encountered:

Upon changing the value of redis.key-prefix-schema-table to true in redis.properties, restarting Presto, clearing all keys in redis-cli with FLUSHALL, and inserting a new row using the schema table prefix:

SET 'dev:simple_table:{"id": 42, "word": "foo"}' '{"name": "bar", "number": 3, "boolean": "false"}'

Querying from Presto CLI reveals that _key_corrupt=true and the key values are null, despite the values working fine.

presto:dev> SELECT * FROM simple_table;
  id  | word |  name  | number | boolean |                     _key                      |                       _value                        | _key_length | _value_length | _key_corrupt | _value_corrupt 
------+------+--------+--------+---------+-----------------------------------------------+-----------------------------------------------------+-------------+---------------+--------------+----------------
 NULL | NULL | bar    |      3 | false   | dev:simple_table:{"id": 42, "word": "foo"}    | {"name": "bar", "number": 3, "boolean": "false"}    |          42 |            48 | true         | false          

I have examined the log levels of both Redis and Presto for clues, but so far, nothing indicates any errors or explanations for why the key might be corrupt. It seems like there could be an issue with my syntax for defining Redis keys, even though I am adhering to the exact method outlined in the Presto Redis documentation and also referring to the Presto-Redis source code which specifies keys should follow the format "schema:table:*" with this flag.

Here are excerpts from the Presto logs at debug level during the query execution:

2016-10-20T17:09:55.048-0700    INFO    main    com.facebook.presto.server.PrestoServer ======== SERVER STARTED ========
(Additional log entries as described were deleted for brevity)

Answer №1

Perhaps you should consider escaping this line: Have you attempted to delete it, given that : is the default in any case.

redis.key-delimiter=:

Furthermore, your prefix contains a trailing :, which should be omitted:

SET 'dev:simple_table{"id": 42, "word": "foo"}' '{"name": "bar", "number": 3, "boolean": "false"}'

instead of

SET 'dev:simple_table:{"id": 42, "word": "foo"}' '{"name": "bar", "number": 3, "boolean": "false"}'

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

When working with Java, it is important to remember that a JSONObject text always needs to start with a '{' at the first character

I've been struggling to troubleshoot a JAXB JSON issue, but I can't seem to pinpoint the source of the problem. The error message I'm receiving states: Caused by: org.codehaus.jettison.json.JSONException: A JSONObject text must begin with & ...

Is it possible to use regex to retrieve the values associated with a specific property from an array of JSON objects?

I am currently working with a JSON payload stored in a column within an ADX cluster, and I need to extract specific data from it. [ { "RailType":"HE400", "InstallationDate":"2017-07-19T16:00:00.0000000Z&quo ...

Why is the toggle list not functioning properly following the JSON data load?

I attempted to create a color system management, but as a beginner, I find it quite challenging! My issue is: When I load my HTML page, everything works fine. However, when I click on the "li" element to load JSON, all my toggle elements stop working!!! ...

PHP WebService, exclusively containing private variables within an empty array

I'm attempting to create a PHP webservice. In the "Aluno" class, there are 2 private variables. After struggling all day with this, I finally discovered that if I change those variables to public, everything works as expected. However, if they remain ...

Optimal method for incorporating Django with an Ajax framework

When it comes to integrating javascript libraries with a Django application, the options are abundant and diverse. Personally, I am leaning towards utilizing jQuery due to its popularity and robust features, although I am open to exploring other alternativ ...

Is it possible to incorporate a map into my HTTP API to enhance its flexibility and functionality?

My http api utilizes JSON to transmit parameters, which appear as follows: { param1: xxx param2: xxx param3: xxx } However, my system operates using a plugin system where each plugin requires its own set of parameters within the JSON body. All plug ...

What is the best way to evaluate a value in comparison to the previous object?

My current task involves using jq to organize log entries obtained from journalctl -o json in a more readable format. While this process is going smoothly, I've encountered an issue regarding the identification of a system reboot within the log data. ...

Obtain POST information through AJAX and jQuery

post.js $.post( "/scripts/update.php", {id: testId, age: testAge}, function(data) { $(".testDiv").html(data.testId); $(".testDiv2").html(data.testAge); } ); update.php $userId = $_POST["id"]; $userAge = $_POST["age]; // contact database ...

retrieve data for chart from an AJAX request

I am looking to create a chart using amCharts and I have received some values from the server through an ajax call. Now, I need help in utilizing this data for my chart. Can anyone guide me on how to achieve this? var chart = am4core.create("chartdiv& ...

Tips for showcasing API's JSON data in SwiftUI?

I have received JSON data from an API and I need to display a specific value from it as text. Here is a snippet of the JSON data: { "d": "2019-09-20", "v": 56.62 }, { "d": "2019-09-23", "v": 56.93 } To ha ...

What is the best location to save a .json file in an Android Studio project for easy access with FileReader?

I have successfully developed an Android Studio app using Libgdx that is capable of reading a .json file stored in the project folder The code snippet for accessing the file looks like this: private void readFile() { JsonParser jsonParser = new Json ...

Verify key in JSON object using org.json.simple library in Java

Is there a way to convert a key into a JSONObject using the org.json.simple library? I've tried a few methods but encountered errors in each attempt. 1st Attempt JSONObject name1 = (JSONObject) jsonObject.get(key); Error: cannot convert java.lan ...

Creating a Clojure package for improved functionality

Attempting to use the hierarchical-classifier.clj script from GitHub, I encountered an issue when trying to modify the path within *directory-string* to point to my Dropbox directory containing text files. The REPL threw a compiler exception for org.apache ...

methods for obtaining access in JavaScript when dealing with an ArrayList<Object> that has been converted to a JSONArray

I am dealing with an Object ArrayList that contains various variables, stored in an ArrayList of Objects. I then convert it to a JSONArray and pass it to a JSP page. How can I display these objects in a textarea on the JSP page using JavaScript? public cl ...

issue involving extension that interrupts downloads

Trying to develop a browser extension that can intercept downloads and automatically rename them. manifest.json: { "name": " Book Renamer", "description": "Automatically rename downloaded ebooks from gutenberg.or ...

In Laravel, saving null data of JSON type is stored as [null]

I am attempting to save JSON data in my database. Here is the migration: $table->json('email_signature')->nullable(); In the model, I have specified: protected $casts = [ 'email_signature' => 'array' ]; Within ...

Encountering a JavaScript toJSON custom method causing a StackOverflow error

Unique Scenario Upon discovering this answer, a new idea struck me - creating an object from a JSON literal. This led me to believe I could do the opposite using the handy JSON method: JSON.stringify(myObject). Curious, I proceeded as follows: function ...

AngularJS: The $http.get request for JSON data from eBay is malfunctioning

I'm feeling lost and needing some guidance. When I make an ebay search request, the browser displays a JSON response. I saved this JSON in a file named v1 on my website. However, when I tried to access it through a $http.get request, it returned null. ...

Exploring Dynamic Datatype for Deserializing JSON in WinRT

Recently, I attempted to deserialize JSON data using the JSON.Net API with a dynamic datatype. After extensive research on various forums, I discovered that it is indeed possible to achieve this in WinRT. An example of JSON content could be: string json ...

Obtaining data from console.log and showcasing it within a div element

Currently, I am facing a challenge where I want to retrieve the title, plot, and poster using the themoviedb API. However, I am lost on how to begin coding this. Whenever I perform a search, the information is displayed in the console log of the browser. ...