av9ash/GitBugs huggingface dataset:
Bug: Assign an error class to "Cannot parse the data type"
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 17/Nov/22 16:41
Affects Version/s: 3.4.0

The code below shows the issue:

{code}
> select from_csv('1', 'a InvalidType');

org.apache.spark.sql.AnalysisException
{
  "errorClass" : "LEGACY",
  "messageParameters" : {
    "message" : "Cannot parse the data type: \n[PARSE_SYNTAX_ERROR] Syntax error at or near 'InvalidType': extra input 'InvalidType'(line 1, pos 2)\n\n== SQL ==\na InvalidType\n--^^^\n\nFailed fallback parsing: \nDataType invalidtype is not supported.(line 1, pos 2)\n\n== SQL ==\na InvalidType\n--^^^\n; line 1 pos 7"
  }
{code}
Bug: Unset Read.schema is incorrectly read when unset
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 28/Nov/22 13:13
Affects Version/s: 3.4.0

The following query fails because the schema property is wrongly interpreted.

 
```
readDf = self.connect.read.format("csv").option("header", True).load(path=tmpPath)
```
Bug: Support other data type conversion in the DataTypeProtoConverter
Status: Resolved | Priority: Major | Resolution: Duplicate
Created: 09/Nov/22 02:39
Affects Version/s: 3.4.0

In https://github.com/apache/spark/blob/master/connector/connect/src/main/scala/org/apache/spark/sql/connect/planner/DataTypeProtoConverter.scala#L34 we only support INT, STRING and STRUCT type conversion to and from catalyst and connect proto.

We should be able to support all the types defined by https://github.com/apache/spark/blob/master/connector/connect/src/main/protobuf/spark/connect/types.proto
Bug: Check and upgrade buf.build/protocolbuffers/plugins/python to 3.19.5
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 25/Nov/22 09:09
Affects Version/s: 3.4.0

https://github.com/apache/spark/pull/38774

https://buf.build/protocolbuffers/plugins/python

when there is new version >= 3.19.5, should upgrade then
Bug: Migrate the map options errors onto error classes
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 17/Nov/22 16:55
Affects Version/s: 3.4.0

The example below demonstrates the issue:

{code}
> select from_csv('1', 'a INT', named_struct('mode', 'PERMISSIVE'))

org.apache.spark.sql.AnalysisException
{
  "errorClass" : "LEGACY",
  "messageParameters" : {
    "message" : "Must use a map() function for options.; line 1 pos 7"
  }
}
{code}

and


{code}
> select to_csv(named_struct('a', 1, 'b', 2), map('mode', 1));

org.apache.spark.sql.AnalysisException
{
  "errorClass" : "LEGACY",
  "messageParameters" : {
    "message" : "A type of keys and values in map() must be string, but got map<string,int>.; line 1 pos 7"
  }
}
{code}
Bug: Add acceptance test for self-union on streaming query
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 24/Nov/22 05:19
Affects Version/s: 3.4.0

SPARK-41040 fixed the issue on self-union for SPARK-39564. It was very simple to trigger and it blocked the query, but due to the lack of tests for self-union, we couldn't catch the issue during the work of SPARK-39564.

We would like to add some acceptance test for self-union on streaming query, for 4 different cases, DSv1 vs DSv2 / DataStreamReader API vs table API.
Bug: Assign a name to the error class _LEGACY_ERROR_TEMP_1102
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 17/Nov/22 17:00
Affects Version/s: 3.4.0

Assign a proper name to the legacy error class _LEGACY_ERROR_TEMP_1102 and make it visible to users.

The example below shows the issue:

{code}
> select extract(not_supported from c) from t;

org.apache.spark.sql.AnalysisException
{
  "errorClass" : "LEGACY",
  "messageParameters" : {
    "message" : "Literals of type 'not_supported' are currently not supported for the string type.; line 1 pos 7"
  }
}
{code}
Bug: Assign a name to the error class _LEGACY_ERROR_TEMP_1092
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 17/Nov/22 16:37
Affects Version/s: 3.4.0

Assign a proper name to the legacy error class _LEGACY_ERROR_TEMP_1092 and make it visible to users.

The example below shows the issue:

{code}
> select from_json('{"a":1}', 1);

org.apache.spark.sql.AnalysisException
{
  "errorClass" : "LEGACY",
  "messageParameters" : {
    "message" : "The expression '1' is not a valid schema string.; line 1 pos 7"
...
{code}
Bug: Propagate an error class to users for invalid `format` of `to_binary()`
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 17/Nov/22 13:47
Affects Version/s: 3.4.0

See https://github.com/apache/spark/blob/fabea7101ea55db991590ca2fbe1d4dfd25e5b28/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala#L2626

The example demonstrates the issue;

{code}
select to_binary('abc', 1)
{code}
Bug: Range partitioner sample supports column pruning
Status: In Progress | Priority: Major | Resolution: 
Created: 22/Nov/22 08:42
Affects Version/s: 3.4.0

When do a global sort, firstly we do sample to get range bounds, then we use the range partitioner to do shuffle exchange.
The issue is, the sample plan is coupled with the shuffle plan that causes we can not optimize the sample plan. What we need for sample plan is the columns for sort order but the shuffle plan contains all data columns.So at least, we can do column pruning for the sample plan to only fetch the ordering columns.

A common example is: `OPTIMIZE table ZORDER BY columns`
Bug: Incorrect relation caching for queries with time travel spec
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 16/Nov/22 04:27
Affects Version/s: 3.3.0

[https://github.com/apache/spark/pull/34497] added AS OF syntax support to support time travel queries in SQL. When resolving these [we cache the resolved relation|https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L1250] with only the qualified table name as the key, ignoring the time travel spec. Thus any subsequent queries on that table are resolved using the first's time travel spec.

This affects subqueries, CTEs, and temporary views (when created with SQL).

Queries like this will be incorrectly resolved:
{code:sql}
select * from table version as of 1
union all
select * from table version as of 0
{code}
--->
{code:sql}
select * from table version as of 1
union all
select * from table version as of 1
{code}

This was originally reported here https://github.com/delta-io/delta/issues/1479
Bug: Python file to be passed as argument using command-line option for PySpark
Status: Open | Priority: Major | Resolution: 
Created: 12/Nov/22 19:49
Affects Version/s: 3.2.2

*Background -*

I was trying to run multiple tests by passing the script / file to the different spark shells. All shells except PySpark accepts script as command line argument and processes the script. The alternate way to pass a file via commandline arguments is by using (<) operator on a shell like below 

_# pyspark --master yarn --deploy-mode client < python-example-script.py_

 

*Feature suggested -*

As PySpark can be used only in client mode and If the same functionality can be added for PySpark, it will help if anyone wants to try out only PySpark instead of running it via spark-submit.

spark-submit supports everything the spark shells{_}(accepting scripts with -i or -f option){_} can do but if there is a way to pass a script / file as argument to other spark shells(spark-shell, spark-sql) then why not the same can be provided with PySpark.
Bug: ParquetTable reports is supports negative scale decimal values
Status: Open | Priority: Major | Resolution: 
Created: 21/Nov/22 15:33
Affects Version/s: 3.0.0

This is likely very minor, but {{ParquetTable}} says it supports all {{AtomicTypes}}

https://github.com/apache/spark/blob/07427b854be58810bd485c00c5e5c576d5aa404e/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/parquet/ParquetTable.scala#L52

But the ParquetSpec and code says that negative scale decimal values are not supported, and the code will throw an exception if you try to store one.

{code}
 java.lang.IllegalArgumentException: Invalid DECIMAL scale: -2
	at org.apache.parquet.Preconditions.checkArgument(Preconditions.java:57)
	at org.apache.parquet.schema.Types$BasePrimitiveBuilder.decimalMetadata(Types.java:616)
	at org.apache.parquet.schema.Types$BasePrimitiveBuilder.build(Types.java:443)
	at org.apache.parquet.schema.Types$BasePrimitiveBuilder.build(Types.java:338)

{code}

We should update the ParquetTable code to be accurate in this respect.
Bug: Add utils for testing `checkError` in various test mode
Status: Open | Priority: Major | Resolution: 
Created: 21/Nov/22 01:39
Affects Version/s: 3.4.0

Currently, we test error class by using `checkError` test util, but it doesn't support various test Mode such as "non-codegen mode", "codegen mode" and "unsafe mode" for now. (so, it failed in CI: [#38644 (comment)|https://github.com/apache/spark/pull/38644#discussion_r1021424319]).

Thus, we need improved test util to allow testing error class in various expression test, such as "checkErrorInExpression" or something.
Bug: Streaming query metrics is broken with CTE
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 18/Nov/22 19:03
Affects Version/s: 3.2.2

We have observed a case the metrics are not available for the streaming query which contains CTE.

Looks like CTE was inlined in analysis phase in Spark 3.1.x and it was changed to be inlined in optimization phase in Spark 3.2.x. ProgressReporter depends on analyzed plan, hence the change made ProgressReporter to see CTE nodes, which ends up with having different number of leaf nodes between analyzed plan and executed plan.
Bug: Migrate the ambiguous ref error to an error class
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 17/Nov/22 13:26
Affects Version/s: 3.4.0

Use an error class in https://github.com/apache/spark/blob/99ae1d9a897909990881f14c5ea70a0d1a0bf456/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/package.scala#L372
Bug: Streaming query metrics is broken with mixed-up usage of DSv1 streaming source and DSv2 streaming source
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 18/Nov/22 20:46
Affects Version/s: 3.2.2

(It seems like a long standing issue. It probably applies to 2.x as well. I just marked the version line we did not EOL.)

If a streaming query contains both DSv1 and DSv2 streaming sources together, it only collects metrics properly for DSv1 sources.
Bug: Move `require()` out from the constructors of string expressions
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 17/Nov/22 13:38
Affects Version/s: 3.4.0

1. ConcatWs:
https://github.com/apache/spark/blob/fabea7101ea55db991590ca2fbe1d4dfd25e5b28/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala#L70
2. FormatString
https://github.com/apache/spark/blob/fabea7101ea55db991590ca2fbe1d4dfd25e5b28/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala#L1665
Bug: Hints on subqueries are not properly propagated
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 02/Nov/22 15:52
Affects Version/s: 3.0.0

Currently, if a user tries to specify a query like the following, the hints on the subquery will be lost. 
{code:java}
SELECT * FROM target t WHERE EXISTS
(SELECT /*+ BROADCAST */ * FROM source s WHERE s.key = t.key){code}
This happens as hints are removed from the plan and pulled into joins in the beginning of the optimization stage, but subqueries are only turned into joins during optimization. As we remove any hints that are not below a join, we end up removing hints that are below a subquery. 

 

It worked prior to a refactoring that added hints as a field to joins (SPARK-26065) and can cause a regression if someone made use of hints on subqueries before.

 

To resolve this, we add a hint field to SubqueryExpression that any hints inside a subquery's plan can be pulled into during EliminateResolvedHint, and then pass this hint on when the subquery is turned into a join.
Bug: Integrate UNSCALED_VALUE_TOO_LARGE_FOR_PRECISION into NUMERIC_VALUE_OUT_OF_RANGE
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 14/Nov/22 07:22
Affects Version/s: 3.4.0

UNSCALED_VALUE_TOO_LARGE_FOR_PRECISION is duplicated to NUMERIC_VALUE_OUT_OF_RANGE.

 

We should have one unique error class for similar cases to reduce the maintenance cost.
Bug: Spark 3.2.2 storage.ShuffleBlockFetcherIterator and TransportResponseHandler issue
Status: Open | Priority: Major | Resolution: 
Created: 16/Nov/22 19:49
Affects Version/s: 3.2.2

Hello there.

I've build spark 3.2.2 for my cluster which has hadoop 3.1.2 and scala 2.12 (pom.xml is attached).

build script:

 
{code:java}
cd spark && \
./build/mvn -Pyarn -Dhadoop.version=3.1.2 -Pscala-2.12 -Phive -Phive-thriftserver -DskipTests clean package {code}
 

It was working fine but a few applications has got strage error and warning form time to time.

It always looks like datanode connection lost and shuffle reading issues.
{code:java}
2022-11-16 22:18:25,423 ERROR server.TransportChannelHandler: Connection to s00abd02node9.company.com/10.x.y.163:35143 has been quiet for 120000 ms while there are outstanding requests. Assuming connection is dead; please adjust spark.shuffle.io.connectionTimeout if this is wrong.
2022-11-16 22:18:25,423 ERROR client.TransportResponseHandler: Still have 5 requests outstanding when connection from s00abd02node9.company.com/10.x.y.163:35143 is closed
2022-11-16 22:18:25,423 WARN netty.NettyBlockTransferService: Error while trying to get the host local dirs for [16]
2022-11-16 22:18:25,425 ERROR storage.ShuffleBlockFetcherIterator: Error occurred while fetching host local blocks {code}
So when it happend application will go to retry and fail after 2nd start.

Can anybody help?
Bug: Enhance Dataset.createTempView testing coverage for db_name.view_name
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 10/Nov/22 04:18
Affects Version/s: 3.4.0

Add the following test case to `DatasetSuite`:

dataset.createTempView("test_db.tempView")
spark.catalog.tableExists("test_db.tempView")
Bug: An error is reported when submitting a task to the yarn that enabled the timeline service
Status: In Progress | Priority: Major | Resolution: 
Created: 16/Nov/22 11:29
Affects Version/s: 3.0.0

java8、hadoop2、spark3.3.1
{code:java}
$SPARK_HOME/bin/spark-submit \
  --class org.apache.spark.examples.SparkPi \
  --master yarn \
  --deploy-mode cluster \
  $SPARK_HOME/examples/jars/spark-examples*.jar 10 {code}
The following errors were reported when submitting tasks to yarn with timeline service enabled：
{code:java}
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/client/config/ClientConfig
	at org.apache.hadoop.yarn.client.api.TimelineClient.createTimelineClient(TimelineClient.java:55)
	at org.apache.hadoop.yarn.client.api.impl.YarnClientImpl.createTimelineClient(YarnClientImpl.java:181)
	at org.apache.hadoop.yarn.client.api.impl.YarnClientImpl.serviceInit(YarnClientImpl.java:168)
	at org.apache.hadoop.service.AbstractService.init(AbstractService.java:163)
	at org.apache.spark.deploy.yarn.Client.submitApplication(Client.scala:191)
	at org.apache.spark.deploy.yarn.Client.run(Client.scala:1327)
	at org.apache.spark.deploy.yarn.YarnClusterApplication.start(Client.scala:1764)
	at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:958)
	at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:180)
	at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:203)
	at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:90)
	at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:1046)
	at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:1055)
	at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: com.sun.jersey.api.client.config.ClientConfig
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 14 more {code}
hadoop yarn-site.xml：
{code:java}
...

<property>
      <name>yarn.timeline-service.enabled</name>
      <value>true</value>
</property> 

...{code}
Bug: Print out schema as tree string format for state store schema checker
Status: Open | Priority: Major | Resolution: 
Created: 16/Nov/22 04:06
Affects Version/s: 3.4.0

When the state store schema checker detects the incompatibility and produces the error, the error log is not human friendly for schema comparison.

e.g. 
{code:java}
valueSchema: StructType(StructField(field1,StringType,true),StructField(field2,StringType,true),StructField(field3,StringType,true),StructField(_rescued_data,StringType,true),StructField(_metadata,StructType(StructField(file_path,StringType,true),StructField(file_name,StringType,true),StructField(file_size,LongType,true),StructField(file_modification_time,TimestampType,true)),false)) {code}
It should be much easier to compare if we print the schema out for tree string format. It will be multi-line which regress the UX, but the entire error message is already multi-line so should not a big deal.
Bug: UnresolvedHint should not cause query failure
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 15/Nov/22 04:39
Affects Version/s: 3.4.0

 
{code:java}
CREATE TABLE t1(c1 bigint) USING PARQUET;
CREATE TABLE t2(c2 bigint) USING PARQUET;
SELECT /*+ hash(t2) */ * FROM t1 join t2 on c1 = c2;{code}
 

 

failed with msg:
{code:java}
org.apache.spark.sql.catalyst.analysis.UnresolvedException: Invalid call to exprId on unresolved object
  at org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute.exprId(unresolved.scala:147)
  at org.apache.spark.sql.catalyst.analysis.Analyzer$AddMetadataColumns$.$anonfun$hasMetadataCol$4(Analyzer.scala:1005)
  at org.apache.spark.sql.catalyst.analysis.Analyzer$AddMetadataColumns$.$anonfun$hasMetadataCol$4$adapted(Analyzer.scala:1005)
  at scala.collection.Iterator.exists(Iterator.scala:969)
  at scala.collection.Iterator.exists$(Iterator.scala:967)
  at scala.collection.AbstractIterator.exists(Iterator.scala:1431)
  at scala.collection.IterableLike.exists(IterableLike.scala:79)
  at scala.collection.IterableLike.exists$(IterableLike.scala:78)
  at scala.collection.AbstractIterable.exists(Iterable.scala:56)
  at org.apache.spark.sql.catalyst.analysis.Analyzer$AddMetadataColumns$.$anonfun$hasMetadataCol$3(Analyzer.scala:1005)
  at org.apache.spark.sql.catalyst.analysis.Analyzer$AddMetadataColumns$.$anonfun$hasMetadataCol$3$adapted(Analyzer.scala:1005) {code}
Bug: Assert the offset range for file stream source in Trigger.AvailableNow
Status: Resolved | Priority: Major | Resolution: Not A Problem
Created: 15/Nov/22 06:42
Affects Version/s: 3.4.0

We encountered the issue where the data source did not properly implement the offset with Trigger.AvailableNow, and the query ran with processing same data continuously without stopping.

We would like to proactively avoid such case for most used data sources. I'll create a new JIRA ticket for Kafka data source as well.
Bug: Assert the offset range for Kafka source in Trigger.AvailableNow
Status: Open | Priority: Major | Resolution: 
Created: 15/Nov/22 06:43
Affects Version/s: 3.4.0

We encountered the issue where the data source did not properly implement the offset with Trigger.AvailableNow, and the query ran with processing same data continuously without stopping.

We would like to proactively avoid such case for most used data sources.
Bug: Introduce ComparableOffset as mixed-in interface for streaming offset
Status: Resolved | Priority: Major | Resolution: Abandoned
Created: 06/Nov/22 22:03
Affects Version/s: 3.4.0

Currently, Spark does not care about the offset range when planning microbatch, and it has been data source implementation's responsibility to check the boundary of offset range.

While not all types of offsets could provide comparison between two instances (some types may only be able to provide equality comparison), majority of types of offsets can do, which Spark can leverage it to perform the validation of offset range generally.
Bug: Convert the internal error about failed stream to user-facing error
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 09/Nov/22 06:29
Affects Version/s: 3.4.0

Assign an error class to the following internal error since it is an user-facing error:

{code}
java.lang.Exception: org.apache.spark.sql.streaming.StreamingQueryException: Query cloudtrail_pipeline [id = 5a3758c3-3b3a-47ff-843a-23292cde3b4f, runId = c1a90694-daa2-4929-b749-82b8a43fa2b1] terminated with exception: [INTERNAL_ERROR] Execution of the stream cloudtrail_pipeline failed. Please, fill a bug report in, and provide the full stack trace. 2 at org.apache.spark.sql.execution.streaming.StreamExecution.org$apache$spark$sql$execution$streaming$StreamExecution$$runStream(StreamExecution.scala:403) 3 at org.apache.spark.sql.execution.streaming.StreamExecution$$anon$1.$anonfun$run$4(StreamExecution.scala:269) 4 at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) 5 at com.databricks.unity.EmptyHandle$.runWithAndClose(UCSHandle.scala:42) 6 at org.apache.spark.sql.execution.streaming.StreamExecution$$anon$1.run(StreamExecution.scala:269) 7Caused by: java.lang.Exception: org.apache.spark.SparkException: [INTERNAL_ERROR] Execution of the stream cloudtrail_pipeline failed. Please, fill a bug report in, and provide the full stack trace. 8 at 
{code}
Bug: Support named arguments functions
Status: Open | Priority: Major | Resolution: 
Created: 15/Nov/22 03:43
Affects Version/s: 3.3.2

Support named arguments functions in Spark SQL.

General usage: _FUNC_(arg0, arg1, arg2, arg5 => value5, arg8 => value8)
 * Arguments can be passed positionally or by name
 * Positional arguments cannot come after a named argument.
Bug: Spark ThriftServer generate huge amounts of DelegationToken
Status: Resolved | Priority: Major | Resolution: Duplicate
Created: 09/Nov/22 07:26
Affects Version/s: 3.0.1

In our cluster, zookeeper nearly crashed. I found the znodes of /zkdtsm/ZKDTSMRoot/ZKDTSMTokensRoot increased quickly. 
After some research, I found some sql running on spark-thriftserver obtain huge amounts of DelegationToken.
The reason is that in these spark-sql, every hive parition acquire a different delegation token. 
And HadoopRDDs in thriftserver can't share credentials from CoarseGrainedSchedulerBackend::delegationTokens, we must share it.
Bug: Support reading parquet FIXED_LEN_BYTE_ARRAY type
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 10/Nov/22 08:59
Affects Version/s: 3.4.0

Parquet has FIXED_LEN_BYTE_ARRAY (FLBA) data type. However, Spark Parquet reader currently cannot handle it.
Read it as BinaryType in Spark.

Iceberg Parquet reader, for example, can handle FLBA. This improvement should reduce the gap between Spark and Iceberg Parquet reader.
Bug: Convert LikeAny and NotLikeAny to InSet if no pattern contains wildcards
Status: In Progress | Priority: Major | Resolution: 
Created: 14/Nov/22 07:15
Affects Version/s: 3.4.0

We can optimize query 
{code:sql}
SELECT * FROM tab WHERE trim(addr) LIKE ANY ('5000', '5001', '5002', '5003', '5004')
 {code}
to 
{code:sql}
SELECT * FROM tab WHERE trim(addr) IN ('5000', '5001', '5002', '5003', '5004')
 {code}