Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test update 6.2 #305

Open
wants to merge 5 commits into
base: main-6.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion java/test.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ configure(ext.leafProjects) {
minHeapSize = "1024m"

include '**/*Test_*'
ignoreFailures = true

testLogging.showStandardStreams = true
reports.html.enabled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private void replicate(StreamStorage from, StreamStorage to, ReplicationOptions
RawMessage msg;

TickCursor sCursor = source.select(Long.MIN_VALUE, so, null,
new IdentityKey[] { new ConstantIdentityKey("@SYSTEM") });
new IdentityKey[] { new ConstantIdentityKey("") }); // @SYSTEM
msm.add(sCursor);

boolean logVersionErrors = true;
Expand Down Expand Up @@ -1171,7 +1171,7 @@ public boolean accept(File dir, String name) {
RawMessage msg;

TickCursor sCursor = source.select(Long.MIN_VALUE, so, null,
new IdentityKey[] { new ConstantIdentityKey("@SYSTEM") });
new IdentityKey[] { new ConstantIdentityKey("") });// @SYSTEM
msm.add(sCursor);

boolean logVersionErrors = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class SchemaChangeMessageBuilder {

public SchemaChangeMessage build(StreamMetaDataChange metaDataChange) {
return build(metaDataChange, "@SYSTEM", System.currentTimeMillis());
return build(metaDataChange, "", System.currentTimeMillis()); // @SYSTEM
}

public SchemaChangeMessage build(StreamMetaDataChange metaDataChange, String symbol, long timestamp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.epam.deltix.qsrv.hf.tickdb.lang.compiler.sx.*;
import com.epam.deltix.qsrv.hf.tickdb.lang.pub.BinaryLogicalOperation;
import com.epam.deltix.qsrv.hf.tickdb.lang.pub.OrderRelation;
import com.epam.deltix.timebase.messages.TypeConstants;

import java.util.ArrayList;
import java.util.HashSet;
Expand Down Expand Up @@ -189,7 +190,7 @@ private static boolean updateRange(TimestampLimits range,
}
long resetVal = isConstNs ? QQLCompilerUtils.nsToMs(constant.getLong()) : constant.getLong();
matched = !isSelectorNs && !isConstNs;
range.update(resetVal, relation, timestampOnRight, matched);
range.update(resetVal, relation, timestampOnRight, matched, isConstNs);
} else if (arg instanceof ParamAccess) {
if (isSelectorNs) {
range.update((ParamAccess) arg, relation, timestampOnRight, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ public void update(CompiledExpression<?> e, OrderRelation code, boolean timestam
if (e instanceof CompiledConstant) {
CompiledConstant cc = (CompiledConstant) e;
long t = (Long) cc.value;
updateInterval(t, code, true);
updateInterval(t, code, true, false);
} else if (e instanceof ParamAccess) {
ParamAccess pa = (ParamAccess) e;
updateInterval(pa, code, false);
}
}

public void update(long t, OrderRelation code, boolean timestampOnRight, boolean matchExact) {
updateInterval(t, convertCode(code, timestampOnRight), matchExact);
public void update(long t, OrderRelation code, boolean timestampOnRight, boolean matchExact, boolean isConstNs) {
updateInterval(t, convertCode(code, timestampOnRight), matchExact, isConstNs);
}

public void update(ParamAccess pa, OrderRelation code, boolean timestampOnRight, boolean nanos) {
Expand All @@ -102,7 +102,7 @@ private OrderRelation convertCode(OrderRelation code, boolean timestampOnRight)
return code;
}

private void updateInterval(long t, OrderRelation code, boolean matchExact) {
private void updateInterval(long t, OrderRelation code, boolean matchExact, boolean isConstNs) {
switch (code) {
case GT:
inclusiveMinimum = Math.max(inclusiveMinimum, matchExact ? t + 1 : t);
Expand All @@ -111,12 +111,21 @@ private void updateInterval(long t, OrderRelation code, boolean matchExact) {
inclusiveMinimum = Math.max(inclusiveMinimum, t);
break;
case LT:
if (isConstNs) {
t += 1;
}
inclusiveMaximum = Math.min(inclusiveMaximum, matchExact ? t - 1 : t);
break;
case LE:
if (isConstNs) {
t += 1;
}
inclusiveMaximum = Math.min(inclusiveMaximum, t);
break;
case EQ:
if (isConstNs) {
t += 1;
}
inclusiveMinimum = Math.max(inclusiveMinimum, t);
inclusiveMaximum = Math.min(inclusiveMaximum, t);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ private long getMinTimestamp(int[] paramNums, int i) {
if (isNotStrictCondition(paramNums[i])) {
return value - 1;
} else if (isNanos(paramNums[i])) {
return QQLCompilerUtils.nsToMs(value);
return QQLCompilerUtils.nsToMs(value) + 1;
}

return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1522,13 +1522,19 @@ public synchronized void delete() {
@Override
public synchronized void setPolymorphic (RecordClassDescriptor ... cds) {
runUnderLock(() -> {
if (getTimeRange() != null) {
throw new UnsupportedOperationException("Stream types cannot be reset in a non-empty stream. Use @SchemaChangeTask");
}
super.setPolymorphic(cds);
});
}

@Override
public synchronized void setFixedType (RecordClassDescriptor cd) {
runUnderLock(() -> {
if (getTimeRange() != null) {
throw new UnsupportedOperationException("Stream types cannot be reset in a non-empty stream. Use @SchemaChangeTask");
}
super.setFixedType(cd);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,10 @@ public ClassSet<ClassDescriptor> describeQuery(String qql, SelectionOptions opti

@Override
public InstrumentMessageSource executeQuery(String qql, SelectionOptions options, TickStream[] streams, CharSequence[] ids, long startTimestamp, long endTimestamp, Parameter... params) throws CompilationException {
return null;
if (delegate instanceof PQExecutor)
return executeQuery((PQExecutor) delegate, qql, options, streams, ids, startTimestamp == TimeConstants.TIMESTAMP_UNKNOWN, startTimestamp, endTimestamp, params);

return delegate.executeQuery(qql, options, streams, ids, startTimestamp, endTimestamp, params);
}

@Override
Expand Down Expand Up @@ -383,6 +386,33 @@ private InstrumentMessageSource executeQuery(PQExecutor executor,
return executor.executePreparedQuery(pq, options, streams, ids, fullScan, time, params);
}

private InstrumentMessageSource executeQuery(PQExecutor executor,
String qql,
SelectionOptions options,
TickStream[] streams,
CharSequence[] ids,
boolean fullScan,
long startTimestamp,
long endTimestamp,
Parameter[] params)
{
return executeQuery(executor, CompilerUtil.parse(qql), options, streams, ids, fullScan, startTimestamp, endTimestamp, params);
}

private InstrumentMessageSource executeQuery(PQExecutor executor,
Element parsedQQL,
SelectionOptions options,
TickStream[] streams,
CharSequence[] ids,
boolean fullScan,
long startTimestamp,
long endTimestamp,
Parameter[] params)
{
PreparedQuery pq = pqCache.prepareQuery(parsedQQL, ParamSignature.signatureOf(params), endTimestamp);
return executor.executePreparedQuery(pq, options, streams, ids, fullScan, startTimestamp, params);
}

@Override
public void format() {
pqCache.clear();
Expand Down Expand Up @@ -595,4 +625,4 @@ public TopicDB getTopicDB() {
public boolean isTopicDBSupported() {
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.epam.deltix.util.memory.MemoryDataInput;
import com.epam.deltix.util.memory.MemoryDataOutput;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

Expand Down Expand Up @@ -215,6 +216,7 @@ private static String createDB(String zipFileName) throws IOException, Interrupt
}

@Test
@Ignore // TODO: 2/11/2025 @AK need add test source ZIP field
public void testNestedArrays() throws Exception {
String path = createDB(ZIP.getAbsolutePath());

Expand Down Expand Up @@ -3053,8 +3055,6 @@ public void testNotNullable4CompoundIntp() throws Exception {

private void testNotNullable4CompoundBound() throws Exception {
RecordClassDescriptor rcd = getRCD(AllCompoundFields.class);
rcd = changeRCDNullability(rcd, false);

final RecordClassDescriptor rcdNullable = changeRCDNullability(rcd, true);
final AllCompoundFields msg = new AllCompoundFields();

Expand Down Expand Up @@ -3086,7 +3086,7 @@ private void testNotNullable4CompoundBound() throws Exception {
MemoryDataInput in = new MemoryDataInput(out);
boundDecode(null, rcd, in);
fail("field level decode " + fieldName);
} catch (IllegalArgumentException e1) {
} catch (AssertionError e1) {
Assert.assertEquals(String.format("'%s' field is not nullable", fieldName), e1.getMessage());
}
}
Expand Down Expand Up @@ -3211,8 +3211,8 @@ private void testNullOnDecode() throws Exception {
try {
boundDecode(null, rcdNotNull, in);
Assert.fail("totally empty");
} catch (Exception e) {
Assert.assertEquals("'f1' field is not nullable", e.getCause().getMessage());
} catch (AssertionError e) {
Assert.assertEquals("'f1' field is not nullable", e.getMessage());
}

// 2. 1st field != null, 2nd == null
Expand All @@ -3223,11 +3223,11 @@ private void testNullOnDecode() throws Exception {
try {
boundDecode(null, rcdNotNull, in);
Assert.fail("1st field != null, 2nd == null");
} catch (RuntimeException e) {
if (e instanceof IllegalStateException )
Assert.assertEquals("cannot write null to not nullable field 'f1'", e.getMessage());
else
Assert.assertEquals("'f2' field is not nullable", e.getCause().getMessage());
} catch (AssertionError e) {
Assert.assertEquals("'f2' field is not nullable", e.getMessage());
}
catch (IllegalStateException e2) {
Assert.assertEquals("cannot write null to not nullable field 'f1'", e2.getMessage());
}

// 3. array has null elements
Expand All @@ -3237,11 +3237,11 @@ private void testNullOnDecode() throws Exception {
try {
boundDecode(null, rcdNotNull, in);
Assert.fail("array has null elements");
} catch (RuntimeException e) {
if (e instanceof IllegalStateException)
Assert.assertEquals("cannot write null to not nullable field 'f1'", e.getMessage());
else
Assert.assertEquals("'f1[]' field array element is not nullable", e.getCause().getMessage());
} catch (AssertionError e) {
Assert.assertEquals("'f1[]' field array element is not nullable", e.getMessage());
}
catch (IllegalStateException e2) {
Assert.assertEquals("cannot write null to not nullable field 'f1'", e2.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
import com.epam.deltix.util.io.Home;
import com.epam.deltix.util.lang.StringUtils;
import com.epam.deltix.util.lang.Util;
import org.junit.Test;
import org.junit.Before;
import org.junit.After;
import org.junit.Assert;
import org.junit.*;

import java.io.IOException;
import java.io.File;
Expand All @@ -48,6 +45,7 @@
* Time: 7:37:26 PM
*/
@Category(TickDBFast.class)
@Ignore // TODO: 2/11/2025 @AK need add test source ZIP field
public class Test_BiltInExtention {
private static final File DIR = Home.getFile("testdata", "qsrv", "hf", "tickdb");
private static final File ZIP = new File(DIR, "tickdb.ticksEx.zip");
Expand Down
Loading
Loading