You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "Istvan Toth (Jira)" <ji...@apache.org> on 2022/09/28 11:29:00 UTC

[jira] [Commented] (PHOENIX-6795) Default value evaluation happens in the read path

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

Istvan Toth commented on PHOENIX-6795:
--------------------------------------


{noformat}
Daemon Thread [RpcServer.default.FPBQ.Fifo.handler=0,queue=0,port=42865] (Suspended (entry into method evaluate in DefaultValueExpression))	
	owns: BaseScannerRegionObserver$RegionScannerHolder  (id=1085)	
	DefaultValueExpression.evaluate(Tuple, ImmutableBytesWritable) line: 49	
	KeyValueSchema.toBytes(Tuple, Expression[], ValueBitSet, ImmutableBytesWritable) line: 113	
	TupleProjector.projectResults(Tuple, boolean) line: 427	
	RegionScannerFactory$1.nextRaw(List<Cell>) line: 282	
	BaseScannerRegionObserver$RegionScannerHolder$1(DelegateRegionScanner).nextRaw(List<Cell>) line: 77	
	BaseScannerRegionObserver$RegionScannerHolder(DelegateRegionScanner).nextRaw(List<Cell>) line: 77	
	BaseScannerRegionObserver$RegionScannerHolder.nextRaw(List<Cell>, ScannerContext) line: 356	
	RSRpcServices.scan(HBaseRpcController, ScanRequest, RegionScannerHolder, long, int, int, List<Result>, Builder, MutableObject<Object>, RpcCallContext) line: 3330	
	RSRpcServices.scan(RpcController, ClientProtos$ScanRequest) line: 3596	
	ClientProtos$ClientService$2.callBlockingMethod(Descriptors$MethodDescriptor, RpcController, Message) line: 45949	
	NettyRpcServer(RpcServer).call(RpcCall, MonitoredRPCHandler) line: 384	
	CallRunner.run() line: 131	
	FastPathBalancedQueueRpcExecutor$FastPathHandler(RpcExecutor$Handler).run(CallRunner) line: 371	
	FastPathBalancedQueueRpcExecutor$FastPathHandler(RpcExecutor$Handler).run() line: 351	

{noformat}


> Default value evaluation happens in the read path
> -------------------------------------------------
>
>                 Key: PHOENIX-6795
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6795
>             Project: Phoenix
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 5.2.0
>            Reporter: Istvan Toth
>            Priority: Major
>
> At least in some cases, the default value for a column is getting evaluated during read time.
> This does not conform to the SQL standard, and results in incorrect behaviour:
>  
> {code:java}
> create table test id integer primary key, int v1 default 20;
> upsert into test (id, v1) values (1,1)
> select v1 from test where id = 1;
> -- results in 1, correct
> upsert into test (id) values (2)
> -- v1 is not stored
> select v1 from test where id = 2;
> -- results 1, correct, because default applied during read time
> upsert into test (id, v1) values (3, null)
> -- v1 is not stored
> select v1 from test where id = 1;
> -- results 1, which is INCORRECT, as a default shouldn't override an explicit NULL value{code}
> The correct behaviour would be resolving the default value during upsert, and not doing any default processing during select queries.
>  I  encountered specifically during testing a DATETIME column:
> {noformat}
> COLUMN_WITH_DEFAULT DATETIME DEFAULT DATETIME '2011-01-01 01:01:01'
> {noformat}



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