Hi,
I’ll add some more info here regarding the error trace and the table structure. I exported the table data with COPY TO command, really helpful command. But I cannot upload the json files, because it’s not allowed for new users.
Here’s an example:
{"alert_flag":18,"client_id":5,"client_name":"User 5","client_time":"1666017322","content_policy":"nGXqa","department_id":4,"destination":"iGMxz","destination_type":"NuRyL","dr_discover_id":4,"dr_discover_scan_id":33,"dr_policy_id":3,"epp_server_id":"epp-console-test-client","event_id":50,"event_time_local":"2021-12-26 19:42:05","file_name":"xMUPh","file_size":20,"hashlog_id":"tnKFW","item_details":"ViTxv","item_type":"iFlRv","last_error":"SGsrS","legacy_log_type":4,"loc_log_id":"wdhwr","log_type":"SDR","machine_id":3,"machine_name":"Computer 3","matched_item":"iIMSB","modified_at":"2021-01-01T14:48:00.000Z","nr_reports":73,"object_id":60,"policy_name":"Policy 3","timestamp":1635442108000,"status":0,"month":1633046400000}
{"alert_flag":81,"client_id":2,"client_name":"User 2","client_time":"1666017322","content_policy":"tOIgO","department_id":3,"destination":"alrbz","destination_type":"tZLfx","dr_discover_id":5,"dr_discover_scan_id":31,"dr_policy_id":4,"epp_server_id":"epp-console-test-client","event_id":41,"event_time_local":"2022-10-08 03:21:25","file_name":"aSqSb","file_size":71,"hashlog_id":"KKaBK","item_details":"RlCTF","item_type":"roHjp","last_error":"TSIdv","legacy_log_type":4,"loc_log_id":"ZOfnK","log_type":"SDR","machine_id":4,"machine_name":"Computer 4","matched_item":"pOutJ","modified_at":"2021-01-01T14:48:00.000Z","nr_reports":88,"object_id":39,"policy_name":"Policy 4","timestamp":1635427759000,"status":0,"month":1633046400000}
{"alert_flag":48,"client_id":4,"client_name":"User 4","client_time":"1666017322","content_policy":"udLuB","department_id":2,"destination":"WqmAJ","destination_type":"DbOat","dr_discover_id":4,"dr_discover_scan_id":79,"dr_policy_id":3,"epp_server_id":"epp-console-test-client","event_id":43,"event_time_local":"2021-11-22 18:58:10","file_name":"FHovS","file_size":84,"hashlog_id":"mLKSX","item_details":"WjdkI","item_type":"kMvlc","last_error":"kzkjw","legacy_log_type":4,"loc_log_id":"ogjth","log_type":"SDR","machine_id":2,"machine_name":"Computer 2","matched_item":"valCh","modified_at":"2021-01-01T14:48:00.000Z","nr_reports":4,"object_id":16,"policy_name":"Policy 3","timestamp":1634923955000,"status":0,"month":1633046400000}
Hope it helps.
Query causing the issue
SELECT _id , * FROM sdr_logs ORDER BY item_details ASC LIMIT 500
Error trace
java.lang.ClassCastException: class org.apache.lucene.util.BytesRef cannot be cast to class java.lang.String (org.apache.lucene.util.BytesRef is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')
at io.crate.types.StringType$1.rangeQuery(StringType.java:68)
at io.crate.execution.engine.collect.collectors.OptimizeQueryForSearchAfter.apply(OptimizeQueryForSearchAfter.java:101)
at io.crate.execution.engine.collect.collectors.OptimizeQueryForSearchAfter.apply(OptimizeQueryForSearchAfter.java:42)
at io.crate.execution.engine.collect.collectors.LuceneOrderedDocCollector.query(LuceneOrderedDocCollector.java:215)
at io.crate.execution.engine.collect.collectors.LuceneOrderedDocCollector.searchMore(LuceneOrderedDocCollector.java:187)
at io.crate.execution.engine.collect.collectors.LuceneOrderedDocCollector.collect(LuceneOrderedDocCollector.java:137)
at io.crate.execution.engine.collect.collectors.OrderedDocCollector.get(OrderedDocCollector.java:82)
at io.crate.execution.engine.collect.collectors.OrderedLuceneBatchIteratorFactory$Factory.loadFrom(OrderedLuceneBatchIteratorFactory.java:127)
at io.crate.execution.engine.collect.collectors.OrderedLuceneBatchIteratorFactory$Factory.tryFetchMore(OrderedLuceneBatchIteratorFactory.java:120)
at io.crate.execution.engine.distribution.merge.BatchPagingIterator.loadNextBatch(BatchPagingIterator.java:116)
at io.crate.data.MappedForwardingBatchIterator.loadNextBatch(MappedForwardingBatchIterator.java:51)
at io.crate.data.LimitingBatchIterator.loadNextBatch(LimitingBatchIterator.java:69)
at io.crate.data.MappedForwardingBatchIterator.loadNextBatch(MappedForwardingBatchIterator.java:51)
at io.crate.data.AsyncFlatMapBatchIterator.loadNextBatch(AsyncFlatMapBatchIterator.java:111)
at io.crate.action.sql.RowConsumerToResultReceiver.consumeIt(RowConsumerToResultReceiver.java:84)
at io.crate.action.sql.RowConsumerToResultReceiver.lambda$consumeIt$1(RowConsumerToResultReceiver.java:86)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
at java.base/java.util.concurrent.CompletableFuture.uniWhenCompleteStage(CompletableFuture.java:887)
at java.base/java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:2325)
at java.base/java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:144)
at io.crate.concurrent.KillableCompletionStage.whenComplete(KillableCompletionStage.java:232)
at io.crate.concurrent.KillableCompletionStage.whenComplete(KillableCompletionStage.java:35)
at io.crate.action.sql.RowConsumerToResultReceiver.consumeIt(RowConsumerToResultReceiver.java:84)
at io.crate.action.sql.RowConsumerToResultReceiver.lambda$consumeIt$1(RowConsumerToResultReceiver.java:86)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1773)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Table structure
CREATE TABLE IF NOT EXISTS "doc"."sdr_logs" (
"timestamp" BIGINT,
"epp_server_id" TEXT,
"object_id" BIGINT,
"action_id" INTEGER,
"loc_log_id" TEXT,
"event_id" INTEGER,
"machine_id" INTEGER,
"machine_name" TEXT,
"client_id" INTEGER,
"client_name" TEXT,
"destination_type" TEXT,
"destination" TEXT,
"file_name" TEXT,
"content_policy" TEXT,
"item_type" TEXT,
"matched_item" TEXT,
"item_details" TEXT,
"event_time_local" TEXT,
"alert_flag" INTEGER,
"nr_reports" INTEGER,
"file_size" BIGINT,
"legacy_log_type" INTEGER,
"object_state" INTEGER,
"dr_discover_scan_id" INTEGER,
"modified_at" TEXT,
"dr_policy_id" INTEGER,
"dr_discover_id" INTEGER,
"policy_name" TEXT,
"hashlog_id" TEXT,
"last_error" TEXT,
"department_id" INTEGER,
"client_time" TEXT,
"log_type" TEXT,
"sent_at" TEXT,
"status" INTEGER DEFAULT 0,
"month" TIMESTAMP WITH TIME ZONE GENERATED ALWAYS AS date_trunc('month', "timestamp")
)
CLUSTERED INTO 4 SHARDS
PARTITIONED BY ("month")
WITH (
"allocation.max_retries" = 5,
"blocks.metadata" = false,
"blocks.read" = false,
"blocks.read_only" = false,
"blocks.read_only_allow_delete" = false,
"blocks.write" = false,
codec = 'default',
column_policy = 'strict',
"mapping.total_fields.limit" = 1000,
max_ngram_diff = 1,
max_shingle_diff = 3,
number_of_replicas = '0-1',
"routing.allocation.enable" = 'all',
"routing.allocation.total_shards_per_node" = -1,
"store.type" = 'fs',
"translog.durability" = 'REQUEST',
"translog.flush_threshold_size" = 536870912,
"translog.sync_interval" = 5000,
"unassigned.node_left.delayed_timeout" = 60000,
"write.wait_for_active_shards" = '1'
)