@@ -59,32 +59,35 @@ public IndexedLogWriteBatch(
5959 MemoryLogRecordsIndexedBuilder .builder (
6060 schemaId , writeLimit , outputView , true );
6161
62- @ Override
63- public boolean isLogBatch () {
64- return true ;
65- }
62+ @ Override
63+ public boolean isLogBatch () {
64+ return true ;
65+ }
66+
67+ @ Override
68+ public boolean tryAppend (WriteRecord writeRecord , WriteCallback callback )
69+ throws Exception {
70+ checkNotNull (callback , "write callback must be not null" );
71+ checkNotNull (writeRecord .getRow (), "row must not be null for log record" );
72+ checkArgument (
73+ writeRecord .getKey () == null , "key must be null for log record" );
74+ checkArgument (
75+ writeRecord .getTargetColumns () == null ,
76+ "target columns must be null for log record" );
77+ checkArgument (
78+ writeRecord .getRow () instanceof IndexedRow ,
79+ "row must not be IndexRow for indexed log table" );
80+ IndexedRow row = (IndexedRow ) writeRecord .getRow ();
81+ if (!recordsBuilder .hasRoomFor (row ) || isClosed ()) {
82+ return false ;
83+ } else {
84+ recordsBuilder .append (ChangeType .APPEND_ONLY , row );
85+ recordCount ++;
86+ callbacks .add (callback );
87+ return true ;
88+ }
89+ }
6690
67- @ Override
68- public boolean tryAppend (WriteRecord writeRecord , WriteCallback callback ) throws Exception {
69- checkNotNull (callback , "write callback must be not null" );
70- checkNotNull (writeRecord .getRow (), "row must not be null for log record" );
71- checkArgument (writeRecord .getKey () == null , "key must be null for log record" );
72- checkArgument (
73- writeRecord .getTargetColumns () == null ,
74- "target columns must be null for log record" );
75- checkArgument (
76- writeRecord .getRow () instanceof IndexedRow ,
77- "row must not be IndexRow for indexed log table" );
78- IndexedRow row = (IndexedRow ) writeRecord .getRow ();
79- if (!recordsBuilder .hasRoomFor (row ) || isClosed ()) {
80- return false ;
81- } else {
82- recordsBuilder .append (ChangeType .APPEND_ONLY , row );
83- recordCount ++;
84- callbacks .add (callback );
85- return true ;
86- }
87- }
8891 @ Override
8992 public boolean hasRoomFor (IndexedRow row ) {
9093 return delegate .hasRoomFor (row );
0 commit comments