[ 
https://issues.apache.org/jira/browse/CALCITE-5712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17724811#comment-17724811
 ] 

Min-Seok Kim commented on CALCITE-5712:
---------------------------------------

The issue does not seem to stem from the coroutine.

The problem can be replicated by doing the following:
 # with 2.0.0 and above version of 'org.slf4j:slf4j-api'
 # with 1.4.5 and above version of "ch.qos.logback:logback-classic"

 

$ ./gradlew :example:csv:test --tests 
"org.apache.calcite.test.CsvTest.testFilterableWhere"

shows

 

FAILURE   1.1sec, org.apache.calcite.test.CsvTest > testFilterableWhere()
    java.lang.AssertionError: RelSubset [rel#42:RelSubset#2.ENUMERABLE.[]] has 
wrong best cost \{130.0 rows, 246.0 cpu, 0.0 io}. Correct cost is \{150.5 rows, 
350.505 cpu, 0.0 io}
        at org.apache.calcite.util.Litmus.lambda$static$0(Litmus.java:31)
        at 
org.apache.calcite.plan.volcano.VolcanoPlanner.isValid(VolcanoPlanner.java:657)

 

 

here is git diff on {*}calcite-1.34.0{*}{*}{*}

 
{code:java}
$ git diff
diff --git a/example/csv/build.gradle.kts b/example/csv/build.gradle.kts
index edf2d8eed..daf85c266 100644
--- a/example/csv/build.gradle.kts
+++ b/example/csv/build.gradle.kts
@@ -47,6 +47,8 @@
     compileOnly("org.immutables:value-annotations")
     compileOnly("com.google.code.findbugs:jsr305")
 
+    testImplementation("ch.qos.logback:logback-classic:1.3.0")
     testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 }
 
diff --git a/gradle.properties b/gradle.properties
index 516dff1c7..baa64071b 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -151,7 +151,7 @@ scala-library.version=2.10.3
 scott-data-hsqldb.version=0.2
 servlet.version=4.0.1
 sketches-core.version=0.9.0
-slf4j.version=1.7.25
+slf4j.version=2.0.0
 spark.version=2.2.2
 sqlline.version=1.12.0
 teradata.tpcds.version=1.2 {code}
 

 

> FilterableTable with Kotlin coroutine(kotest) and logback fails:  RelSubset 
> ... has wrong best cost 
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-5712
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5712
>             Project: Calcite
>          Issue Type: Bug
>         Environment: Operating System: macOS Ventura 13.3.1(22E261)
> JDK Version: openjdk version "17.0.5" 2022-10-18 LTS
>            Reporter: Min-Seok Kim
>            Priority: Major
>         Attachments: image-2023-05-19-16-09-28-894.png
>
>
> The MyFilterableTable class is not functioning properly when used in 
> conjunction with coroutines (kotest) and logback. The issue can be reproduced 
> by following the steps outlined in the GitHub repository provided: 
> [https://github.com/emesday/filterabletable-coroutine/blob/main/src/test/kotlin/MinimalTest.kt]
> {code:java}
> class MyFilterableTable : AbstractTable(), FilterableTable {
>     override fun getRowType(typeFactory: RelDataTypeFactory): RelDataType {
>         return typeFactory.createStructType(
>             listOf(typeFactory.createSqlType(SqlTypeName.BIGINT), 
> typeFactory.createSqlType(SqlTypeName.VARCHAR)),
>             listOf("ID", "NAME")
>         )
>     }    override fun scan(root: DataContext?, filters: 
> MutableList<RexNode>?): Enumerable<Array<Any?>> {
>         return Linq4j.asEnumerable(arrayOf(arrayOf(1L, "John")))
>     }
> }
> {code}
> *Steps to Reproduce:*
>  # Clone the GitHub repository 
> [https://github.com/emesday/filterabletable-coroutine]
>  # USE_LOGBACK=true ./gradlew test -i
>  ## this executes MinimalTest in src/test/kotlin/MinimalTest.kt
> *Expected Behavior:*
> The MyFilterableTable class should work correctly with coroutines (kotest) 
> and logback.
> *Actual Behavior:*
> The MyFilterableTable class fails to function as expected when used in 
> combination with coroutines (kotest) and logback. The failure message in the 
> test case is as follows:
> {code:java}
> MinimalTest > MyFilterableTable fails FAILED
>     java.lang.AssertionError: RelSubset [rel#78:RelSubset#2.ENUMERABLE.[]] 
> has wrong best cost {130.0 rows, 216.0 cpu, 0.0 io}. Correct cost is {150.5 
> rows, 150.505 cpu, 0.0 io}
>         at org.apache.calcite.util.Litmus.lambda$static$0(Litmus.java:31) 
> {code}
> *Additional Information:*
>  * Note that the MyScannableTable class is not affected by this issue.
>  * When executing the test individually by running the 'MyFilterableTable 
> fails' function using the IntelliJ plugin the MyFilterableTable class works 
> correctly.
> !image-2023-05-19-16-09-28-894.png|width=319,height=57!
> Please feel free to make any necessary adjustments or additions to the 
> provided information.
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to